我在汇编中编写了一个简单的程序,并尝试使用TASM(Turbo)和TLINK运行它。运行可执行文件后,我收到此错误:
TITLE 1st Program
.286
.model small
.data
val1 db 0
.code
main PROC
mov bl, 2Bh
mov val1, bl
mov bl, 2Ah ;I suspect this is the line that causes the problem
mov ah, 02 ;calls interrupt to display val1
mov dl, val1
int 21h
mov ah, 04Ch ;calls interrupt to terminat program
mov al, 00
int 21h
main ENDP
end main
如果我删除只移动2ah到BL的线,它的效果非常好。我尝试更改添加到BL的值,但我仍然收到错误消息。我只是想了解导致错误的原因。
谢谢!
稍后编辑:我设法通过添加.stack 100h来解决错误。谁能解释究竟发生了什么?
答案 0 :(得分:2)
很可能没有为应用程序的堆栈保留内存,或者它的数量太少,int 21h
或硬件中断处理程序导致堆栈溢出和数据/代码损坏导致数据执行或代码损坏。
mov bl, 2Ah
本身无法解决问题。