BBS: Inland Empire Archive Date: 07-03-92 (22:39) Number: 2016 From: MIKE KELLY Refer#: NONE To: BRUCE GROEN Recvd: NO Subj: Vga Fonts Conf: (2) Quik_Bas
In a message of <Jul 02 16:35>, Bruce Groen (1:300/21) writes:
Bruce,
If you want to keep up, you must read _every_ message in
this echo (apologies to all others for repeating this
code:)
>Could someone post some code showing how to change the VGA font
>from QB? I am assuming you would do it with interrupts but I am
>not sure. And how do you create a font? Does the font have to be
>a separate file or can it be within your program? As you can see I
>am new to this type of thing. I just got a VGA monitor and want
>to be able to take advantage of it when I program. Thanks for any
>help you can give.
' 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 (i AS INTEGER, a AS regtypeX, b AS regtypeX)
DECLARE SUB LoadFont (DisplayType$)
DECLARE SUB ReSetFont (DisplayType$)
DisplayType$ = "VGA" ' or "EGA" or "MCGA"
LoadFont DisplayType$
CLS
PRINT " Cyrillic High-bit Character Set (code page 863)"
PRINT
FOR x% = 128 TO 255
PRINT x%; CHR$(x%); " ";
IF (x% + 1) MOD 8 = 0 THEN PRINT
NEXT
q$ = INPUT$(1)
ReSetFont DisplayType$
SUB LoadFont (DisplayType$)
SELECT CASE DisplayType$
CASE "EGA"
CharBytes% = &HE00
font$ = "cyrillic.ega"
CASE "VGA", "MCGA"
CharBytes% = &H1000 ' BH = Number of bytes/character
' BL = Block to load in map 2
font$ = "cyrillic.vga"
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%, 32) ' 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 = &H80 ' 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
' PDS uses ?VARPTR?
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
You can do this as data within your program, but an
external file is 10 to 1000 (or more [slight exaggeration,
perhaps, eh, no flames, ok?]) times faster depending on
your CPU/HD.
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