; 编写程序实现demo.exe演示效果。
;提示:小球运动行号列号变化规律是
; 碰到上壁则行号变为自增规律
; 碰到下壁则行号变为自减规律
; 碰到左壁则列号变为自增规律
; 碰到右壁则列号变为自减规律
;当运动到的地方已经有小球存在时,将其颜色变为绿色
;思路分析:主函数中调用三个子程序
; (1)判断边界(2)显示笑脸(3)延时
;初始化:行dh=0,列dl=0,
; 行方向bh=1,列方向bl=1
assume cs:code
code segment
start: mov dx,0
mov bh,1
mov bl,1
mov cx,50*80 ;显示出50*80个笑脸后结束
mains: call judge
call show_str
call delay
loop mains
mov ax,4c00h
int 21h
;名称:judge
;功能:判断边界
;参数:(dh)=行,(dl)=列
judge:
judgeh:cmp dh,24
je seth24
cmp dh,0
je seth0
jmp short ok0
seth24: mov bh,-1<