home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
b-window.zip
/
BWDEMOI.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-07-15
|
6KB
|
174 lines
100 'BWDEMOI.BAS Interpreter B-WINDOW demo
110 '
120 ' This program demonstrates using B-WINDOW with standard
130 ' interpreted BASIC. The windowing file B-WIN20I.BIN is
140 ' BLOADed. Do not compile this program without first making
150 ' it compatible with a B-WINDOW .OBJ (object) file. See the
160 ' B-WINDOW documentation for details.
170 '
180 ' The following 2 lines initialize windowing. Do not forget
190 ' to include these lines at the beginning of your program!
200 ' And do not alter them. (If the "CLEAR" was in the subroutine
210 ' at 60060, the subroutine would never return)
215 '
220 CLEAR,&H8000 'limit BASIC to half way up segment
230 GOSUB 60060
240 '
250 ' Write on screen so window background is visible
260 '
270 S$ = "Window background "
280 ATTRIB% = 7
290 CALL WFGCOLOR (ATTRIB%)
300 ATTRIB% = 0
310 CALL WBGCOLOR (ATTRIB%)
320 FOR I = 1 TO 88
330 CALL WWRITE (S$)
340 NEXT I
350 '
360 'Define the window
370 '
380 WID%=70 : HGT%=10 : BDR%=1 '1 = true
390 CALL WDEF (WNUM1%, WID%, HGT%, BDR%)
400 '
410 'Open the window
420 '
430 X%=4 : Y%=3 : CLR%=1 : WBGC%=0 : BTYPE%=2 : BFGC%=7 : BBGC%=0
440 CALL WOPEN (STATUS%, WNUM1%, X%, Y%, CLR%, WBGC%, BTYPE%, BFGC%, BBGC%)
450 '
460 'Write in the window
470 '
480 ATTRIB% = W.NORM
490 S$ = " BWDEMOI.BAS - Demonstration of B-WINDOW in use"
500 CALL WWRITE (S$)
510 X% = 5 : Y% = 2
520 CALL WGOTOXY (X%, Y%)
530 S$ = "- Uses the B-WINI.MRG file"
540 CALL WWRITE (S$)
550 Y% = 3
560 CALL WGOTOXY (X%, Y%)
570 S$ = "- 20000 byte window buffer (B-WIN20I.BIN)"
580 CALL WWRITE (S$)
590 Y% = 4
600 CALL WGOTOXY (X%, Y%)
610 S$ = "- Uses the functions WDEF, WOPEN, WCLOSE, WGOTOXY, WWRITE"
620 CALL WWRITE (S$)
630 Y% = 5
640 CALL WGOTOXY (X%, Y%)
650 S$ = "- Demonstrates reopening windows in a different location"
660 CALL WWRITE (S$)
670 X% = 42 : Y% = 7
680 CALL WGOTOXY (X%, Y%)
690 ATTRIB% = 15
700 CALL WFGCOLOR (ATTRIB%)
710 S$="Press any key to continue"
720 CALL WWRITE (S$)
730 ATTRIB% = 7
740 CALL WFGCOLOR (ATTRIB%)
750 'Wait for a key to be pressed
760 V$=INKEY$ : IF V$="" THEN GOTO 760
770 '
780 ' Close window
790 '
800 CALL WCLOSE
810 '
820 'Reopen window at different location with a different border
830 '
840 X%=8 : Y%=12 : CLR%=0 : WBGC%=0 : BTYPE%=5 : BFGC%=7 : BBGC%=0
850 CALL WOPEN (STATUS%, WNUM1%, X%, Y%, CLR%, WBGC%, BTYPE%, BFGC%, BBGC%)
860 V$=INKEY$ : IF V$="" THEN GOTO 860
870 '
880 ' Close window again
890 '
900 CALL WCLOSE
910 '
920 ' Reopen window again at different location with a different border
930 '
940 X%=0 : Y%=0 : CLR%=0 : WBGC%=0 : BTYPE%=5 : BFGC%=7 : BBGC%=7
950 CALL WOPEN (STATUS%, WNUM1%, X%, Y%, CLR%, WBGC%, BTYPE%, BFGC%, BBGC%)
960 V$=INKEY$ : IF V$="" THEN GOTO 960
970 '
980 ' Close window for last time
990 '
1000 CALL WCLOSE
1010 '
1020 ' Use WGOTOXY on standard 80x25 screen
1030 '
1040 X%=50 : Y%=24
1050 CALL WGOTOXY (X%, Y%)
1060 S$="Press any key to continue"
1070 CALL WWRITE (S$)
1080 V$=INKEY$ : IF V$="" THEN GOTO 1080
1090 CLS
60000 '
60010 ' B-WINI.MRG - B-WINDOW merge file
60020 '
60030 ' Merge this code with BASIC programs using B-WINDOW
60040 ' functions if you are using a BASIC interpreter. DO NOT
60050 ' include this code in a compiled program. See the
60052 ' documentation for details.
60054 '
60056 CLS : STOP 'Terminate main body of BASIC program
60058 '
60060 ' <== Entry point of initialization
60070 '
60110 '
60120 'Find out value of the data segment register DS. Use
60130 'a 16 byte array that can also be used for the WINT86
60140 'function. The short assembler subroutine that is poked
60150 'into the array returns the DS segment register value
60160 '
60170 DEF SEG
60180 W.DS% = 0
60190 DIM WREGARAY%(8)
60200 WPTR = VARPTR(WREGARAY%(0)) 'pointer to start of array
60210 IF WPTR < 0 THEN WPTR = WPTR+65536!
60220 POKE WPTR,&H89:POKE WPTR+1,&HE5 'mov bp,sp
60230 POKE WPTR+2,&H8C:POKE WPTR+3,&HD8 'mov ax,ds
60240 POKE WPTR+4,&H8B:POKE WPTR+5,&H5E:POKE WPTR+6,&H4 'mov bx,[bp+4]
60250 POKE WPTR+7,&H89:POKE WPTR+8,&H7 'mov [bx],ax
60260 POKE WPTR+9,&HCA:POKE WPTR+10,&H2:POKE WPTR+11,&H0 'retf 2
60270 CALL WPTR(W.DS%)
60280 '
60290 ' Set W.SEGBASE to half way up BASIC string space. The
60300 ' "CLEAR,&H8000" instruction at the beginning of the program
60310 ' created room for the BLOAD.
60320 '
60330 W.SEGBASE = W.DS%+&H800
60340 DEF SEG = W.SEGBASE
60350 '
60360 ' The BLOADed ".BIN" file has a table of entry points
60370 ' for the windowing functions. The following assignments
60380 ' are the offsets of the various functions in the table
60390 '
60400 WINIT = &H0
60410 WDEF = WINIT + 6
60420 WOPEN = WINIT + 12
60430 WCLOSE = WINIT + 18
60440 WKILL = WINIT + 24
60450 WWRITE = WINIT + 30
60460 WDSP1 = WINIT + 36
60470 WSCROLL = WINIT + 42
60480 WGETCX = WINIT + 48
60490 WGETCY = WINIT + 54
60500 WGOTOXY = WINIT + 60
60510 WBORDER = WINIT + 66
60520 WERRDISPLAYON = WINIT + 72
60530 WERRDISPLAYOFF = WINIT + 78
60540 WINT86 = WINIT + 84
60550 WLPTSELECT = WINIT + 90
60560 WLPTIMOUT = WINIT + 96
60570 WFGCOLOR = WINIT + 102
60580 WBGCOLOR = WINIT + 108
60584 WSCRNTYPE = WINIT + 114
60590 '
60680 ' Do NOT change the BLOAD offset!
60690 '
60700 BLOAD "b-win20i.bin", 0 'offset of zero
60710 '
60720 ' WINIT MUST be called before any other windowing functions
60730 '
60740 CALL WINIT (WSTATUS%)
60750 IF WSTATUS% <> 1 THEN PRINT "Windowing initialization error":STOP
60760 '
60770 RETURN 'End of windowing initialization