Reputation: 37
This code does not output anything.
How can I output the character 'A' on left corner of a new screen?
assume cs: code, ds: code
code segment
org 100h
start:
mov ax, 0B800h
mov es, ax
mov byte ptr es:[0], 'A'
int 20h ; exit program
code ends
end start
I would like there to the letter 'A' on the left corner of an otherwise blank screen.
Upvotes: 1
Views: 474
Reputation: 37232
This code does not output anything.
Possibilities include:
the video mode is not using display memory at 0xB800:0x0000 (e.g. a graphics video mode).
the code did write 'A' but the attribute makes it invisible (e.g. black foreground with black background).
the code did write 'A' and the attribute makes it visible; but it's overwritten or scrolled off the top of the screen as soon as the program exists (before you have a chance to see it)
To guard against all these potential problems:
set the video mode to make sure it's using text mode
do mov ax,(0xF0 << 8) | 'A'
and mov [es:0],ax
to set the attribute while also writing the character. Note: This can be optimized to a single mov word [es:0],(0xF0 << 8) | 'A'
instruction.
have some kind of delay before you exit (wait for time to pass, wait for user to press a key, ...).
Upvotes: 2