模拟 sleep 问题
大佬帮忙看看,运行的时候老是中途卡死,不知怎么回事!代码如下:
assume cs:code
stack segment
db 128 dup(0)
stack ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,128
call show_ch
mov ax,4c00H
int 21H
;==========================================
show_ch:push ax
push es
push di
mov ax,0b800H
mov es,ax
mov di,160*12+40*2
mov al,'a'
print: mov es:,al
inc al
call delay
cmp al,'z'
jna print
pop di
pop es
pop ax
ret
;==========================================
delay: push ax
mov al,0
out 70H,al
in al,71H
mov ah,al
inc ah
mov al,0
delay_s:push ax
out 70H,al
in al,71H
cmp al,ah
pop ax
jnedelay_s
pop ax
ret
;==========================================
code ends
end start 你为什么不调试程序?
延时部分有问题,已经修复
assume cs:code
stack segment
db 128 dup(0)
stack ends
code segment
start:
mov ax, stack
mov ss, ax
mov sp, 128
call show_ch
mov ax, 4c00H
int 21H
;==========================================
show_ch:
push ax
push es
push di
mov ax, 0b800H
mov es, ax
mov di, 160*12+40*2
mov al, 'a'
print:
mov es:,al
inc al
call delay
cmp al, 'z'
jna print
pop di
pop es
pop ax
ret
;==========================================
delay:
push ax
mov al, 0
out 70H, al
in al, 71H
mov ah, al
delay_s:
mov al, 0
out 70H, al
in al, 71H
cmp ah, al
jedelay_s
pop ax
ret
code ends
end start
页:
[1]