home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / bmag / multfont.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-13  |  2.4 KB  |  94 lines

  1. '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
  2. '  Msg#: 299                                          Date: 10 Apr 94  19:52:21
  3. '  From: Coridon Henshaw                              Read: Yes    Replied: No 
  4. '    To: All                                          Mark:                     
  5. '  Subj: Multiple fonts on screen at once
  6. '──────────────────────────────────────────────────────────────────────────────
  7. 'Here's a little something I cooked up to display two fonts on the screen at
  8. 'once:
  9. '
  10. 'Note: EGA or better required.
  11. '
  12. DECLARE SUB LoadFont (Font$, Num%)
  13. DEFINT A-Z
  14.  
  15. '$INCLUDE: 'qbx.bi'  'QB users use QB.BI.  Remember to load with /L.
  16.  
  17. DIM Regs AS RegTypeX
  18.  
  19. CLS
  20.  
  21. Buffer1$ = SPACE$(4096)
  22. Buffer2$ = SPACE$(4096)
  23.  
  24. OPEN "\text\fonts\medieval.fnt" FOR BINARY AS #1 'Standard format text fonts
  25. GET #1, , Buffer1$
  26. CLOSE
  27.  
  28. OPEN "\text\fonts\itt.fnt" FOR BINARY AS #1
  29. GET #1, , Buffer2$
  30. CLOSE
  31.  
  32. LoadFont Buffer1$, 0
  33. LoadFont Buffer2$, 1
  34.  
  35. FontCode = 4
  36. 'Binary format of the font code:
  37. '
  38. '  /Attribute 0-7 font highbit (VGA Only)
  39. '  |/Attribute 8-15 font highbit (VGA Only)
  40. '  ||/Attribute 0-7 font (EGA/VGA)
  41. '  ||| /Attribute 8-15 font (EGA/VGA)
  42. '  ||| |
  43. '00000000
  44. '76543210
  45. '
  46. 'Font block number  Binary value (First bit in highbit)
  47. '
  48. ' EGA/VGA:
  49. ' 0                 000
  50. ' 1                 001
  51. ' 2                 010
  52. ' VGA:
  53. ' 3                 011
  54. ' 4                 100
  55. ' 5                 101
  56. ' 6                 110
  57. ' 7                 111
  58.  
  59. OUT &H3C4, 3   'Squencer address port: Select Char Map Select register.
  60. OUT &H3C5, FontCode
  61.  
  62. 'Colors 0-7: Font 0, unless FontCode is changed
  63. 'Colors 8-15: Font 1, unless FontCode is changed
  64.  
  65. FOR X = 0 TO 15
  66.  COLOR X
  67.  PRINT "TESTING TESTING 1 2 3"
  68. NEXT
  69.  
  70. SLEEP
  71.  
  72. OUT &H3C4, 3   'Squencer address port: Select Char Map Select register.
  73. OUT &H3C5, 0   'Return to normal one font mode
  74.  
  75. WIDTH 40:WIDTH 80 'Restore to default font
  76.  
  77. SUB LoadFont (Font$, BlockCode)
  78. 'Loads a standard font using the BIOS
  79. '
  80. 'Font$ contains the entire font
  81. 'BlockCode is a number between 0-3 for EGA and 0-7 for VGA.  This number
  82. 'designates the bank that the font is loaded into.  You can only display
  83. 'two fonts at once, but upto 8 can be loaded at a time.
  84.  
  85. DIM Regs AS RegTypeX
  86. Regs.AX = &H1100
  87. Regs.BX = &H1000 + BlockCode
  88. Regs.CX = &H100
  89. Regs.DX = 0
  90. Regs.ES = SSEG(Font$)
  91. Regs.BP = SADD(Font$)
  92. InterruptX &H10, Regs, Regs
  93. END SUB
  94.