【发布时间】:2016-10-25 17:27:40
【问题描述】:
当我运行程序时,出现第 16 行错误,显示错误 A2070,第 16 行是 mov ax, message[si]。是因为我要从一个寄存器转移到一个寄存器吗?另外我该如何解决这个问题?
该程序是一个简单的push和pop字符串,将每个字符存储在堆栈中,递增堆栈消息,然后弹出堆栈以向后显示字符串。
;
.model small
.data
message db "Hello, DOS Here!",0 ; the string
nameSize = ($ - message) - 1 ;gives length of the string
.code
main proc
mov ax,@data
mov ds,ax
mov cx, nameSize ;size of the string stored in cx
mov si, 0 ;stack index 0
Li:
mov ax, message[si] ;
push ax ;push ax
inc si ;incremting stack index
loop Li ; looping through message character
mov cx, nameSize ;Popping
mov si, 0 ; popping from stack
L2:
pop ax ;pop of the ax
mov message[si], al ;
inc si
loop L2
mov dx, offset message ; displaying of string
mov ah,9
int 21
mov ax,4c00h
int 21h
main endp
end main
【问题讨论】: