Reputation: 23
I'm trying to print a character while on graphical mode. Usually when I print a character I'm doing:
mov ah,14 ; ah=14
mov al,'x'
int 10h ; print the character
This time it doesn't work. I guess that the problem is that I switch to graphical mode:
push ax
mov ah, 0
mov al, 13h
int 10h
pop ax
ret
So how can i still use graphical mode (i need it) and print a char? I'm using nasm compiler, bochs debugger, and 8086 platform.
Thanks alot!
Upvotes: 2
Views: 2884
Reputation: 44046
Always have Ralf Brown Interrupt List handy.
The service int 10h/AH=0Eh
requires the page number in BH
and the color to use in BL
.
This snippet works
mov ah, 0eh ;0eh = 14
mov al, 'x'
xor bx, bx ;Page number zero
mov bl, 0ch ;Color is red
int 10h
In text mode the BL
is not used, however in graphical mode it is.
Not properly setting it may end up writing "black on black".
Upvotes: 8
Reputation: 16596
You have to draw it (at least if you want to polish the look of it).
IIRC the BIOS or DOS interrupt actually was capable to print characters in gfx mode, but the font was ugly, and it did destroy other content around, so when I did need to print text in 13h mode, I had to do it on my own.
If you are new to this, start like this:
*1) For the first step you can use some debug gfx like this (with default DOS palette):
testSprite: ; testing gfx glyph, size 6x8 pixels for 13h mode
times 6 db 15 ; white line at top
times 6*6 db 2 ; dark green middle
times 6 db 13 ; violet line at bottom
In second step you have to copy values from source address to 0xA000:320*posy+posx memory area, correctly advancing pointers: source++ after each byte copied, destination++ at single line (for width bytes), then destination+=320-width to advance to next line for height lines.
Upvotes: 0