JonAmen
JonAmen

Reputation: 183

Garbage in the output of a print to screen statement

Like the title says, my print procedure is outputting garbage for some reason. Here's the proc definition:

print proc near
 mov ah, 09h
 int 21h
 ret
print endp

And here's where it gets called in my code:

emptyTail:
 mov dl, offset standardError
 call print
 jmp quit 

Here's standardError:

standardError db "Sorry we ran into an error. Try again", 13,10, "$"

The other parts of the code work fine but once this particular branch is called, it spits out a bunch of weird characters. Any idea why?

Upvotes: 1

Views: 298

Answers (1)

mcleod_ideafix
mcleod_ideafix

Reputation: 11418

You need to put DX with the offset of your string. DS is probably pointing already to your segment data, isn't it? Is it a COM or a EXE file what you're making? If it's a COM, DS is already set.

emptyTail:
 mov dx, offset standardError   ;DX, not DL or DH.
 call print
 jmp quit 

Upvotes: 1

Related Questions