phat code If brute force doesn't solve your problems, then you aren't using enough.
Main

Projects

Downloads

Articles

Links

Forum

 

View Message

Back to Messages
Plasma Fri Nov 16 2007 at 12:08 am
int 10h, ax=1100h
 
 
Is the easiest way, and fine for most uses. (See http://www.ctyme.com/intr/rb-0136.htm) Example from LoadCP:

' Set the new font
Regs.ax = &H1100
Regs.es = VARSEG(Font$)
Regs.bp = SADD(Font$)
Regs.cx = 256
Regs.dx = 0
Regs.bx = FontHeight * &H100
InterruptX &H10, Regs, Regs

If you're changing the font continuously this will cause flicker though. In that case you'll have to monkey a bit with some VGA regs and poke the font in at A000h. Here's some code from TextMouse that does that:

SUB Text.FontApply (StartChar, EndChar)

  '=========================================================================
  ' Updates the DOS font with the characters (StartChar to EndChar) in
  ' the currently loaded font.
  '-------------------------------------------------------------------------
  ' Parameters: StartChar  =  Starting character to update (0 to 255)
  '               EndChar  =  Ending character to update (0 to 255)
  '=========================================================================

  OUT &H3CE, 5
  OldMode = INP(&H3CF)
  OUT &H3CF, OldMode AND &HFC

  OUT &H3CE, 6
  OldMisc = INP(&H3CF)
  OUT &H3CF, (OldMisc AND &HF1) OR 4

  OUT &H3C4, 2
  OldMask = INP(&H3C5)
  OUT &H3C5, 4

  OUT &H3C4, 4
  OldMem = INP(&H3C5)
  OUT &H3C5, OldMem OR 4

  DEF SEG = &HA000
  FOR Char = StartChar TO EndChar
    FOR Row = 0 TO Text.CharRes - 1
      Byte = ASC(MID$(Text.FontBuffer$, Char * Text.CharRes + Row + 1, 1))
      POKE Char * 32 + Row, Byte
    NEXT
  NEXT

  OUT &H3CE, 5
  OUT &H3CF, OldMode

  OUT &H3CE, 6
  OUT &H3CF, OldMisc

  OUT &H3C4, 2
  OUT &H3C5, OldMask

  OUT &H3C4, 4
  OUT &H3C5, OldMem

END SUB

 
 
 
 

Reply to this Message

Name
Subject
Message

No HTML is allowed, except for <code> <b> <i> <u> in the message only.
All URLs and email addresses will automatically be converted to hyperlinks.