home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / PRINTROM.ZIP / ROMTEST.BAS < prev    next >
BASIC Source File  |  1991-09-03  |  17KB  |  394 lines

  1. '****************************************************************************
  2. '*               Routine to test the PrintROMtable subroutine               *
  3. '*                                                                          *
  4. '* Load QB by typing QB /Lqb to run within the environment                  *
  5. '*                                                                          *
  6. '* Linking from the command-line:                                           *
  7. '*                   LINK YourProg+PrintROM,,nul,AnyLibraries+QB;           *
  8. '*                                                                          *
  9. '* You *** MUST ***  $INCLUDE: 'printrom.bi' into every module that makes   *
  10. '* calls to PrintROMtable.  Because this $INCLUDE file DIMs the TYPE, make  *
  11. '* sure that printrom.bi is the last $INCLUDE file used before your first   *
  12. '* executable statement.                                                    *
  13. '****************************************************************************
  14. '
  15. REM $INCLUDE: 'printrom.bi'
  16.  
  17. DEFINT A-Z
  18.  
  19. '**** PrintROMtable needs to know what SCREEN type is used.  Instruct it by
  20. '     setting PR.ScreenMode to the desired mode.
  21.  
  22. PR.ScreenMode = 12
  23.  
  24. ON ERROR GOTO BadMode
  25. SCREEN PR.ScreenMode
  26. ON ERROR GOTO 0
  27.  
  28. '**** Set PR.DefaultFile to 1 of 4 different disk, font files.  File #1 is
  29. '     international ASCII set 128 through 254 (standard high ASCII found in
  30. '     most text books).  Font file #2 is U.S. and contains such goodies as,
  31. '     registered trademark symbol (chr 169) and copyright symbol (chr 184).
  32. '     Font file #3 is Portuguese and file #4 is French-Canadian.  If the
  33. '     integer, PR.DefaultFile, is not set, PrintROMtable will set it to #1.
  34.  
  35. PR.DefaultFile = 1
  36.  
  37. '**** Draw a simple pattern to show BGclr = 0 is non-destructive background.
  38. IF PR.ScreenMode > 3 THEN PAINT (300, 200), 3   'Don't paint in CGA modes
  39. y% = 200: Clr% = 0
  40. FOR x% = 180 TO 460 STEP 20
  41.     CIRCLE (x%, 200), 100, Clr%
  42.     Clr% = Clr% + 1
  43.     IF Clr% = 3 THEN Clr% = Clr% + 1
  44. NEXT
  45.  
  46. '**** Tells PrintROMtable to reset which disk-based font file to use
  47. PR.ReadHiAscFile = -1: PrintROMtable a$, PR
  48.  
  49. PR.ReadHiAscFile = 2    'U.S. set contains copyright symbol chr$(184)
  50.  
  51. PR.Height = 8: PR.Tall = True
  52. a$ = "Copyright " + CHR$(184) + " 1991, Lawrence Stone.  All Rights Reserved."
  53. PR.xAxis = 18: PR.yAxis = 135: PR.StepX = 10: PR.CharClr = 15
  54. PR.Shadow = -1: PR.ItalicSlant = 0: PrintROMtable a$, PR
  55.  
  56. '**** Tell PrintROMtable to reset which disk-based font file to use - if CGA,
  57. '     then next use of high ASCII will force default (international symbols).
  58. PR.ReadHiAscFile = -1: PrintROMtable a$, PR
  59.  
  60. PR.Height = 16: PR.Tall = False
  61. a$ = "▓▓▓█▌ √ With Plenty of Help from His Friends √ ▐█▓▓▓"
  62. PR.xAxis = 111: PR.yAxis = 155: PR.StepX = 7: PR.BGclr = 1
  63. IF PR.ScreenMode < 7 THEN PR.BGclr = 0: PR.yAxis = 15
  64. PrintROMtable a$, PR
  65.  
  66. IF PR.ScreenMode < 7 THEN GOTO LastAct
  67.  
  68. PR.Height = 8
  69. a$ = CHR$(4) + "HELLO  "               'Hello - right-hand italic
  70. PR.xAxis = 207: PR.yAxis = 75: PR.StepX = 19: PR.BGclr = 7: PR.ItalicSlant = 2
  71. PrintROMtable a$, PR
  72.  
  73. a$ = MID$(a$, 2, 5) + CHR$(4)          'Hello - left-hand italic
  74. PR.ItalicSlant = -PR.ItalicSlant: PrintROMtable a$, PR
  75.  
  76. PR.ItalicSlant = 0
  77. PR.xAxis = 52: PR.yAxis = 265: PR.StepX = 7: PR.CharClr = 15: PR.BGclr = 9
  78. PrintROMtable " Until now, using ", PR 'Get fancy by mixing fonts on one line
  79.  
  80.                                                       'Notice xAxis not needed
  81. PR.Height = 14: PR.yAxis = 258: PrintROMtable "TEXT FONTS", PR
  82. PR.Height = 8: PR.yAxis = 265: PrintROMtable " with ", PR 'Also notice that the 1st
  83. PR.Height = 16                                        'pixel starts at top-left
  84. PR.yAxis = 258: PrintROMtable "GRAPHICS", PR          'so, we adjust yAxis 7
  85. PR.Height = 8                                         'pixels to alternate
  86. PR.yAxis = 265: PrintROMtable " was like ", PR        'between "Tall" & normal
  87.  
  88. PR.ItalicSlant = 1: PR.StepY = 2: PrintROMtable "Tripping Downstairs", PR
  89. PR.StepY = 0: PrintROMtable "...", PR        'Notice xAxis & yAxis not needed
  90.  
  91. '**** Top-down & italic
  92. PR.xAxis = 222: PR.yAxis = 280: PR.StepX = 0: PR.StepY = 10: PR.CharClr = 14
  93. PR.BGclr = 2: PR.ItalicSlant = 2: PrintROMtable " Top to Bottom  ", PR
  94.  
  95. '**** Go from bottom - up
  96. PR.xAxis = 231: PR.yAxis = 430: PR.StepX = 0: PR.StepY = -10: PR.CharClr = 10
  97. PR.BGclr = 256: PR.ItalicSlant = 0: PrintROMtable " Upside Down... ", PR
  98.  
  99. PR.xAxis = 247: PR.yAxis = 350: PR.StepX = 9: PR.StepY = 0: PR.BGclr = 7
  100. PR.ItalicSlant = 0: PrintROMtable " Forward or ", PR
  101.  
  102. '**** Each character is backwards
  103. PR.yAxis = 350: PR.StepX = 9: PR.CharClr = 14
  104. PR.Backwards = -1: PrintROMtable "BACKWARD ", PR
  105.  
  106. PR.CharClr = 10: PR.Backwards = 0: PrintROMtable "Characters ", PR
  107.  
  108. a$ = " And Reverse Strings "                 'String prints from right - left
  109. PR.xAxis = 427: PR.yAxis = 380: PR.StepX = -PR.StepX: PR.CharClr = 11
  110. PR.BGclr = 6: PR.ItalicSlant = -2: PrintROMtable a$, PR
  111.  
  112. '**** Reposition xAxis 7 pixels for forward display
  113. PR.xAxis = 434: PR.StepX = -PR.StepX: PR.CharClr = 12: PR.BGclr = 9
  114. PR.ItalicSlant = -PR.ItalicSlant: PrintROMtable a$, PR
  115.  
  116. a$ = " Inverted Images "
  117. PR.xAxis = 250: PR.yAxis = 105: PR.CharClr = 15: PR.BGclr = 12
  118. PR.ItalicSlant = -PR.ItalicSlant: PrintROMtable a$, PR
  119.  
  120. PR.xAxis = 250: PR.yAxis = 113: PR.BGclr = 1: PR.ItalicSlant = 2
  121. PR.Inverted = -1: PrintROMtable a$, PR       'Now print it inverted
  122.  
  123. PR.Height = 8
  124. a$ = "You can even Underline!"               'StepX = 7 is condenced font
  125. PR.xAxis = 247: PR.yAxis = 410: PR.StepX = 7: PR.CharClr = 14: PR.BGclr = 0
  126. PR.Inverted = 0: PR.ItalicSlant = 0: PR.UnderLine = -1: PrintROMtable a$, PR
  127.  
  128.                                              'Show string inverted
  129. PR.xAxis = 247: PR.yAxis = 419: PR.CharClr = 11: PR.Inverted = -1
  130. PrintROMtable a$, PR
  131.  
  132. a$ = "WIDE Letters"                          'Wide, italic & underlined
  133. PR.xAxis = 235: PR.yAxis = 17: PR.StepX = 15: PR.CharClr = 14: PR.Inverted = 0
  134. PR.ItalicSlant = 2: PR.Elongate% = 1: PrintROMtable a$, PR
  135.  
  136. PR.xAxis = 234: PR.yAxis = 26: PR.CharClr = 11: PR.Inverted = -1
  137. PR.ItalicSlant = -PR.ItalicSlant: PrintROMtable a$, PR   'Show string inverted
  138.  
  139. PR.xAxis = 39: PR.yAxis = 41: PR.StepX = 29: PR.StepY = 2: PR.CharClr = 15
  140. PR.BGclr = 5: PR.ItalicSlant = 0: PR.Inverted = 0: PR.UnderLine = 0
  141. PR.Elongate% = 2: PrintROMtable "Double WID", PR   'Double wide stepping down
  142.  
  143. PR.xAxis = 332                                     'Step the rest up
  144. PR.yAxis = 57: PR.StepY = -PR.StepY: PrintROMtable "E Letters!", PR
  145.  
  146. a$ = "STENCILS"                                    'Shadowed stencil
  147. PR.xAxis = 5: PR.yAxis = 320: PR.StepX = 13: PR.StepY = 0: PR.CharClr = 14
  148. PR.BGclr = 0: PR.Elongate% = 0: PR.Stencil% = -1: PrintROMtable a$, PR
  149.  
  150. PR.xAxis = 3: PR.yAxis = 330: PR.StepX = 19: PR.CharClr = 11: PR.Elongate% = 1
  151. PrintROMtable a$, PR                               'Wide stencil
  152.  
  153. PR.UnderLine = -1
  154. PR.xAxis = 0: PR.StepX = 26: PR.yAxis = 350: PR.CharClr = 15: PR.Elongate% = 2
  155. PrintROMtable a$, PR                           'Underlined, double wide stencil
  156.  
  157. PR.xAxis = 0: PR.yAxis = 359: PR.CharClr = 10: PR.ItalicSlant = 2
  158. PR.Inverted = -1: PrintROMtable a$, PR         'Invert and slant the stencil
  159.  
  160. PR.Height = 32                                '32, underlined & double wide
  161. a$ = "32 Height Letters": PR.Stencil% = 0: PR.BGclr = 12
  162. PR.Inverted = 0: PR.UnderLine = -1: PR.ItalicSlant = 2
  163. PR.xAxis = 71: PR.StepX = 29: PR.yAxis = 173: PR.CharClr = 15: PR.Elongate% = 2
  164. PrintROMtable a$, PR
  165.  
  166. PR.Height = 28: a$ = "28 Height Letters": PR.ItalicSlant = 2
  167. PR.xAxis = 71: PR.yAxis = 206: PR.BGclr = 11: PR.CharClr = 13
  168. PR.UnderLine = 1: PrintROMtable a$, PR            'Tall and wide
  169.  
  170. PR.Height = 16: a$ = "16 Height Letters": PR.BGclr = 13: PR.CharClr = 14
  171. PR.xAxis = 71: PR.yAxis = 239: PR.ItalicSlant = 3
  172. PrintROMtable a$, PR                             'Tall and normal width
  173.  
  174. PR.Height = 14: PR.StrikeThrough = -1            'Strike through letters
  175. PR.xAxis = 247: PR.StepX = 10: PR.yAxis = 320: PR.ItalicSlant = 0
  176. PR.Elongate% = 0: PR.UnderLine = 0: PR.BGclr = 0: PR.CharClr = 15
  177. PrintROMtable "These are StrikeThrough characters", PR
  178.  
  179. PR.Height = 8: PR.xAxis = 185: PR.yAxis = 382: PR.StepX = -8
  180. PR.Backwards = True: PR.StrikeThrough = 0
  181. PrintROMtable "Read this with a MIRROR.", PR   'True mirror image!
  182.  
  183. PR.CharClr = 11
  184. PR.xAxis = 2: PR.yAxis = 402: PR.StepX = 8: PR.Backwards = False
  185. PrintROMtable "If you can read this...", PR   'True mirror image!
  186.  
  187. PR.xAxis = 2: PR.yAxis = 415: PR.CharClr = 12
  188. a$ = "Your Just To Damn Close!"
  189. PrintROMtable a$, PR
  190.  
  191. PR.xAxis = 2: PR.yAxis = 427: PR.Condensed = True
  192. PrintROMtable a$, PR
  193.  
  194. LastAct:
  195. PR.yAxis = 460: PR.BGclr = 3: GOSUB StrikeAnyKey
  196.  
  197. CLS
  198.  
  199. PR.Height = 32: PR.Tall = True              '64, underlined & double wide
  200. IF PR.ScreenMode > 2 THEN PR.BGclr = 6 ELSE PR.BGclr = 256
  201. a$ = " REVIEW: ": PR.Shadow% = True
  202. PR.UnderLine = -1: PR.ItalicSlant = 0: PR.Elongate% = 2
  203. PR.xAxis = 181: PR.StepX = 30: PR.yAxis = 7: PR.CharClr = 14
  204. PrintROMtable a$, PR
  205.  
  206. b$ = "   High Double Wide"
  207. c$ = "   High Wide (Bold) Letters"
  208. d$ = "   High Normal Letters"
  209. e$ = "   High Condensed Letters"
  210.  
  211. FOR N = 1 TO 7
  212.     x1 = 67
  213.     IF PR.ScreenMode < 7 THEN x1 = x1 \ 2
  214.     LINE (1, x1)-(640, 301), 0, BF     'Clear screen below "Review" title
  215.     IF PR.ScreenMode > 2 THEN PR.BGclr = 9 ELSE PR.BGclr = 256
  216.     PR.UnderLine = 0: PR.ItalicSlant = 0: PR.CharClr = 14
  217.  
  218.     IF N = 1 THEN
  219.         PR.Height = 32: PR.Tall = True                '32 + Tall = 64
  220.         MID$(b$, 1, 2) = "64": MID$(c$, 1, 2) = "64"  'EGA will default to 56
  221.         MID$(d$, 1, 2) = "64": MID$(e$, 1, 2) = "64"  'CGA will default to 16
  222.     ELSEIF N = 2 THEN
  223.         PR.Height = 28: PR.Tall = True                '28 + Tall = 56
  224.         MID$(b$, 1, 2) = "56": MID$(c$, 1, 2) = "56"  'CGA will default to 16
  225.         MID$(d$, 1, 2) = "56": MID$(e$, 1, 2) = "56"
  226.     ELSEIF N = 3 THEN
  227.         PR.Height = 32: PR.Tall = False               'EGA will default to 28
  228.         MID$(b$, 1, 2) = "32": MID$(c$, 1, 2) = "32"  'CGA will default to 8
  229.         MID$(d$, 1, 2) = "32": MID$(e$, 1, 2) = "32"
  230.     ELSEIF N = 4 THEN
  231.         PR.Height = 28                                'CGA will default to 8
  232.         MID$(b$, 1, 2) = "28": MID$(c$, 1, 2) = "28"
  233.         MID$(d$, 1, 2) = "28": MID$(e$, 1, 2) = "28"
  234.     ELSEIF N = 5 THEN
  235.         PR.Height = 16                                'Use 8 + Tall for CGA
  236.         MID$(b$, 1, 2) = "16": MID$(c$, 1, 2) = "16"
  237.         MID$(d$, 1, 2) = "16": MID$(e$, 1, 2) = "16"
  238.     ELSEIF N = 6 THEN
  239.         PR.Height = 14                                'CGA will default to 8
  240.         MID$(b$, 1, 2) = "14": MID$(c$, 1, 2) = "14"
  241.         MID$(d$, 1, 2) = "14": MID$(e$, 1, 2) = "14"
  242.     ELSEIF N = 7 THEN
  243.         PR.Height = 8
  244.         MID$(b$, 1, 2) = " 8": MID$(c$, 1, 2) = " 8"
  245.         MID$(d$, 1, 2) = " 8": MID$(e$, 1, 2) = " 8"
  246.         b$ = MID$(b$, 2): c$ = MID$(c$, 2)
  247.         d$ = MID$(d$, 2): e$ = MID$(e$, 2)
  248.     END IF
  249.  
  250.     FOR j = 1 TO 5
  251.         IF j% = 1 THEN
  252.             PR.Elongate% = 2
  253.             PR.xAxis = 2: PR.StepX = 30: PR.yAxis = 67
  254.             IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2
  255.             PrintROMtable b$, PR
  256.         ELSEIF j% = 2 THEN
  257.             PR.Elongate% = 1
  258.             PR.xAxis = 2: PR.StepX = 19: PR.yAxis = 127
  259.             IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2
  260.             PrintROMtable c$, PR
  261.         ELSEIF j% = 3 THEN
  262.             PR.Elongate% = 0
  263.             PR.xAxis = 2: PR.StepX = 14: PR.yAxis = 187
  264.             IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2
  265.             PrintROMtable d$, PR
  266.         ELSEIF j% = 4 THEN
  267.             PR.Condensed = True
  268.             PR.xAxis = 2: PR.StepX = 10: PR.yAxis = 247
  269.             IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2
  270.             PrintROMtable e$, PR
  271.         ELSEIF j% = 5 THEN
  272.             PR.Height = 8: PR.Tall = False: PR.Condensed = False
  273.             PR.yAxis = 290: PR.BGclr = 0
  274.             IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2
  275.             GOSUB StrikeAnyKey
  276.         END IF
  277.     NEXT
  278. NEXT
  279.  
  280. b$ = ""
  281. FOR N = 128 TO 255
  282.     b$ = b$ + CHR$(N) + " "
  283. NEXT
  284. b$ = RTRIM$(b$)
  285.  
  286. FOR N = 1 TO 4
  287.     x1 = 67
  288.     IF PR.ScreenMode < 7 THEN x1 = x1 \ 2 - 6
  289.     LINE (1, x1)-(640, 310), 0, BF     'Clear screen below "Review" title
  290.     IF PR.ScreenMode > 2 THEN PR.BGclr = 2 ELSE PR.BGclr = 256
  291.     PR.UnderLine = 0: PR.ItalicSlant = 0: PR.CharClr = 14
  292.     PR.ReadHiAscFile = True: PrintROMtable "", PR
  293.     PR.Height = 8: PR.Tall = True                     '8 + Tall = 16
  294.  
  295.     PR.StepX = 10: PR.yAxis = 70
  296.     IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2 - 6
  297.     
  298.     IF N = 1 THEN
  299.         PR.ReadHiAscFile = N: PrintROMtable "", PR
  300.         a$ = " High ASCII Font Set = rsCODES.INT (International) "
  301.     ELSEIF N = 2 THEN
  302.         PR.ReadHiAscFile = N: PrintROMtable "", PR
  303.         a$ = " High ASCII Font Set = rsCODES.US  (United States)"
  304.     ELSEIF N = 3 THEN
  305.         PR.ReadHiAscFile = N: PrintROMtable "", PR
  306.         a$ = " High ASCII Font Set = rsCODES.POR  (Portuguese)"
  307.     ELSEIF N = 4 THEN
  308.         PR.ReadHiAscFile = N: PrintROMtable "", PR
  309.         a$ = " High ASCII Font Set = rsCODES.CAN  (French-Canadian)"
  310.     END IF
  311.     PR.xAxis = 1: PrintROMtable a$, PR
  312.  
  313.     IF PR.ScreenMode > 2 THEN PR.BGclr = 9 ELSE PR.BGclr = 256: PR.Tall = False
  314.  
  315.     a$ = MID$(b$, 1, 57): PR.xAxis = 2: PR.yAxis = 100
  316.     IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2
  317.     PrintROMtable a$, PR
  318.     
  319.     a$ = MID$(b$, 59, 57): PR.xAxis = 2: PR.yAxis = 118
  320.     IF PR.ScreenMode < 7 THEN PR.yAxis = 67
  321.     PrintROMtable a$, PR
  322.     
  323.     a$ = MID$(b$, 117, 57): PR.xAxis = 2: PR.yAxis = 136
  324.     IF PR.ScreenMode < 7 THEN PR.yAxis = 83
  325.     PrintROMtable a$, PR
  326.     
  327.     a$ = MID$(b$, 175, 57): PR.xAxis = 2: PR.yAxis = 154
  328.     IF PR.ScreenMode < 7 THEN PR.yAxis = 100
  329.     PrintROMtable a$, PR
  330.     
  331.     a$ = MID$(b$, 233, 23): PR.xAxis = 2: PR.yAxis = 172
  332.     IF PR.ScreenMode < 7 THEN PR.yAxis = 117
  333.     PrintROMtable a$, PR
  334.     
  335.     PR.yAxis = 290: PR.BGclr = 0
  336.     IF PR.ScreenMode < 7 THEN PR.yAxis = PR.yAxis \ 2
  337.     GOSUB StrikeAnyKey
  338. NEXT
  339.  
  340. END
  341.  
  342. '******************************* Subroutines ******************************
  343.  
  344. StrikeAnyKey:
  345.     PR.Condensed = False: PR.Height = 8: PR.ItalicSlant = 2
  346.     PR.xAxis = 200: PR.StepX = 9: PR.CharClr = 15
  347.     PrintROMtable "Strike any key to continue...", PR  'Normal lettering
  348.     
  349.     DO WHILE LEN(INKEY$) = False                  'A blinking display
  350.         GOSUB Count4Ticks
  351.         IF LEN(INKEY$) THEN EXIT DO
  352.         PR.xAxis = 434                  'Set xAxis to erase last 3 chars
  353.  
  354.         '**** yAxis + 12 to account for character height + shadow.
  355.         '     xAxis -2 to account for PrintROMtable automatic line positioning.
  356.         LINE (PR.xAxis - 3, PR.yAxis)-(468, PR.yAxis + 18), PR.BGclr, BF
  357.         GOSUB Count4Ticks
  358.         PrintROMtable "...", PR                    'Blink the dots only
  359.     LOOP
  360. RETURN
  361.  
  362. Count4Ticks:                    'Routine to pause for 4 ticks (approx .2 sec)
  363.     TestTick% = 0               'Set TestTick% to zero
  364.     DEF SEG = 0
  365.     WHILE TestTick% < 4         'Pause for four ticks of the clock
  366.         lastTick% = Tick%       'This is the variable we use to adjust count
  367.         Tick% = PEEK(&H46C)     'Get a tick from the clock.
  368.  
  369.         '**** Prevents endless loop when rolling past midnight.
  370.         IF lastTick% <> Tick% THEN TestTick% = TestTick% + 1
  371.     WEND
  372.     DEF SEG
  373. RETURN
  374.  
  375. BadMode:
  376.     z% = ERR                              'Reset the ERR
  377.     IF PR.ScreenMode = 12 THEN            'If mode 12 produced error try 9
  378.         PR.ScreenMode = 9
  379.     ELSEIF PR.ScreenMode = 9 THEN         'If mode 9 produced error try 7
  380.         PR.ScreenMode = 7
  381.     ELSEIF PR.ScreenMode = 7 THEN         'If mode 7 produced error try 2
  382.         PR.ScreenMode = 2
  383.     ELSE                                  'Don't know what it is so quit
  384.         Quit% = True
  385.     END IF
  386.     IF NOT Quit% THEN RESUME              'We're still OK so try again
  387.  
  388.     SCREEN 0                              'Either no graphics or Herc so END
  389.     CLS
  390.     PRINT "CGA, EGA, or VGA Monitor Required to Test Run PrintROMtable"
  391.     PRINT "Program Aborted"
  392.     END
  393.  
  394.