home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Antic Magazine 1987 May
/
Antic_Magazine_1987_05_Antic_Side_B.atr
/
towers.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
10KB
|
375 lines
1000 '
1010 'Antic Towers
1020 '(c) 1987 Antic Publishing V. 010487
1030 'Written by Steve Everman & Paul Pratt
1040 '
1050 '----------------------------------------
1060 A$=chr$(0)+chr$(0)+chr$(0)+chr$(0): BELL$=chr$( 7 )
1070 A=varptr( A$ ): A1=int( A/65536 ): A2=A-( A1*65536 )
1080 randomize 0
1090 HANDLE=2: EXIT=2: TRUE=1: FALSE=( not TRUE )
1100 GRAF.MKSTATE=79: FORM.ALERT=52: WIND.SET=105
1110 '
1120 A#=GB
1130 CONTROL=peek( A# )
1140 GINTOUT=peek( A#+12 )
1150 GINTIN=peek( A#+8 )
1160 dim STACK( 3, 9 ),KOL%( 16 )
1170 gosub SET.PALETTE
1180 fullw 2: clearw 2
1190 if peek( SYSTAB )<>4 then gosub WARNING
1200 if peek( SYSTAB )<>4 then gosub ALERTBOX
1210 if CHOICE=EXIT then end
1220 gotoxy 0,0: print BELL$;: color 1,0,0
1230 for X=0 to 20
1240 gosub POLYLINE
1250 next X
1260 gosub ED.BOX: gosub FIND.HI
1270 OLD.DISK=NUMDISK
1280 gosub SET.ARRAY: gosub SCREEN.SET.UP
1290 gotoxy 14,2: print "[ READY ]"
1300 '
1310 '----------------------------
1320 MAIN:
1330 gosub GET.MOUSE
1340 while NEW.PRESS <>3
1350 gosub GET.MOUSE
1360 gosub SHOW
1370 while STACK( 2,8-NUMDISK )=0 and STACK( 3,8-NUMDISK )=0
1380 gosub GET.MOUSE
1390 if NEW.PRESS=1 and FALL=1 and INAIR=0 then gosub PULL
1400 if NEW.PRESS=1 and FALL=1 and INAIR>0 then gosub DOWN
1410 wend
1420 gosub REWARD
1430 gosub NEW.GAME
1440 wend
1450 color 5
1460 end
1470 '
1480 '------------------------
1490 FIND.HI:
1500 color 10: gotoxy 5,1: print "How many disks do you want?"
1510 R=4: gosub REVERSE: color 11
1520 for X=0 to 6
1530 S$=chr$( 32 )+chr$( 49+X )+chr$( 32 )
1540 gotoxy 4+X*4,3: print S$
1550 next X
1560 gotoxy 15,5: print "EXIT"
1570 R=1: gosub REVERSE: color 1
1580 while NEW.PRESS<>1 or MX>277 or MX <30 or MY>65 or MY<40
1590 gosub GET.MOUSE
1600 X.CHECK=FALSE: Y.CHECK=FALSE
1610 if MX>135 and MX<168 then X.CHECK=TRUE
1620 if MY>68 and MY<77 then Y.CHECK=TRUE
1630 if NEW.PRESS and X.CHECK and Y.CHECK then end
1640 wend
1650 gosub HIDE
1660 for X=1 to 5
1670 gotoxy 2,X: print " "
1680 next
1690 gosub SHOW: NUMDISK=int(( MX+8 )/36 )
1700 return
1710 '
1720 '----------------------------------
1730 FIND.TOP:
1740 gosub GET.MOUSE
1750 SOURCEX=154: DISK.POLE=2
1760 if MX>199 then SOURCEX=246: DISK.POLE=3
1770 if MX<107 then SOURCEX=62: DISK.POLE=1
1780 for Y=1 to 8
1790 if STACK( DISK.POLE,Y-1 )=0 then TOP=Y
1800 next Y
1810 return
1820 '
1830 '----------------------------------
1840 PULL:
1850 gosub FIND.TOP: if TOP>7 then return
1860 INAIR=STACK( DISK.POLE, TOP )
1870 '
1880 PULL.UP:
1890 gosub HIDE
1900 X1=SOURCEX-40: X2=SOURCEX+40
1910 Y1=87+TOP*11: Y2=Y1+10
1920 XD1=115: XD2=195: YD1=40: YD2=50
1930 gosub VRO.COPYFORM
1940 XD1=X1: XD2=X2: YD1=Y1: YD2=Y2
1950 X1=22: X2=102: Y1=87: Y2=97
1960 gosub VRO.COPYFORM: gosub SHOW
1970 STACK( DISK.POLE, TOP )=0
1980 return
1990 '
2000 '----------------------------------
2010 DOWN:
2020 gosub FIND.TOP
2030 if INAIR > STACK( DISK.POLE, TOP ) then return
2040 '
2050 PUT.DOWN:
2060 gosub HIDE
2070 X1=115: X2=195: Y1=40: Y2=50
2080 XD1=SOURCEX-40: XD2=SOURCEX+40
2090 YD1=76+TOP*11: YD2=YD1+10
2100 OLD.DISK=NUMDISK
2110 gosub VRO.COPYFORM
2120 gosub SHOW
2130 STACK( DISK.POLE, TOP-1 )=INAIR
2140 '
2150 ERRASE:
2160 X1=15: X2=95: Y1=55: Y2=65
2170 XD1=115: XD2=195: YD1=40: YD2=50
2180 gosub VRO.COPYFORM
2190 INAIR=0: print BELL$;
2200 return
2210 '
2220 '---------------------------------
2230 NEW.GAME:
2240 gosub FIND.HI
2250 gosub SET.ARRAY
2260 if NUMDISK>OLD.DISK then gosub SEE.DISKS
2270 while NUMDISK<OLD.DISK
2280 TOP=TOP+1
2290 gosub PULL.UP
2300 gotoxy 0,0
2310 for D=0 to 350: next D
2320 gosub ERRASE
2330 OLD.DISK=OLD.DISK-1
2340 wend
2350 gotoxy 14,2: print "[ READY ]"
2360 return
2370 '
2380 '------------------------------
2390 SET.ARRAY:
2400 for X=0 to 8
2410 STACK( 1, X )=X*10
2420 STACK( 2, X )=0
2430 STACK( 3, X )=0
2440 next X
2450 for Y=0 to 7-NUMDISK
2460 STACK( 1, Y )=0
2470 next Y
2480 for X=0 to 3
2490 STACK( X, 8 )=80
2500 next X
2510 return
2520 '
2530 '-------------------------------
2540 SCREEN.SET.UP:
2550 gosub HIDE
2560 FC=10: gosub FILCOL
2570 X1=8: Y1=175: X2=300: Y2=188
2580 gosub DISK
2590 Y1=80: Y2=180
2600 for X1=59 to 265 step 92
2610 X2=X1+6
2620 gosub DISK
2630 next X1
2640 '
2650 SEE.DISKS:
2660 Y1=164: Y2=174
2670 for Y=7 to 8-NUMDISK step -1
2680 gosub DRAW.DISK
2690 next Y
2700 return
2710 '
2720 '-------------------------------
2730 DRAW.DISK:
2740 gotoxy 0, 0: print BELL$;
2750 FC=1+STACK( 1, Y )/10: gosub FILCOL
2760 X1=57-( STACK( 1, Y )/2 )
2770 X2=X1+STACK( 1, Y )+10
2780 gosub DISK
2790 Y1=Y1-11: Y2=Y2-11
2800 return
2810 '
2820 '-------------------------------
2830 REWARD:
2840 for Y=NUMDISK-1 to 0 step -1
2850 color TOP+Y: gotoxy 10,1: print "CONGRATULATIONS"
2860 for X=0 to 7
2870 print BELL$;
2880 for D=0 to 100: next D
2890 next X
2900 color 1
2910 next Y
2920 gotoxy 10,1: print " "
2930 '
2940 MOVE.BACK:
2950 SX=SOURCEX
2960 for TOP=7 to 8-NUMDISK step -1
2970 for Q=1 to 6
2980 gosub ROTATE
2990 sound 1, 2+Q*2, 1, Q, 2
3000 next Q
3010 SOURCEX=SX: gosub PULL.UP: TOP=TOP+1
3020 for Q=1 to 6
3030 gosub ROTATE
3040 sound 1, 16-Q*2, 1, 7-Q, 2
3050 next Q
3060 SOURCEX=62: gosub PUT.DOWN: TOP=TOP-1
3070 next TOP
3080 sound 0, 0, 0, 0, 0: gosub SET.PALETTE
3090 return
3100 '
3110 '----------------------------------
3120 ROTATE:
3130 HOLD=KOL%( 1 )
3140 for X=1 to 7
3150 KOL%( X )=KOL%( X+1 )
3160 next X
3170 KOL%( 7 )=HOLD
3180 defdbl C: C=1114
3190 poke C,varptr( KOL%( 0 ))
3200 return
3210 '
3220 '------------------------------------
3230 SET.PALETTE:
3240 restore COLOR.PALETTE
3250 for ENTRY=0 to 15
3260 read PALETTE.COLOR
3270 KOL%( ENTRY )=PALETTE.COLOR
3280 next ENTRY
3290 '
3300 COLOR.PALETTE:
3310 data 1911,1792,1856,85,1904,7
3320 data 80,1285,0,0,785,0
3330 data 0,0,0,785,1074
3340 '
3350 defdbl C: C=1114
3360 poke C,varptr( KOL%( 0 ))
3370 return
3380 '
3390 '-------------------------------------
3400 GET.MOUSE:
3410 gemsys( GRAF.MKSTATE )
3420 MX=peek( GINTOUT+2 )
3430 MY=peek( GINTOUT+4 )
3440 NEW.PRESS=peek( GINTOUT+6 )
3450 if OLD.PRESS<>NEW.PRESS then FALL=1 else FALL=0
3460 OLD.PRESS=NEW.PRESS
3470 return
3480 '
3490 '-------------------------------------
3500 VRO.COPYFORM:
3510 poke CONTRL,109
3520 poke CONTRL+2,4
3530 poke CONTRL+6,1
3540 poke CONTRL+12,HANDLE
3550 poke CONTRL+14,A1
3560 poke CONTRL+16,A2
3570 poke CONTRL+18,A1
3580 poke CONTRL+20,A2
3590 poke INTIN,3
3600 poke PTSIN,X1
3610 poke PTSIN+2,Y1
3620 poke PTSIN+4,X2
3630 poke PTSIN+6,Y2
3640 poke PTSIN+8,XD1
3650 poke PTSIN+10,YD1
3660 poke PTSIN+12,XD2
3670 poke PTSIN+14,YD2
3680 vdisys( 0 )
3690 return
3700 '
3710 '-------------------------------------
3720 HIDE:
3730 poke CONTRL,123
3740 poke CONTRL+2,0
3750 poke CONTRL+6,0
3760 poke CONTRL+12,HANDLE
3770 vdisys( 0 )
3780 return
3790 '
3800 '-------------------------------------
3810 SHOW:
3820 poke CONTRL,122
3830 poke CONTRL+2,0
3840 poke CONTRL+6,1
3850 poke CONTRL+12,HANDLE
3860 poke INTIN,1
3870 vdisys( 0 )
3880 return
3890 '
3900 '-------------------------------------
3910 ALERTBOX:
3920 ADDRIN=peek( A#+16 )
3930 B#=ADDRIN
3940 poke GINTIN,0
3950 TEXT$=TEXT$+chr$( 0 )+chr$( 0 )
3960 poke B#,varptr( TEXT$ )
3970 gemsys( FORM.ALERT )
3980 CHOICE=peek( GINTOUT )
3990 return
4000 '
4010 '----------------------------------
4020 WARNING:
4030 TEXT$="[0][|This program works best |"
4040 TEXT$=TEXT$+" in LOW resolution. |]"
4050 TEXT$=TEXT$+"[ Run | EXIT ]"
4060 return
4070 '
4080 '---------------------------------
4090 ED.BOX:
4100 REPLACE$=" "+chr$( 127 )+" Antic Towers "
4110 REPLACE$=REPLACE$+chr$( 127 )+" "+chr$( 0 )
4120 poke GINTIN+0,peek( SYSTAB+8 )
4130 C#=GINTIN+4: poke GINTIN+2,2
4140 poke C#,varptr( REPLACE$ )
4150 gemsys( WIND.SET )
4160 return
4170 '
4180 '----------------------------------
4190 REVERSE:
4200 poke CONTRL,32
4210 poke CONTRL+2,0
4220 poke CONTRL+6,1
4230 poke CONTRL+12,HANDLE
4240 poke INTIN,R
4250 vdisys( 1 )
4260 return
4270 '
4280 '----------------------------------
4290 POLYLINE:
4300 poke CONTRL,6
4310 poke CONTRL+2,6
4320 poke CONTRL+4,0
4330 poke CONTRL+12,HANDLE
4340 poke PTSIN,0+X
4350 poke PTSIN+2,0+X
4360 poke PTSIN+4,639-X
4370 poke PTSIN+6,0+X
4380 poke PTSIN+8,639-X
4390 poke PTSIN+10,199-X
4400 poke PTSIN+12,0+X
4410 poke PTSIN+14,199-X
4420 poke PTSIN+16,0+X
4430 poke PTSIN+18,0+X
4440 vdisys( 1 )
4450 return
4460 '
4470 '------------------------------------
4480 DISK:
4490 poke CONTRL,11
4500 poke CONTRL+2,2
4510 poke CONTRL+6,0
4520 poke CONTRL+10,9
4530 poke CONTRL+12,2
4540 poke PTSIN,X1
4550 poke PTSIN+2,Y1
4560 poke PTSIN+4,X2
4570 poke PTSIN+6,Y2
4580 vdisys( 0 )
4590 return
4600 '
4610 '-----------------------------------
4620 FILCOL:
4630 poke CONTRL,25
4640 poke CONTRL+2,0
4650 poke CONTRL+6,1
4660 poke CONTRL+12,2
4670 poke INTIN,FC
4680 vdisys( 0 )
4690 return