I got a little bored trying to figure out why my OS couldn't load a program and decided to implement a custom font. This was much simpler than I thought, except for one thing. The VGA dot clock is at 9, giving me this:
when I want it to be at 8, giving me this:
Is there a way to do this without fiddling with the hardware? I'm perfectly willing to do a mode change if I need to, since right now I'm just tweaking the default boot video mode. I just couldn't figure out which mode I'd need to switch to to get what I want due to some of the modes having several results based on different things.
Text-mode dot clock problems
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Text-mode dot clock problems
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
Re: Text-mode dot clock problems
Mode 10h should use an 8x14 font... (640x350).
I personally like this mode as you get two full pages in vid-mem for flipping or doing other stuff during boot.
I take it you're using 640x480 (12h)?
I personally like this mode as you get two full pages in vid-mem for flipping or doing other stuff during boot.
I take it you're using 640x480 (12h)?
- 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: Text-mode dot clock problems
The 9-dot font was introduced since it improved separation and readability of characters. However, there are some characters that do not like to be separated, like the box drawing characters. To cope, IBM added a feature that duplicates the 8th row into the 9th for that range of extended characters. (iirc, it was the 0xC0-0xDF range). There's a bit that enables or disables this feature, but it should be on by default due to its default use.
The other method is by indeed setting a 8-dot mode. You need one bit to make that happen, and three to do it correctly:
- disable screen
- change to 8 pixel characters
- choose the 25MHz pixel clock (the previous step modifies the resolution, which needs the corresponding dot clock if you don't want to fry fixed-frequency monitors)
- enable screen
You can get all the necessary register information from The wiki and FreeVGA
And of course you can set a graphics mode as johnsa suggested, but that usually means that you write all bits of a character manually, rather than having the VGA controller duke that out for you.
The other method is by indeed setting a 8-dot mode. You need one bit to make that happen, and three to do it correctly:
- disable screen
- change to 8 pixel characters
- choose the 25MHz pixel clock (the previous step modifies the resolution, which needs the corresponding dot clock if you don't want to fry fixed-frequency monitors)
- enable screen
You can get all the necessary register information from The wiki and FreeVGA
And of course you can set a graphics mode as johnsa suggested, but that usually means that you write all bits of a character manually, rather than having the VGA controller duke that out for you.
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: Text-mode dot clock problems
I would prefer having the BIOS do all of the hardware fiddling for me, so I'll try changing the video mode. However, I don't think I'm going to use a graphics mode, since I don't really want to do draw the fonts myself when I could have the hardware do the exact same thing for me. Any suggestions for a mode or am I going to have to decipher the various tables I find myself?
Edit: After a quick glance and trying a couple of things in Bochs, it looks like I'm going to have to mess with the hardware myself. Oh well.
Edit: After a quick glance and trying a couple of things in Bochs, it looks like I'm going to have to mess with the hardware myself. Oh well.
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Text-mode dot clock problems
Oh, and IMHO, the 'w' in your font looks waaaayy out of place.
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: Text-mode dot clock problems
Yeah, I know. I was going to add a "BTW this font is temporary until I can get this to work" but I forgot.
Right now I'm struggling with poor documentation on how to disable the screen while I change the clock rates. I've read 3 or 4 different code dumps for changing the video mode but they just dump a series of uncommented numbers to the various ports with no explanation, and each of the code dumps started by doing something different. I'll search some more but if someone could save me a bunch of time and just tell me what I need that would be very nice.
Edit: NVM I think I found it. Just out 0x00 to port 0x03C4, then to port 0x03C5, right? Then to re-enable just do the same thing with 0x03 to the second port instead?
Edit: I got it working! Here's the final code (unoptimized!):
Right now I'm struggling with poor documentation on how to disable the screen while I change the clock rates. I've read 3 or 4 different code dumps for changing the video mode but they just dump a series of uncommented numbers to the various ports with no explanation, and each of the code dumps started by doing something different. I'll search some more but if someone could save me a bunch of time and just tell me what I need that would be very nice.
Edit: NVM I think I found it. Just out 0x00 to port 0x03C4, then to port 0x03C5, right? Then to re-enable just do the same thing with 0x03 to the second port instead?
Edit: I got it working! Here's the final code (unoptimized!):
Code: Select all
;; use Reset register
mov al, 0x00
mov dx, 0x03C4
out dx, al
;; Complete disable
mov al, 0x00
mov dx, 0x03C5
out dx, al
;; use dot clock register
mov al, 0x01
mov dx, 0x03C4
out dx, al
;; use 8-dot clock
mov al, 0x01
mov dx, 0x03C5
out dx, al
;; use 640x??? instead of 720x???
mov al, 0xE3
mov dx, 0x03C2
out dx, al
;; use reset register
mov al, 0x00
mov dx, 0x03C4
out dx, al
;; complete enable
mov al, 0x03
mov dx, 0x03C5
out dx, al
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?