Board logo

标题: 一个在DOS屏幕下划出一个小屏幕的程序 [打印本页]

作者: kickout     时间: 2002-10-28 00:00    标题: 一个在DOS屏幕下划出一个小屏幕的程序
都是我以前练习时自己编得玩的。 ============== 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 ================ 事隔多年,我也忘光了,自己编译一下试试就知道了。

作者: kickout     时间: 2002-10-28 00:00
这个和上面的差不多,但可以肯定还是有不同的,编译后对比一下试试就知道了 ===================== 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 =====================

作者: 随风顺     时间: 2002-10-28 00:00
大概浏览了一下代码 好像第一个是图形模式,第二个是文本模式 不过第一段程序 scroll macro mov h,6 那块似乎有点问题, 是不是改成: scroll macro cont mov ah,6 我最近正好在准备汇编语言的学期考试,被BIOS中断那块搞得很是头疼 不知道kickout对这块熟不熟,不过看程序用到不少 多帮帮我哈,如果这回考试顺利过关的话我请客哦

[此贴子已经被作者于2002-10-28 20:05:16编辑过]


作者: 柳飘逸     时间: 2002-12-14 00:00
我试试代码先