Strange output with Irvine's WriteString

狂风中的少年 提交于 2019-12-01 20:28:35

Irvine's WriteString needs a "null-terminated string". Some can download the help as CHM-file here (IrvineLibHelp.exe).

It's a little bit sloppy to say "EDX = points to string". EDX just points to an memory address identifiable by a label (here: "character"). WriteString will get byte for byte from that location and write it as character or control directive regardless of his real type or intention until it comes across a byte with the value 0. MASM has no directive to define a string with the last 0, so it has to be added manually:

character BYTE "c", 0

An alternative way to print a character is to use WriteChar:

...
; print the character
mov al, character
call WriteChar
loop L2

mov ecx, count                          ; reset our outside loop
loop L1
...
character BYTE "c"

Should be:

character BYTE "c",0dh,0ah,0

What does WriteString do? If the function prints a string may be you need to end "character BYTE "c" " with $ (if it is DOS program. 09 function Int21h)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!