📄 aa.asm
字号:
data segment
car db 7
db 52h,70h,0,0
db 0b1h,70h,0,1
db 0dbh,7,0,1
db 0dbh,7,0,1
db 4fh,7,1,0
db 4fh,7,0,-3
db 2,7,-2,1
char_cnt dw ?
pointer dw ?
line_on db ?
col_on db ?
data ends
code segment
assume cs:code,ds:data
main proc far
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
mov dh,10
mov cx,5
xun:call clear_screen
lea di,car
mov dl,10
call move_shape
call clear_screen
inc dh
loop xun
ret
main endp
clear_screen proc near
push ax
push bx
push cx
push dx
mov ah,6
mov al,0
mov bh,7
mov ch,0
mov cl,0
mov dh,24
mov dl,79
int 10h
pop dx
pop cx
pop bx
pop ax
ret
clear_screen endp
move_shape proc near
push ax
push bx
push cx
mov ah,0fh
int 10h
sub ch,ch
mov cl,[di]
inc di
mov char_cnt,cx
mov pointer,di
mov line_on,dh
mov col_on,dl
plot_next:
add dh,[di+2]
add dh,[di+3]
cmp dl,79
jb mov_crsr
sub ch,ch
mov cl,[di]
inc di
fan:sub dh,[di+2]
sub dl,[di+3]
cmp dl,10
ja remov_crsr
call erase
pop cx
pop bx
pop ax
ret
mov_crsr:
mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov cx,1
mov ah,09
int 10h
pop cx
add di,4
loop plot_next
call dly_qrtr
call erase
jmp short plot_next
remov_crsr:
mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov cx,1
mov ah,09
int 10h
pop cx
add di,4
loop fan
call dly_qrtr
call erase
jmp short fan
move_shape endp
erase proc near
mov cx,char_cnt
mov di,pointer
mov dh,line_on
mov dl,col_on
erase_next:
add dh,[di+2]
add dl,[di+3]
mov ah,2
int 10h
mov al,[di]
mov bl,0
push cx
mov cx,1
mov ah,9
int 10h
pop cx
add di,4
loop erase_next
mov cx,char_cnt
mov di,pointer
mov dh,line_on
inc col_on
mov dl,col_on
ret
erase endp
dly_qrtr proc near
push cx
push dx
mov dx,50000
d11:mov cx,5000
d12:loop d12
dec dx
jnz d11
pop dx
pop cx
ret
dly_qrtr endp
code ends
end main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -