我想知道我的代码中是否有错误?
许多人说应该是pop cx
而不是pop ax
,但是如果我在其中放cx
,它总是会弹出一条错误消息,提示
NTVDM CPU遇到非法指令
但是,另一方面,如果我放置ax
而不是cx
,则完全没有错误发生,但是闪烁并不理想。
这是我的代码:
.model small
.stack
.code
org 100h
start:
main proc
mov cx,1; how many times to loop
here:mov al,00000001b
mov dx,378h
out dx,al
call delay
mov al,00000010b
mov dx,378h
out dx,al
call delay
mov al,00000100b
mov dx,378h
out dx,al
call delay
mov al,00001000b
mov dx,378h
out dx,al
call delay
mov al,00010000b
mov dx,378h
out dx,al
call delay
mov al,00100000b
mov dx,378h
out dx,al
call delay
mov al,01000000b
mov dx,378h
out dx,al
call delay
mov al,10000000b
mov dx,378h
out dx,al
call delay
loop here
int 20h
main endp
delay proc
push cx
mov cx,2050
delay2:
push cx
mov cx,10000
delay3:
nop
nop
nop
nop
nop
loop delay3
pop cx
loop delay2
pop ax
ret
delay endp
end start