home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / screen / border / borders2.bas < prev    next >
Encoding:
BASIC Source File  |  1993-11-20  |  2.9 KB  |  123 lines

  1. DECLARE FUNCTION Center% (text$)
  2. '******************************BORDERS2.BAS*********************************
  3. 'From an idea  in Oct/Nov 93 "Inside Microsoft Basic."
  4. '
  5. 'BORDERS.COM file made with PDQ and QUICKPAK for small size, this file
  6. 'made with plain vanilla QuickBASIC. BUT, can NOT be run inside the
  7. 'DOS. 5.0 QuickBASIC interpreter as it uses CALL INTERRUPT,
  8. 'you have to have a "real" QuickBASIC interpreter (one you paid hard
  9. 'cash for).
  10. '11/17/93
  11.  
  12. 'One User Defined TYPE for -both- CALL INTERRUPT and CALL INTERRUPTX
  13. '
  14. 'The only difference is in the DECLARE, both use RegType as TYPE
  15. 'Be sure to change "RegTypeX" to "RegType" in the INTERRUPTX call.
  16. 'August 17, 1993
  17. '
  18. TYPE RegType
  19.      AX        AS INTEGER
  20.      BX        AS INTEGER
  21.      CX        AS INTEGER
  22.      DX        AS INTEGER
  23.      BP        AS INTEGER
  24.      SI        AS INTEGER
  25.      DI        AS INTEGER
  26.      Flags     AS INTEGER
  27.      DS        AS INTEGER
  28.      ES        AS INTEGER
  29. END TYPE
  30.  
  31. '                 DECLARE statements for the 2 routines
  32. '                 -------------------------------------
  33. '
  34. ' Generate a software interrupt, loading all but the segment registers
  35. '
  36. DECLARE SUB INTERRUPT (intNum AS INTEGER, Reg AS RegType, Reg AS RegType)
  37. '
  38. ' Generate a software interrupt, loading all registers
  39. '
  40. DECLARE SUB INTERRUPTX (intNum AS INTEGER, Reg AS RegType, Reg AS RegType)
  41. '
  42.  
  43. REM '$INCLUDE: 'qb.bi'          'don't need this unless you erase the TYPE above
  44. DEFINT A-Z
  45. DECLARE SUB SetBorder (ColrByte%)
  46.  
  47. BeginAgain:
  48. COLOR 15, 1
  49. CLS
  50. COLOR 12, 0
  51. text2$ = "Set a BORDER Color by Typing the Color Number"
  52. LOCATE 2, Center(text2$)
  53. PRINT text2$
  54.  
  55.  
  56. FOR j = 0 TO 3
  57.     LOCATE 10 + j, 8
  58.     FOR i = 0 TO 15
  59.     COLOR i, 0
  60.     PRINT STRING$(4, 219);
  61.     NEXT
  62. NEXT
  63. 'hard to get the numbers to line up because of the space in front
  64. 'of each number, but got it
  65. COLOR 15, 1
  66. LOCATE 10 + j + 1, 7
  67. FOR n = 0 TO 15
  68.     IF n > 9 THEN
  69.         s = 1
  70.     ELSE
  71.         s = 2
  72.     END IF
  73. PRINT SPACE$(s); STR$(n);
  74. NEXT
  75.        
  76. again:
  77. text$ = "Type the BORDER Color NUMBER & Press {Enter}"
  78. LOCATE 4, Center(text$)
  79. COLOR 15, 1
  80. PRINT text$;
  81. Row = CSRLIN
  82. col = POS(0)
  83. COLOR 11, 0
  84. text2$ = "After Selecting a Color Press <Esc> to end or {Enter} to try again"
  85. LOCATE 22, (80 - LEN(text2$)) / 2
  86. PRINT text2$;
  87. LOCATE Row + 2, 39
  88. COLOR 7, 0
  89. PRINT SPACE$(2)
  90. LOCATE Row + 2, 39, 1, 4, 7
  91. INPUT "", Colr$
  92. ColrByte% = VAL(Colr$)
  93. IF ColrByte% > 63 THEN
  94. BEEP
  95. GOTO BeginAgain               'I get 63 colors
  96. END IF
  97. 'STOP
  98. LOCATE , , 0
  99. CALL SetBorder(ColrByte%)
  100. WHILE INKEY$ <> ""            'clears the keyboard
  101. WEND
  102. DO
  103. KeyHit$ = INKEY$
  104. LOOP UNTIL LEN(KeyHit$)
  105. IF KeyHit$ = CHR$(27) THEN
  106. END
  107. ELSE
  108. GOTO again
  109. END IF
  110. END
  111.  
  112. FUNCTION Center (text$)
  113. Center = 41 - LEN(text$) / 2
  114. END FUNCTION
  115.  
  116. SUB SetBorder (ColrByte%) STATIC
  117. DIM Regs AS RegType
  118. Regs.AX = &H1001
  119. Regs.BX = ColrByte% * &H100
  120. CALL INTERRUPT(&H10, Regs, Regs)
  121. END SUB
  122.  
  123.