China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-20 21:41
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » A program that draws a small window on the DOS screen View 1,879 Replies 3
Original Poster Posted 2002-10-28 00:00 ·  中国 江西 吉安 电信
高级用户
★★
Credits 667
Posts 135
Joined 2002-10-25 00:00
23-year member
UID 62
Gender Male
Status Offline
These were all things I wrote myself for fun back when I was practicing.
==============
dseg segment
cury db 0
curx db 0
luy db 10
lux db 30
rdy db 15
rdx db 40
cont db 5
dseg ends
clear macro
mov ah ,6
mov al ,0
mov ch ,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10
endm
scroll macro
mov h,6
mov al,cont
mov ch,luy
mov cl,lux
mov dh,rdy
mov dl,rdx
mov bh,70h
int 10h
endm
postc macro
mov ah,2
mov dh,cury
mov dl,curx
mov bh,0
int 10
endm
;--------------------------------
cseg segment
assume cs:cseg,ds:dseg
main proc far
push ds
sub ax,ax
push ax
mov ax,dseg
mov ds,ax
clear
scroll cont
postc
input:
mov ah,0
int 16
cmp ah,abh
jnz no_left
cmp curx,0
jnz l1
cmp cury,0
jnz l3
jmp input
l1:
dec curx
jmp l5
l3:
dec cury
mov curx,79
l5:
postc
jmp input
no_left:
cmp ah,4dh
jnz no_right
cmp curx,79
jnz r1
cmp cury,24
jnz r3
jmp input
r1:
inc curx
jmp r5
r3:
inc cury
mov curx,0
r5:
postc
jmp input
no_right:
cmp ah,48h
jnz no_up
cmp cury,0
jz up1
dec cury
postc
up1:
jmp input
no_up:
cmp ah,50h
jnz no_down
cmp cury,24
jz d1
inc cury
postc
d1:
jmp input
no_down:
cmp ah,4fh
jz setxy
cmp ah,01
jnz disp
ret
disp:
mov ah,0ah
mov bh,0
mov cx,1
int 10h
inc curx
mov al,curx
cmp al,rdx
jl next
scroll 1
mov al,lux
mov curx,al
next:
postc
jmp input
setxy:
mov al,cury
mov bl,curx
cmp al,luy
jl s1
cmp bl,lux
jl s2
mov rdy,al
mov rdx,bl
jmp new
s1:
cmp bl,rdx
jle s3
jmp input
s2:
cmp al,rdy
jg s5
s3:
mov luy,al
mov lux,bl
new:
mov al,rdy
sub al,luy
inc al
mov cont ,al
clear
scroll cont
s5:
jmp input
main endp
;-----------------------------
cseg ends
end main
================
So many years have passed, I’ve forgotten it all too. Compile it yourself and give it a try, and you’ll know.
================================= kickout
大功告成,打个Kiss!
Floor 2 Posted 2002-10-28 00:00 ·  中国 江西 吉安 电信
高级用户
★★
Credits 667
Posts 135
Joined 2002-10-25 00:00
23-year member
UID 62
Gender Male
Status Offline
This is about the same as the one above, but I’m sure there are still differences. Compile it and compare them, and you’ll know
=====================
dseg segment
cury db 0
curx db 0
luy db 10
lux db 30
rdy db 15
rdx db 40
cont db 5
dseg ends
stack segment para stack'stack'
db 64 dup(?)
stack ends
clear macro
mov ah ,6
mov al ,18h
mov ch ,0
mov cl,0
mov dh,24
mov dl,79
mov bh,7
int 10h
endm
scroll macro cont
mov ah,6
mov al,cont
mov ch,luy
mov cl,lux
mov dh,rdy
mov dl,rdx
mov bh,00011111b
int 10h
endm
postc macro
mov ah,2
mov dh,cury
mov dl,curx
mov bh,0
int 10h
endm
;--------------------------------
cseg segment
assume cs:cseg,ds:dseg
main proc far
push ds
sub ax,ax
push ax
mov ax,dseg
mov ds,ax
clear
scroll cont
postc
input:
mov ah,0
int 16h
cmp ah,4bh
jnz no_left
cmp curx,0
jnz l1
cmp cury,0
jnz l3
jmp input
l1:
dec curx
jmp l5
l3:
dec cury
mov curx,79
l5:
postc
jmp input
no_left:
cmp ah,4dh
jnz no_right
cmp curx,79
jnz r1
cmp cury,24
jnz r3
jmp input
r1:
inc curx
jmp r5
r3:
inc cury
mov curx,0
r5:
postc
jmp input
no_right:
cmp ah,48h
jnz no_up
cmp cury,0
jz up1
dec cury
postc
up1:
jmp input
no_up:
cmp ah,50h
jnz no_down
cmp cury,24
jz d1
inc cury
postc
d1:
jmp input
no_down:
cmp ah,4fh
jz sxy
cmp ah,01h
jz edd
cmp al,0dh
jnz eed
neew:
inc cury
mov ah,cury
cmp ah,rdy
jle no_change
scroll 1
dec cury
mov ah,cury
no_change:
dec lux
mov al,lux
mov curx,al
inc lux

eed: jmp disp

edd: ret
sxy: jmp setxy
disp:
mov ah,0ah
mov bh,0
mov cx,1
int 10h
inc curx
mov al,curx
cmp al,rdx
jng next
scroll 1
mov al,lux
mov curx,al

next:
postc
jmp input
setxy:
mov al,cury
mov bl,curx
cmp al,luy
jl s1
cmp bl,lux
jl s2
mov rdy,al
mov rdx,bl
jmp new
s1:
cmp bl,rdx
jle s3
jmp input
s2:
cmp al,rdy
jg s5
s3:
mov luy,al
mov lux,bl
new:
mov al,rdy
sub al,luy
inc al
mov cont ,al
clear
scroll cont
s5:
jmp input
main endp
;-----------------------------
cseg ends
end main

=====================
================================= kickout
大功告成,打个Kiss!
Floor 3 Posted 2002-10-28 00:00 ·  中国 河南 郑州 教育网
初级用户
Credits 196
Posts 35
Joined 2002-10-14 00:00
23-year member
UID 5
Gender Male
Status Offline
I skimmed through the code
It seems the first one is graphics mode, and the second one is text mode
But in the first program
scroll macro
mov h,6
that part seems to have a bit of a problem,
Should it be changed to:
scroll macro cont
mov ah,6

I’ve just been preparing for the assembly language semester exam recently, and the BIOS interrupt part is really giving me a headache
I don’t know whether kickout is familiar with this part, but the program seems to use quite a lot of it

Help me out more, hehe. If I pass this exam smoothly, I’ll treat you


http://ie.zzu.edu.cn
Email:Jathenal@mail.edu.cn
QQ:26165434 希望能和大家做个朋友
Floor 4 Posted 2002-12-14 00:00 ·  中国 江西 南昌 电信
初级用户
Credits 119
Posts 11
Joined 2002-12-14 00:00
23-year member
UID 508
Gender Male
Status Offline
I’ll try the code first
ぁ拒签ぁ!!!!!!!!!!!!!
Forum Jump: