• Please review our updated Terms and Rules here

MCGA Load fonts

Mills32

Experienced Member
Joined
Sep 25, 2018
Messages
149
Location
Spain
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"

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:
I dont know about MCGA but I run fonts in VGA all the time.

AX = 1100h
ES:BP -> user table
CX = count of patterns to store
DX = character offset into map 2 block
BL = block to load in map 2
BH = number of bytes per character pattern


;; es:bp -> text mode font
mov ax,0x1100
mov bx,0x1000
mov cx,0x80
xor dx,dx
xor bp,bp
int 0x10
 
I dont know about MCGA but I run fonts in VGA all the time.

AX = 1100h
ES:BP -> user table
CX = count of patterns to store
DX = character offset into map 2 block
BL = block to load in map 2
BH = number of bytes per character pattern


;; es:bp -> text mode font
mov ax,0x1100
mov bx,0x1000
mov cx,0x80
xor dx,dx
xor bp,bp
int 0x10

Thanks, but VGA works completely different, I think.
 
I just wrote a test, and your correct, changing svga_s3 to mcga ... my 5 line test asm did nothing. thats not what I expected either. could probably log it as a bug on the DBX github.
 
I can only use dosbox x

If dosbox-x's support isn't up to snuff, then you need a real MCGA system to test. Otherwise, you aren't testing your code; you're testing the emulator.

They did a lot of work on MCGA in 2019 but I don't know if they got to font support yet. You could always reach out on twitter to the primary maintainer to see if someone is working on it.
 
If dosbox-x's support isn't up to snuff, then you need a real MCGA system to test. Otherwise, you aren't testing your code; you're testing the emulator.

They did a lot of work on MCGA in 2019 but I don't know if they got to font support yet. You could always reach out on twitter to the primary maintainer to see if someone is working on it.
Thanks! I wish I had my old pc, an IBM PS/2 with MCGA 😞.
 
Back
Top