home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / b-window.zip / BWDEMOI.BAS < prev    next >
BASIC Source File  |  1988-07-15  |  6KB  |  174 lines

  1. 100 'BWDEMOI.BAS  Interpreter B-WINDOW demo
  2. 110 '
  3. 120 '   This program demonstrates using B-WINDOW with standard
  4. 130 '   interpreted BASIC. The windowing file B-WIN20I.BIN is
  5. 140 '   BLOADed. Do not compile this program without first making
  6. 150 '   it compatible with a B-WINDOW .OBJ (object) file. See the
  7. 160 '   B-WINDOW documentation for details.
  8. 170 '
  9. 180 ' The following 2 lines initialize windowing. Do not forget
  10. 190 ' to include these lines at the beginning of your program!
  11. 200 ' And do not alter them. (If the "CLEAR" was in the subroutine
  12. 210 ' at 60060, the subroutine would never return)
  13. 215 '
  14. 220 CLEAR,&H8000        'limit BASIC to half way up segment
  15. 230 GOSUB 60060
  16. 240 '
  17. 250 ' Write on screen so window background is visible
  18. 260 '
  19. 270 S$ = "Window background   "
  20. 280 ATTRIB% = 7
  21. 290 CALL WFGCOLOR (ATTRIB%)
  22. 300 ATTRIB% = 0
  23. 310 CALL WBGCOLOR (ATTRIB%)
  24. 320 FOR I = 1 TO 88
  25. 330   CALL WWRITE (S$)
  26. 340 NEXT I
  27. 350 '
  28. 360 'Define the window
  29. 370 '
  30. 380 WID%=70 : HGT%=10 : BDR%=1 '1 = true
  31. 390 CALL WDEF (WNUM1%, WID%, HGT%, BDR%)
  32. 400 '
  33. 410 'Open the window
  34. 420 '
  35. 430 X%=4 : Y%=3 : CLR%=1 : WBGC%=0 : BTYPE%=2 : BFGC%=7 : BBGC%=0
  36. 440 CALL WOPEN (STATUS%, WNUM1%, X%, Y%, CLR%, WBGC%, BTYPE%, BFGC%, BBGC%)
  37. 450 '
  38. 460 'Write in the window
  39. 470 '
  40. 480 ATTRIB% = W.NORM
  41. 490 S$ = "  BWDEMOI.BAS - Demonstration of B-WINDOW in use"
  42. 500 CALL WWRITE (S$)
  43. 510 X% = 5 : Y% = 2
  44. 520 CALL WGOTOXY (X%, Y%)
  45. 530 S$ = "- Uses the B-WINI.MRG file"
  46. 540 CALL WWRITE (S$)
  47. 550 Y% = 3
  48. 560 CALL WGOTOXY (X%, Y%)
  49. 570 S$ = "- 20000 byte window buffer (B-WIN20I.BIN)"
  50. 580 CALL WWRITE (S$)
  51. 590 Y% = 4
  52. 600 CALL WGOTOXY (X%, Y%)
  53. 610 S$ = "- Uses the functions WDEF, WOPEN, WCLOSE, WGOTOXY, WWRITE"
  54. 620 CALL WWRITE (S$)
  55. 630 Y% = 5
  56. 640 CALL WGOTOXY (X%, Y%)
  57. 650 S$ = "- Demonstrates reopening windows in a different location"
  58. 660 CALL WWRITE (S$)
  59. 670 X% = 42 : Y% = 7
  60. 680 CALL WGOTOXY (X%, Y%)
  61. 690 ATTRIB% = 15
  62. 700 CALL WFGCOLOR (ATTRIB%)
  63. 710 S$="Press any key to continue"
  64. 720 CALL WWRITE (S$)
  65. 730 ATTRIB% = 7
  66. 740 CALL WFGCOLOR (ATTRIB%)
  67. 750 'Wait for a key to be pressed
  68. 760 V$=INKEY$ : IF V$="" THEN GOTO 760
  69. 770 '
  70. 780 ' Close window
  71. 790 '
  72. 800 CALL WCLOSE
  73. 810 '
  74. 820 'Reopen window at different location with a different border
  75. 830 '
  76. 840 X%=8 : Y%=12 : CLR%=0 : WBGC%=0 : BTYPE%=5 : BFGC%=7 : BBGC%=0
  77. 850 CALL WOPEN (STATUS%, WNUM1%, X%, Y%, CLR%, WBGC%, BTYPE%, BFGC%, BBGC%)
  78. 860 V$=INKEY$ : IF V$="" THEN GOTO 860
  79. 870 '
  80. 880 ' Close window again
  81. 890 '
  82. 900 CALL WCLOSE
  83. 910 '
  84. 920 ' Reopen window again at different location with a different border
  85. 930 '
  86. 940 X%=0 : Y%=0 : CLR%=0 : WBGC%=0 : BTYPE%=5 : BFGC%=7 : BBGC%=7
  87. 950 CALL WOPEN (STATUS%, WNUM1%, X%, Y%, CLR%, WBGC%, BTYPE%, BFGC%, BBGC%)
  88. 960 V$=INKEY$ : IF V$="" THEN GOTO 960
  89. 970 '
  90. 980 ' Close window for last time
  91. 990 '
  92. 1000 CALL WCLOSE
  93. 1010 '
  94. 1020 ' Use WGOTOXY on standard 80x25 screen
  95. 1030 '
  96. 1040 X%=50 : Y%=24
  97. 1050 CALL WGOTOXY (X%, Y%)
  98. 1060 S$="Press any key to continue"
  99. 1070 CALL WWRITE (S$)
  100. 1080 V$=INKEY$ : IF V$="" THEN GOTO 1080
  101. 1090 CLS
  102. 60000 '
  103. 60010 ' B-WINI.MRG - B-WINDOW merge file
  104. 60020 '
  105. 60030 ' Merge this code with BASIC programs using B-WINDOW
  106. 60040 ' functions if you are using a BASIC interpreter. DO NOT
  107. 60050 ' include this code in a compiled program. See the
  108. 60052 ' documentation for details.
  109. 60054 '
  110. 60056 CLS : STOP 'Terminate main body of BASIC program
  111. 60058 '
  112. 60060 ' <== Entry point of initialization
  113. 60070 '
  114. 60110 '
  115. 60120 'Find out value of the data segment register DS. Use
  116. 60130 'a 16 byte array that can also be used for the WINT86
  117. 60140 'function. The short assembler subroutine that is poked
  118. 60150 'into the array returns the DS segment register value
  119. 60160 '
  120. 60170 DEF SEG
  121. 60180 W.DS% = 0
  122. 60190 DIM WREGARAY%(8)
  123. 60200 WPTR = VARPTR(WREGARAY%(0)) 'pointer to start of array
  124. 60210 IF WPTR < 0 THEN WPTR = WPTR+65536!
  125. 60220 POKE WPTR,&H89:POKE WPTR+1,&HE5                    'mov  bp,sp
  126. 60230 POKE WPTR+2,&H8C:POKE WPTR+3,&HD8                  'mov  ax,ds
  127. 60240 POKE WPTR+4,&H8B:POKE WPTR+5,&H5E:POKE WPTR+6,&H4  'mov  bx,[bp+4]
  128. 60250 POKE WPTR+7,&H89:POKE WPTR+8,&H7                   'mov  [bx],ax
  129. 60260 POKE WPTR+9,&HCA:POKE WPTR+10,&H2:POKE WPTR+11,&H0 'retf 2
  130. 60270 CALL WPTR(W.DS%)
  131. 60280 '
  132. 60290 ' Set W.SEGBASE to half way up BASIC string space. The
  133. 60300 ' "CLEAR,&H8000" instruction at the beginning of the program
  134. 60310 ' created room for the BLOAD.
  135. 60320 '
  136. 60330 W.SEGBASE = W.DS%+&H800
  137. 60340 DEF SEG = W.SEGBASE
  138. 60350 '
  139. 60360 ' The BLOADed ".BIN" file has a table of entry points
  140. 60370 ' for the windowing functions. The following assignments
  141. 60380 ' are the offsets of the various functions in the table
  142. 60390 '
  143. 60400 WINIT = &H0
  144. 60410 WDEF = WINIT + 6
  145. 60420 WOPEN = WINIT + 12
  146. 60430 WCLOSE = WINIT + 18
  147. 60440 WKILL = WINIT + 24
  148. 60450 WWRITE = WINIT + 30
  149. 60460 WDSP1 = WINIT + 36
  150. 60470 WSCROLL = WINIT + 42
  151. 60480 WGETCX = WINIT + 48
  152. 60490 WGETCY = WINIT + 54
  153. 60500 WGOTOXY = WINIT + 60
  154. 60510 WBORDER = WINIT + 66
  155. 60520 WERRDISPLAYON = WINIT + 72
  156. 60530 WERRDISPLAYOFF = WINIT + 78
  157. 60540 WINT86 = WINIT + 84
  158. 60550 WLPTSELECT = WINIT + 90
  159. 60560 WLPTIMOUT = WINIT + 96
  160. 60570 WFGCOLOR = WINIT + 102
  161. 60580 WBGCOLOR = WINIT + 108
  162. 60584 WSCRNTYPE = WINIT + 114
  163. 60590 '
  164. 60680 ' Do NOT change the BLOAD offset!
  165. 60690 '
  166. 60700 BLOAD "b-win20i.bin", 0   'offset of zero
  167. 60710 '
  168. 60720 ' WINIT MUST be called before any other windowing functions
  169. 60730 '
  170. 60740 CALL WINIT (WSTATUS%)
  171. 60750 IF WSTATUS% <> 1 THEN PRINT "Windowing initialization error":STOP
  172. 60760 '
  173. 60770 RETURN 'End of windowing initialization
  174.