BBS: Inland Empire Archive Date: 06-05-92 (22:36) Number: 166 From: ROBERT CHURCH Refer#: NONE To: MIKE KELLY Recvd: NO Subj: 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:
<Code delete for abbreviational purposes <G>>
Some time ago, you posted some code for using fonts in EGA/VGA. What
is the format that the font files take? Is is the same one as used by
common font editors? Thanks for the code and for the help.
-Rob
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
--- PPoint 1.30
* Origin: I'd rather be like Clyde! (1:105/319.27)

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