我非常喜欢新秀。我确信这是非常基本的,但我已经多次这样做了。我试图让我的程序在两个不同的行上显示一个字符串。这是一个.com程序,我正在使用A86编译器。这是硬件,我不是想欺骗或类似的东西,因为我真的想知道我做错了什么。
jmp start ; This will start the program
;============================
msg db "Hello Word.$" ; A string variable
msg db "Michael J. Crawley$" ; A string variable with a value.
;============================
start:
mov ah,09 ; subfunction 9 output a string
mov dx,offset msg ; DX for the string
int 21h ; Output the message
int 21h ; Output the message
exit:
mov ah,4ch
mov al,00 ; Exit code
int 21h ; End program
答案 0 :(得分:3)
以下是您的具体问题:
msg
两次(a86会对此进行barf)。这些要点的解决方案(不提供实际代码)。
msg2
。msg2
加载到dx中。更新:由于其他一些有用的灵魂已经提供了源代码,这是我的解决方案。我建议你从这里学习并修改你自己的代码来做类似的事情。如果你从一个公共网站逐字复制它以进行课堂作业,你几乎肯定会因为抄袭而被抓住:
jmp start ; This will start the program
msg db "Hello Word.",0a,"$" ; A string variable .
msg2 db "Michael J. Crawley$" ; A string variable with a value.
start: mov ah,09 ; subfunction 9 output a string
mov dx,offset msg ; DX for the string
int 21h ; Output the message
mov dx,offset msg2 ; DX for the string
int 21h ; Output the message
exit:
mov ah,4ch
mov al,00 ; Exit code
int 21h ; End program
输出:
Hello Word.
Michael J. Crawley
答案 1 :(得分:1)
msg的两个定义?
答案 2 :(得分:0)
我不熟悉a86,但使用NASM& MASM在com程序开头需要一个“org 100h”汇编程序指令。现在的方式,偏移量msg是0x2,并且将尝试从程序段前缀的第二个字节打印(一个16位字,用于保存可用内存顶部的段)。