10 REM CBM 64 DEMONSTRATION PROGRAM
15 TS=3
20 POKE56323,255:BL=53280:SL=BL+1
30 VC=13*4096:SS=VC+4*256:POKESS+4,0:POKESS+11,0:POKESS+18,0:POKESS+24,15
40 SP$=""
50 CD$=""
60 DZ=1000
70 CN=13*4096+8*256:REM COLOUR RAM
80 LC=826:
90 READD:IFD<0THEN110
100 POKELC,D:LC=LC+1:GOTO90
110 FORA=0TO62:READD:POKE2048+A,D:NEXT
120 FORA=0TO62:READD:POKE2112+A,D:NEXT
130 FORA=0TO62:READD:POKE2176+A,D:NEXT
140 FORA=0TO62:POKE2240+A,0:NEXT
150 FORA=0TO7:POKE2040+A,35:NEXT
320 POKESS+5,9:POKESS+12,9:POKESS+20,9:SP=0:BK=32:CL=6:X=255:Y=240:EX=1:EY=1
400 DEF FNA(Q)=255−(2↑Q)
410 DEF FNO(Q)=(2↑Q)
420 DEF FNL(Q)=PEEK(VC+Q)
430 DEF FNLO(Q)=PEEK(29175+Q)
440 DEF FNHI(Q)=PEEK(29078+Q)
500 SC=1:BC=1:GOSUB10210:PRINT"";:GOSUB600:GOSUB10050:GOSUB9000
510 Z=22:Z$="":GOSUB10000
520 GOSUB700:GOSUB10100
540 PRINT"":GOTO1000
600 REM NEW PRODUCT LAUNCH
610 POKESS+4,0:POKESS+11,0:POKESS+18,0:POKESS+6,0:POKESS+13,0:POKESS+20,0
620 POKESS+5,13:POKESS+12,13:POKESS+20,13:SP=0:BK=32:CL=6:X=255:Y=240:EX=1:EY=1
621 POKESS,18:POKESS+7,18:POKESS+14,18
622 POKESS+1,10:POKESS+8,10:POKESS+15,10
630 GOSUB2300:POKESS+4,129:POKESS+11,129:POKESS+18,129
640 FORL=240TO0STEP−.7:POKEVC,L:POKEVC+1,L:NEXT:POKEVC+21,0
660 SP=0:BK=32:CL=2:X=255:Y=240:EX=0:EY=0:GOSUB2300
670 FORY=240TO0STEP−.7:POKEVC+1,Y:POKEVC,240−Y:NEXT:POKEVC+21,0
680 POKESS+4,0:POKESS+11,0:POKESS+18,0:RETURN
700 REM FANFARE2
710 POKESS+12,0:POKESS+13,240:POKESS+19,4:POKESS+20,2*16
715 POKESS+5,0:POKESS+6,240:POKESS+4,0:POKESS+11,0:POKESS+18,0
720 POKESS,32:POKESS+1,12:POKESS+7,32:POKESS+8,12:POKESS+14,32:POKESS+15,12
730 POKESS+24,15:FORM=1TO8STEP7:POKESS+4,33:POKESS+11,33:POKESS+18,129
740 FORA=1TO100*M:NEXT:POKESS+4,0:POKESS+11,0:POKESS+18,0:FORA=1TO40:NEXT:NEXT
750 POKESS+4,0:POKESS+11,0:POKESS+18,0:POKESS,0:POKESS+1,0:POKESS+7,0:POKESS+8,0
760 POKESS+14,0:POKESS+15,0:RETURN
1000 WN=1:SC=6:BC=3:GOSUB10210:Z=1:Z$="":GOSUB10000
1010 Z=3:Z$="":GOSUB10000:GOSUB10040
1020 PRINT"":Z=6:Z$="":GOSUB10000:GOSUB11000
1030 Z=7:Z$="":GOSUB10000:GOSUB11100
1040 PRINT"":Z=9:Z$="":GOSUB10000:GOSUB10200:GOSUB10210
1050 PRINT"":Z=11:Z$="":GOSUB10000:GOSUB10300
1055 PRINT""
1060 GOSUB10210:Z=13:Z$="":GOSUB10000:GOSUB11200
1070 PRINT"":Z=15:Z$="":GOSUB10000
1075 Z=16:Z$="":GOSUB10000:GOSUB1100
1080 PRINT"":Z=18:Z$="":GOSUB10000
1085 Z=19:Z$="":GOSUB10000:GOSUB10100
1090 Z=21:Z$="":GOSUB10000
1091 Z=22:Z$="":GOSUB10000
1095 DZ=3000:GOSUB10100:GOTO2000
1100 REM PLAY A SCALE
1105 POKESS+4,0:POKESS+11,0:POKESS+18,0
1110 POKESS+24,15:POKESS+5,168:POKESS+6,169:POKESS,0:POKESS+1,0
1120 V1=48:V2=36:V3=24:POKESS+12,168:POKESS+13,169:POKESS+19,168:POKESS+20,169
1121 POKESS+4,33:POKESS+11,33:POKESS+18,33
1125 IFV1>=48ANDV1<96THENPOKESS,FNLO(V1):POKESS+1,FNHI(V1)
1126 IFV2>=48ANDV2<96THENPOKESS+7,FNLO(V2):POKESS+8,FNHI(V2)
1127 IFV3>=48ANDV3<96THENPOKESS+14,FNLO(V3):POKESS+15,FNHI(V3)
1128 V1=V1+1:V2=V2+1:V3=V3+1:IFV3<96THEN1125
1130 FORA=0TO500:NEXT:POKESS+4,0:POKE+11,0:POKESS+18,0:POKESS+23,0:RETURN
2000 POKESS+4,0:REM SPRITE /MOBS
2005 SW=826:CW=3*256+7*16+10
2010 WN=0:PRINT"":BC=2:SC=15:GOSUB10210
2020 GOSUB8000:SYSCW:FORA=0TO4:FORB=0TO39:C=A+8:IFA=0THENC=0
2021 POKECN+40*A+B,C:NEXT:NEXT
2030 GOSUB10040:PRINT"":Z=5:Z$="":GOSUB10000
2040 SYSSW:SYSSW
2050 Z$="":GOSUB10000
2060 SYSSW:SYSSW
2070 Z$="":GOSUB10000:GOSUB2410
2080 SYS SW:SYS SW:Z$="":GOSUB10000
2090 GOSUB2700: REM *** MOVE SPRITE ONE OVER
2100 SYS SW:SYSSW:Z$=""
2110 GOSUB2420:GOSUB10000:GOSUB2730:REM *** SPRITE 2 ON FIRST
2120 GOSUB2430:SYS CW:Z$="":GOSUB10000
2130 SP=3:SYSSW:SYSSW:Z$="":GOSUB10000:GOSUB2360:REM EX
2140 Z$="":GOSUB10000:Z$="":GOSUB10000:GOSUB2370:REM EXPAND Y
2150 Z$="":GOSUB10000:GOSUB2380:REM EXPAND B
2160 SYS CW:Z$="":GOSUB10000
2165 SP=3:FORCL=16TO0STEP−1:GOSUB2390:DZ=500:GOSUB10100:NEXT:DZ=2000
2166 SP=0:CL=6:GOSUB2390:SP=2:CL=1:GOSUB2390
2170 SYSSW:SYSSW:Z$="":GOSUB10000
2175 POKEVC+21,FNL(21)ANDFNA(3):POKE2043,35:GOSUB2800: REM *** MOBMIX
2180 SYSCW:Z$="":GOSUB10000
2185 SYSCW:Z$="":GOSUB10000
2190 SYS SW:SYS SW
2200 Z$="":GOSUB10000:GOSUB2900:SYSSW:SYSSW
2210 Z$="":GOSUB10000:GOSUB2950:REM MOVIT
2220 SYS CW
2230 POKEVC+21,0:DZ=1000:GOTO3000
2300 REM SPRITE SWITCH ON
2310 VN=FNO(SP):VF=FNA(SP):SX=2*SP:SY=SX+1 :REM SETUP VALUES
2320 POKE2040+SP,BK:POKEVC+39+SP,CL:POKEVC+SX,X:POKEVC+SY,Y
2330 POKEVC+27,FNL(27)ANDVF:IFPR=1THENPOKEVC+27,FNL(27)ORVN
2340 POKEVC+29,FNL(29)ANDVF:IFEX=1THENPOKEVC+29,FNL(29)ORVN
2350 POKEVC+23,FNL(23)ANDVF:IFEY=1THENPOKEVC+23,FNL(23)ORVN
2355 POKEVC+21,FNL(21)ORVN:RETURN
2360 REM EXPAND IN X
2363 POKEVC+29,FNL(29)ORFNO(SP):DZ=2000:GOSUB10100
2365 POKEVC+29,FNL(29)ANDFNA(SP):RETURN
2370 REM EXPAND IN Y
2373 POKEVC+23,FNL(23)ORFNO(SP):DZ=2000:GOSUB10100
2375 POKEVC+23,FNL(23)ANDFNA(SP):RETURN
2380 REM EXPAND BOTH
2383 POKEVC+23,FNL(23)ORFNO(SP):POKEVC+29,FNL(29)ORFNO(SP):DZ=2000:GOSUB10100
2385 POKEVC+23,FNL(23)ANDFNA(SP):POKEVC+29,FNL(29)ANDFNA(SP):RETURN
2390 POKEVC+39+SP,CL:RETURN:REM SET COLOUR
2400 REM SPRITE SELECT BANK
2410 SP=0:BK=32:CL=0:X=255:Y=70:PR=0:EX=0:EY=0:GOSUB2300:RETURN
2420 SP=2:BK=33:CL=0:X=255:Y=70:PR=1:EX=0:EY=0:GOSUB2300:RETURN
2430 SP=3:BK=33:CL=0:X=100:Y=70:PR=0:EX=0:EY=0:GOSUB2300:RETURN
2700 REM MOVE1
2710 Y=FNL(1):FORX=FNL(0)TO25STEP−1:POKEVC,X:Y=Y+1:POKEVC+1,Y:IFY>190THENY=190
2720 NEXT:FORY=190TO85STEP−.2:POKEVC+1,Y:NEXT:POKEVC+27,FNL(27)ORFNO(0):RETURN
2730 REM MOVE2
2735 Y=FNL(5):FORX=FNL(4)TO25STEP−1:POKEVC+4,X:Y=Y+1:POKEVC+5,Y:IFY>120THENY=120
2740 NEXT:FORY=121TO190STEP.4:POKEVC+5,Y:NEXT
2750 FORX=25TO172STEP.2:POKEVC+4,X:NEXT
2760 FORY=190TO173STEP−.2::POKEVC+5,Y:NEXT
2770 POKEVC+27,FNL(27)ANDFNA(2):RETURN
2800 REM MOVE BOTH
2810 X0=FNL(0):Y0=FNL(1):X2=FNL(4):Y2=FNL(5)
2820 FORY=Y2TO255STEP.2:POKEVC+5,Y:NEXT:FORY=Y0TO190STEP.3:POKEVC+1,Y:NEXT
2830 FORX=X0TO100STEP.2:POKEVC,X:NEXT:POKEVC+16,4:POKEVC+4,100:POKEVC+5,90
2835 FORX=FNL(4)TO0STEP−.5:POKEVC+4,X:NEXT:POKEVC+16,0:POKEVC+4,255
2836 FORX=FNL(4)TO100STEP−.5:POKEVC+4,X:NEXT
2840 FORY=FNL(1)TO0STEP−.3:POKEVC+1,Y:NEXT:FORX=FNL(4)TO255STEP.4:POKEVC+4,X
2850 NEXT:RETURN
2900 REM SPRITE - SPRITE
2910 POKEVC+30,0:FORY=FNL(1)TOFNL(5)STEP.3:POKEVC+1,Y:NEXT:X=FNL(0)
2920 X=X+1.2:POKEVC,X:IFFNL(30)=0THEN2920
2921 POKESS+5,12:POKESS+6,0:POKESS,193:POKESS+1,30
2922 POKESS+4,129
2930 FORCL=32TO0STEP−1:SP=0:GOSUB2390:NEXT:CL=2:GOSUB2390:POKE2040,34
2940 FORY=FNL(1)TO220:POKEVC+1,Y:NEXT:POKE2040,35:POKEVC+21,FNO(2)
2945 RETURN
2950 REM SPRITE - BACKGROUND
2951 FORX=FNL(4)TO79STEP−.3:POKEVC+4,X:NEXT:POKESS+4,0:POKESS,18:POKESS+1,10
2952 X=FNL(4)−1:IFX=0THENRETURN
2955 POKEVC+4,X:POKEVC+31,0:IFFNL(5)=0THENRETURN
2960 POKEVC+31,0:IFFNL(31)ANDFNA(2)=0THEN2952
2970 POKESS+4,129:POKEVC+41,FNL(41)+1AND15:POKEVC+5,FNL(5)−2:GOTO2955
2980 REM STOP
3000 POKE782,115:POKE780,TS:SYS7*4096:REM TUNE ON ... MUSIC DETAILS
3010 PRINT"":SC=10:BC=2:GOSUB10210
3015 WN=1:REM *** FADE IN TUNE
3020 GOSUB10050:PRINT"":Z=1:Z$="":GOSUB10000
3030 Z=3:Z$="":GOSUB10000:GOSUB10040:GOSUB10100
3040 Z=6:PRINT"":Z$="":GOSUB10000
3050 Z=8:PRINT"":Z$="":GOSUB10000
3060 Z=10:PRINT"":Z$="":GOSUB10000
3070 Z=12:PRINT"":Z$="":GOSUB10000
3080 Z=13:Z$="":GOSUB10000
3090 Z=14:Z$="":GOSUB10000
3100 Z=15:Z$="":GOSUB10000
3110 Z=17:PRINT"":Z$="":GOSUB10000
3120 Z=18:Z$="":GOSUB10000:Z=19:Z$="":GOSUB10000
3130 Z=20:Z$="":GOSUB10000:Z$=""
3140 Z=21:GOSUB10000:DZ=1500:GOSUB10100
3150 GOTO4000
4000 REM MORE INFO
4010 SC=0:BC=0:GOSUB10210:GOSUB10050 REM ALL BLACK
4020 PRINT"":Z=1:Z$="":GOSUB10000
4030 Z=3:Z$="":GOSUB10000
4040 REM Z=5:Z$="":GOSUB10000:GOSUB10040
4050 PRINT"":Z=8:Z$="":GOSUB10000:GOSUB10050
4060 Z=9:Z$="":GOSUB10000
4070 Z=10:Z$="":GOSUB10000
4080 Z=11:Z$="":GOSUB10000:GOSUB10040
4090 Z=13:PRINT"":Z$="":GOSUB10000:GOSUB10050
4100 Z=14:Z$="":GOSUB10000
4110 Z=15:Z$="":GOSUB10000
4120 REM Z=16:Z$="":GOSUB10000:GOSUB10040
4130 Z=18:PRINT"":Z$="":GOSUB10000:GOSUB10050
4140 Z=19:Z$="":GOSUB10000
4150 Z=20:Z$="":GOSUB10000
4160 REMZ=21:Z$="":GOSUB10000
4170 Z=23:Z$="":GOSUB10000:DZ=3000:GOSUB10100:PRINT""
4180 BC=7:SC=7:GOSUB10210
4190 PRINT"":Z=1:Z$="":GOSUB10000:GOSUB10040
4200 PRINT"":Z=3:Z$="":GOSUB10000
4210 REM Z=4:Z$="":GOSUB10000
4220 Z=6:Z$="":GOSUB10000
4230 Z=8:Z$="":GOSUB10000
4240 Z=10:Z$="":GOSUB10000
4250 REM Z=12:Z$="":GOSUB10000
4260 REM Z=13:Z$="":GOSUB10000
4270 Z=14:Z$="":GOSUB10000
4280 Z=16:Z$="":GOSUB10000
4290 Z=18:Z$="":GOSUB10000
4300 Z=19:Z$="":GOSUB10000
4310 Z=20:Z$="":GOSUB10000
4320 Z=22:Z$="":GOSUB10000
4330 DZ=2000:GOSUB10100
4340 SC=3:BC=3:PRINT"":GOSUB10210
4350 GOSUB10050:Z=1:Z$="":GOSUB10000:GOSUB10040
4390 Z=1:PRINT"";:Z$="":GOSUB10050:GOSUB10000
4400 Z=12:Z$="":GOSUB10000
4410 Z=14:Z$="":GOSUB10000:DZ=4000
4420 REMZ=16:Z$="":GOSUB10000:GOSUB10100
4430 REMZ=24:PRINT"":Z$="":GOSUB10070
4440 DZ=500:GOSUB10100:GOTO500
8000 REM PICTURE
8010 B1$=""
8020 B1$=B1$+""
8030 B1$=B1$+""
8040 B2$=""
8050 B2$=B2$+""
8060 B2$=B2$+""
8070 B2$=B2$+""
8080 B3$=""
8090 B3$=B3$+""
8100 B3$=B3$+""
8980 FORA=0TO39:POKE1984+A,160:POKECN+24*40+A,9:NEXT
8990 PRINTB1$;B2$;B3$;""
8999 RETURN
9000 REM LOGO
9010 PRINT""
9020 PRINT""
9030 PRINT""
9040 PRINT""
9050 PRINT""
9060 PRINT""
9070 PRINT""
9080 PRINT""
9090 PRINT""
9100 PRINT""
9110 PRINT""
9120 PRINT""
9130 PRINT""
9140 PRINT""
9150 PRINT""
9160 PRINT""
9170 PRINT""
9180 PRINT""
9190 PRINT""
9200 PRINT""
9210 PRINT"":RETURN
10000 IFFO=1THENZ$=LEFT$(""+Z$+SP$,40):GOTO10030
10010 IFFO=3THENZ$=RIGHT$(SP$+Z$,40):GOTO10030
10020 LN=LEN(Z$):L=INT((40−LN)/2):Z$=LEFT$(SP$,L)+Z$+LEFT$(SP$,L)
10030 PRINTLEFT$(CD$,Z+WN);:FORA=1TO40:PRINTMID$(Z$,A,1);:FORB=1TO10:NEXTB,A
10035 RETURN
10040 FO=1:RETURN
10050 FO=2:RETURN
10060 FO=3:RETURN
10070 PRINTLEFT$(CD$,Z);:FORA=1TOLEN(Z$):PRINTMID$(Z$,A,1);:FORB=1TO10
10075 NEXTB,A:RETURN
10100 FORDL=0TODZ:NEXT:RETURN
10200 FORA=0TO15:POKEBL,A:FORB=0TO300:NEXT:NEXT:RETURN
10210 POKEBL,BC:POKESL,SC:RETURN
10300 FORA=0TO15:POKESL,A:FORB=0TO300:NEXT:NEXT:RETURN
11000 REM DISPLAY 40 COLUMNS
11010 S$="":Z$=S$+""+S$+""+S$+""+S$+"":Z=Z+3
11020 GOSUB10070
11030 S$="":Z$=S$+""+S$+""+S$+""+S$+""
11040 GOSUB10100:GOSUB10070
11050 RETURN
11100 REM DISPLAY 25 LINES
11110 PRINT"":FORA=1TO25:PRINTLEFT$(CD$,A);RIGHT$(""+STR$(A),4);
11120 FORB=1TO10:NEXT:NEXT:DZ=500:GOSUB10100:DZ=1500
11130 PRINT"":FORA=1TO25:PRINTLEFT$(CD$,A);"";:FORB=1TO10:NEXT:NEXT
11140 PRINT"";:RETURN
11200 REM DISPLAY 1 CHARACTER IN 16 COLOURS
11210 Z$="":Z=Z+2:GOSUB10070
11220 GOSUB10100
11230 Z$="":GOSUB10070
11240 PRINT"":RETURN
39000 REM MACHINE CODE DATA
39010 DATA 32,148,3,24,169,0,133,4,105,40,133,2,169,4,133,5,105,0,133
39020 DATA 3,162,3,160,39,177,2,145,4,136,16,249,24,165,2,133
39030 DATA 4,105,40,133,2,165,3,133,5,105,0,133,3,202,16,227
39040 DATA 160,39,169,32,145,4,136,16,251,32,160,3,96
39050 DATA 32,148,3,169,0,133,4,169,4,133,5,160,199,169,32,145,4,136,192
39060 DATA 255,208,249,32,160,3,96
39070 DATA 120,162,3,181,2,157,172,3,202,16,248,96
39080 DATA 162,3,189,172,3,149,2,202,16,248,88,96,0,0,0,0,0,-1
40000 REM SPRITE 1 DATA
40010 DATA 0,60,0,0,126,0,0,255,0,1,255,128,3,195,192,7,217,224
40020 DATA 7,223,224,7,217,224,3,195,192,1,255,128,0,255,0,0,255,0
40030 DATA 1,255,128,1,255,128,1,255,128,1,189,128,3,24,192,6,24,96
40040 DATA 12,0,48,28,0,56,62,0,124
40100 REM SPRITE 2 DATA
40110 DATA 16,0,8,32,0,4,64,0,2,64,24,2,32,60,4,16,102,8,8,231,16,5,36,160
40120 DATA 2,126,64,4,153,32,8,153,16,23,153,232,40,36,20,63,255,252
40130 DATA 127,231,254,124,24,63,127,195,254,63,231,252,62,255,124
40140 DATA28,126,56,4,126,32
40200 REM SPRITE 3 DATA
40210 DATA 91,1,113,161,0,130,65,65,4,32,227,136,19,247,240,15,255,224
40220 DATA15,255,192,15,255,248,31,255,252,63,223,248,63,255,126
40230 DATA 63,255,252,63,191,254,31,255,252,15
40240 DATA 255,248,11,239,240,3,255,248,7,255,240,3,255,224,1,3,255,192,0
40250 DATA
READY.