I'm writing this code in DOSBox-0.74-3, making use of MS-DOS Debug and once I run it makes the prompt disappear and it does not do anything else.
mov cx,16
db 0d,0a,"placeholder",0d,0a,24
mov ah,09
mov dx,(Memory address of db)
int 21
loop (Memory address of mov ah,09)
mov ah,4c
int 21
What it should do is show the message 'Placeholder' 22 times, but it is not doing it. I have been able to run other simple codes as this one.
If you're starting to run your code at the first line above, it's probably not going to do what you expect when it starts executing the data created by the
dbstatement.By all means manipulate data with your code but it's a rather bad idea to attempt to execute it as if it were code :-)
So the first thing I would do is get that data out of the code area, with something like (added labels to make the code more readable, use of
debugmeans you'll probably have to pre-calculate memory locations unless you want to enter some instructions more than once):There may still be issues with that code (such as returning a non-zero code in
al) but you at least won't be attempting to execute data as code.