Printing strings in graphics mode (320x200)
Re: Printing strings in graphics mode (320x200)
Yes, the cursor position is remembered by the BIOS and used.
Ok, from what I can tell, if BL is 0 when setting the font, DL specifies the number of rows directly, and you should set it to 14, instead of 1 as I thought. (If BL is 1, DL is set to 1 for 14 rows, 2 for 25 rows or 3 for 43 rows)
And as I've said numerous times, remember to set ES in printString.
Ok, from what I can tell, if BL is 0 when setting the font, DL specifies the number of rows directly, and you should set it to 14, instead of 1 as I thought. (If BL is 1, DL is set to 1 for 14 rows, 2 for 25 rows or 3 for 43 rows)
And as I've said numerous times, remember to set ES in printString.
-
- Member
- Posts: 78
- Joined: Sat Apr 10, 2010 7:00 am
- Location: Denmark
Re: Printing strings in graphics mode (320x200)
I think I got it working now. I would like to use an 8x8 font, but it appears much larger than so, when running it?..Gigasoft wrote:Yes, the cursor position is remembered by the BIOS and used.
Ok, from what I can tell, if BL is 0 when setting the font, DL specifies the number of rows directly, and you should set it to 14, instead of 1 as I thought. (If BL is 1, DL is set to 1 for 14 rows, 2 for 25 rows or 3 for 43 rows)
And as I've said numerous times, remember to set ES in printString.
'getFont' & 'printString':
Code: Select all
getFont:
mov ax, 0x1130
xor bh, bh
int 0x0010
mov ax, 0x1120
int 0x0010
ret
printString:
mov dx, cs
mov es, dx
mov ah, 0x000f
int 0x0010
mov ah, 0x0003
int 0x0010
mov cx, 44
mov bl, 0x0007
mov ax, 0x1301
int 0x0010
ret
-Well, this is how the text looks:
Re: Printing strings in graphics mode (320x200)
Yes, that's the default 8x8 font. The getFont function is once again meaningless, since it just sets the font for CGA mode to what it already is (and you aren't even in CGA mode). You don't have to do anything to use the standard 8x8 font.
-
- Member
- Posts: 78
- Joined: Sat Apr 10, 2010 7:00 am
- Location: Denmark
Re: Printing strings in graphics mode (320x200)
Isn't there anything I do (besides making my own) that'll allow me to use smaller fonts?Gigasoft wrote:Yes, that's the default 8x8 font. The getFont function is once again meaningless, since it just sets the font for CGA mode to what it already is (and you aren't even in CGA mode). You don't have to do anything to use the standard 8x8 font.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Printing strings in graphics mode (320x200)
Getting a legible font is difficult, especially if it becomes smaller. The problem with mode 13 is that a font doubles in screen size compared to text mode, use mode 12 if you want 80x30 or 80x60 characters on screen. This makes plotting pixels nastier though.
-
- Member
- Posts: 78
- Joined: Sat Apr 10, 2010 7:00 am
- Location: Denmark
Re: Printing strings in graphics mode (320x200)
Yeah.. mode 12h is 640x480 right?.. I already tried to do a simple 'drawVertLine' function in that mode.. what a pain.. I couldn't get it drawing the line the right length.. oh and by the way, I got kind of an off-topic question: Where can I download mkisofs on my Mac. I'm really getting tired of doing my OS development on a boot camped 32-bit Windows 7, when I'm running 64-bit Mac hardware!Combuster wrote:Getting a legible font is difficult, especially if it becomes smaller. The problem with mode 13 is that a font doubles in screen size compared to text mode, use mode 12 if you want 80x30 or 80x60 characters on screen. This makes plotting pixels nastier though.
Re: Printing strings in graphics mode (320x200)
I don't see how drawing a vertical line in mode 12h poses a problem. Drawing a horizontal line is a bit more complicated, but shouldn't be too hard either.
-
- Member
- Posts: 78
- Joined: Sat Apr 10, 2010 7:00 am
- Location: Denmark
Re: Printing strings in graphics mode (320x200)
How is a horizontal line more complicated?.. I mean, it's just finding the correct starting point, subtracting the ending X location from the starting X location, and then add one to the video-memory pointer, endX - startX times?Gigasoft wrote:I don't see how drawing a vertical line in mode 12h poses a problem. Drawing a horizontal line is a bit more complicated, but shouldn't be too hard either.
Re: Printing strings in graphics mode (320x200)
No. If you had done some reading you wouldn't even be asking these questions.
Remember, in mode 12h, each addressable byte refers to 8 pixels.
Remember, in mode 12h, each addressable byte refers to 8 pixels.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Printing strings in graphics mode (320x200)
We're three pages further, and I've yet to see an attempt by you to solve your own problems. You copy the code we posted here, or blatantly ignore it, post without describing what you actually tried, and a throughout lack of doing research (as Gigasoft pointed out above), and debugging (which I told you to do a page back)
My question to you: if you fail at doing something people have been doing for the past 15 years (like plotting pixels in EGA/VGA modes), with the resulting documentation and examples, how would you even begin to tackle the next problem that isn't as commonplace? As a hint, asking us to give you the correct code is the wrong answer.
My question to you: if you fail at doing something people have been doing for the past 15 years (like plotting pixels in EGA/VGA modes), with the resulting documentation and examples, how would you even begin to tackle the next problem that isn't as commonplace? As a hint, asking us to give you the correct code is the wrong answer.