I am trying to save my string to a file in assembly but it gives me this weird output with "ver 2.40 (all kinds of special characters)"
This is what I do:
mov ah,09
mov dx,200
int 21
int 20
e 200 "Test$"
n test.com
r cx
:0009
w
q
It saves it succesfully and it also runs fine when I don't exit the program and use "g" but when I "q" and try to run test.com it gives me the output I mentioned.
I presume you're using DEBUG.EXE.
After e 200 "Test$"
do a d 200
. You see the memory dump beginning at offset 200. This looks like:
16C7:0200 54 65 73 74 24 00 00 00-00 00 00 00 00 00 00 00 Test$...........
16C7:0210 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
16C7:0220 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
16C7:0230 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
16C7:0240 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
16C7:0250 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
16C7:0260 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
16C7:0270 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
Now count the offset up until you reach the 24
: 200, 201, 202, 203, 204 - You want to store the memory from offset 100h until 204h, this are 105h bytes (204h-100h+1).
This value is to be stored in CX
:
r cx
:0105
With w
you write CX
bytes.