我想在同一行输出两个字符串,由于第一个字符串最多20个字节,所以第二个字符串就在这一行的第20个位置开始输出,可是输出结果不正确,这是我的代码
- Assembly code
;------------------------------- ;输出单个数据 ;输入:si存放要输出的数据的地址 ;输出:向屏幕输出数据的信息并输出一个换行 info_output proc near push ax push bx push cx push dx mov dx , si mov ah , 9 int 21h mov ah , 3 int 10h mov cl , name_length_max sub cl , dl mov ch , 0 output_space: mov dl , ' ' mov ah , 2 int 21h loop output_space mov dx , si add dx , name_size mov ah , 9 int 21h call newline pop dx pop cx pop bx pop ax ret info_output endp ;-------------------------------
对字符串
- Assembly code
test_1 db 'hehehe$',14 dup(?),'23873824$'
进行了测试,在debug下可以正确输出hehehe 23873824,然而直接运行却只能看见23873824,请问为什么?
------解决方案--------------------
debug 下正常,直接运行却出错,应该是有通用寄存器没有适当地初始化。debug 在载入程序后,将除 bx/cx 外的通用寄存器全清 0 了,bx/cx 存放的是载入文件的有效尺寸;但 dos 运行程序时没有这样做,所以可能会引发怪象。
------解决方案--------------------
把完整的代码放出来看看?
------解决方案--------------------
只能打出 23873824$ ?
你传递的是test_1的地址吗?