BBS: Inland Empire Archive Date: 05-08-92 (22:18) Number: 200 From: MIKE KELLY Refer#: NONE To: SCOTT WUNSCH Recvd: NO Subj: EGA/VGA fonts Conf: (2) Quik_Bas
In a message of <May 06 08:31>, Scott Wunsch (1:140/23) writes: > Could anybody post some code to change the screen font on an >EGA/VGA? > -= Scott \\'unsch =- Try this, which is a somewhat simplified version of what I use for my Russian/English programs: ------------------- ' Load with /L command line option TYPE regtypeX ax AS INTEGER bx AS INTEGER cx AS INTEGER dx AS INTEGER bp AS INTEGER si AS INTEGER di AS INTEGER flags AS INTEGER ds AS INTEGER es AS INTEGER END TYPE DECLARE SUB InterruptX (a AS INTEGER, b AS regtypeX, c AS regtypeX) DECLARE SUB LoadFont (DisplayType$, font$) DECLARE SUB ReSetFont (DisplayType$) DisplayType$ = "VGA" font$ = "e:\fonts\medvl-16.fnt" LoadFont DisplayType$, font$ FOR x% = 8 TO 255 PRINT CHR$(x%); " "; NEXT q$ = INPUT$(1) ReSetFont DisplayType$ SUB LoadFont (DisplayType$, font$) SELECT CASE DisplayType$ CASE "EGA" CharBytes% = &HE00 CASE "VGA", "MCGA" CharBytes% = &H1100 ' BH = Number of bytes/character ' BL = Block to load in map 2 END SELECT DIM reg AS regtypeX ' Standard DIM font1% = FREEFILE ' No duplicate problems! OPEN font$ FOR BINARY AS #font1% ' Open font file for easy access total% = LOF(1) ' Total file size t$ = STRING$(total%, 0) ' Define as string for the font GET #1, , t$ ' Get the font CLOSE #font1% ' Close the file reg.ax = &H1100 ' AH = &H11 ' AL = 0 - load user font reg.cx = &HFF ' Number of chars to load (256) reg.bx = CharBytes% reg.dx = &H0 ' DX = Offset into map 2 block (0) reg.es = VARSEG(t$) ' Pointer to user table reg.bp = SADD(t$) ' Pointer to user table InterruptX &H10, reg, reg ' CALL Interrupt 10 reg.ax = &H1103 ' AH = &H11 ' AL = 3- Set block specifier reg.bx = 0 ' BL = Block to load InterruptX &H10, reg, reg ' CALL Interrupt 10 t$ = "" ' Free up some memory END SUB SUB ReSetFont (DisplayType$) SELECT CASE DisplayType$ CASE "EGA" ROMfont% = 1 ' 8x14 ROM font CASE "VGA", "MCGA" ROMfont% = 4 ' 8x16 ROM font END SELECT DIM reg AS regtypeX ' Standard DIM reg.ax = &H1100 + ROMfont% ' AH = &H11, AL = ROM font to load reg.bx = &H0 ' BL = Block to load InterruptX &H10, reg, reg ' CALL Interrupt 10 END SUB -------------- Check the "Interrupt List" for variations of loading/resetting the fonts. Note: the "standard" Cyrillic font (code page 866 [WordimPerfect calls it 899 for reasons that I've yet to discover] is all high bit, so I only load chars 128-254, and modify reg.cx & reg.dx to reflect that. Mike --- QM v1.00 * Origin: Russian House, Portland, OR, USA (1:105/23.48)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET