Hi, I read about how MCGA can load fonts for the text mode, but I did not find any clear example of how to do it.
This Howard the Font is supposed to do it, but I just don't understand what it's doing.
Here they point to a book which tells how to do it: "Richard Wilton's book covers MCGA very well, but usually defers to the BIOS calls whenever possible, which was completely understandable (and desirable) back then. Chapter 10 has info on changing fonts..."
So I read the book I this is what I think I know:
- First Load font data to a reserved VRAM range, from A000:0000 to A000:6000
- There are 4 character tables in that range, each table has 16 lists (512 bytes each) of character codes and bit patterns.
- Every list has this structure: Char_code (1 byte), bit_pattern (1 byte), char_code, bit_pattern...
- There are 16 lists because each of them only stores one scanline of the characters.
So you paste a font using that format to VRAM, but MCGA won't display your custom font yet, because you have to "upload" the font to... I don't know were, some kind special ram or something. The book only tells you to use this function to select "font pages"
I also read a vogons thread about MCGA, they say there is a DMA function which transfers font from vram to a special ram chip, so that MCGA displays the custom font, but no sample code was provided.
The sample code from Howard the Font seems to be some kind of TSR that needs to constantly copy the font, if MCGA needs to update the font every frame, I won't use a custom font at all, it has no sense to me, it would be slow, I think... Even if it is using DMA you have to use a TSR, and I don't want to use that.
I just don't know how to test this, because I could not compile the howard source, and the function from Richard Wilton's book might work, but I can only use dosbox x, the only emulator with MCGA support, and nothing happened when I tried my sample.
This Howard the Font is supposed to do it, but I just don't understand what it's doing.
Here they point to a book which tells how to do it: "Richard Wilton's book covers MCGA very well, but usually defers to the BIOS calls whenever possible, which was completely understandable (and desirable) back then. Chapter 10 has info on changing fonts..."
So I read the book I this is what I think I know:
- First Load font data to a reserved VRAM range, from A000:0000 to A000:6000
- There are 4 character tables in that range, each table has 16 lists (512 bytes each) of character codes and bit patterns.
- Every list has this structure: Char_code (1 byte), bit_pattern (1 byte), char_code, bit_pattern...
- There are 16 lists because each of them only stores one scanline of the characters.
So you paste a font using that format to VRAM, but MCGA won't display your custom font yet, because you have to "upload" the font to... I don't know were, some kind special ram or something. The book only tells you to use this function to select "font pages"
Code:
//n0,n1 = font page values
//Update MCGA Font Pages
mov ax,1103h //AH := INT 10H function number
//AL := 3 (Set Block Specifier)
mov bl,n1 //n1 BL := value for bits 2-3
shl bl,1
shl bl,1 //BL bits 2-3 := n1
or bl,n0 //n0 BL bits 0-1 := n0
int 10h //load font pages
I also read a vogons thread about MCGA, they say there is a DMA function which transfers font from vram to a special ram chip, so that MCGA displays the custom font, but no sample code was provided.
The sample code from Howard the Font seems to be some kind of TSR that needs to constantly copy the font, if MCGA needs to update the font every frame, I won't use a custom font at all, it has no sense to me, it would be slow, I think... Even if it is using DMA you have to use a TSR, and I don't want to use that.
I just don't know how to test this, because I could not compile the howard source, and the function from Richard Wilton's book might work, but I can only use dosbox x, the only emulator with MCGA support, and nothing happened when I tried my sample.
Last edited: