SMLFNT.BAS (Was: Re: Text

 BBS: Inland Empire Archive
Date: 07-06-92 (08:03)             Number: 174
From: MIKE KELLY                   Refer#: NONE
  To: RICK PEDLEY                   Recvd: NO  
Subj: SMLFNT.BAS (Was: Re: Text      Conf: (2) Quik_Bas
Rick:
   The code is a quick and dirty demo.  The next message
creates the font used here.

----------------SMLFNT.BAS
' Public Domain by Michael J. Kelly, 7/6/92
' 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 ()

CONST MonitorType$ = "VGA"    ' substitute your favorite function
                              ' to determine monitor type
CLS

SELECT CASE MonitorType$
  CASE "VGA", "MCGA"
    Lines% = 50
  CASE "EGA"
    Lines% = 43
  CASE ELSE
    SYSTEM
END SELECT

DEF SEG = 0
POKE &H484, Lines% - 1       ' Reset video adapter for # lines
POKE &H485, 8                '    8 bytes/char (low bit)
POKE &H486, 0                '    make sure high bit is clear
DEF SEG

Loadfont                     ' Load the 8x8 font
                             ' Display something
OPEN "smlfnt.bas" FOR INPUT AS #1
FOR x% = 1 TO 49
  LINE INPUT #1, t$
  PRINT t$
NEXT
CLOSE
q$ = INPUT$(1)

SUB Loadfont
  DIM reg AS regtypeX              ' Standard DIM
  Font1% = FREEFILE
  OPEN "SMLFONT.FNT" FOR BINARY AS #Font1%
  t$ = STRING$(LOF(Font1%), 0)     ' Define as string for the font
  GET #Font1%, , t$                ' Read the font
  CLOSE #Font1%
  reg.ax = &H1100                  ' AH = &H11
                                   ' AL = 0 - load user font
  reg.cx = &HFF                    ' Number of chars to load (256)
  reg.bx = &H800                   ' BH = bytes/char, BL = block to load
  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

------------

Mike





--- QM v1.00
 * Origin: Russian House, Portland, OR, USA (1:105/23.48)
Outer Court
Echo Basic Postings

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