rem --- GATECRASHER II AWESOME MIX! (Incredible soundtracks) slow version rem --- BASIC PROGRAM for the SuperCharger and Atari Flashback rem --- This Atari 2600 Game program can be compiled for SuperCharger or CBS RAM formats rem --- SuperCharger BASIC and Atari Flashback BASIC are cross compatible, this program rem --- requires no changes to compile into either format. rem --- Desc: GATE Crasher at a relaxed pace with a goal and motivational scoring system rem --- Sound: Awesome Synth Soundtracks using the tracker sequencer and the algorithm together rem --- Goal: Make it through 96 gates to win an unlock the extended ending scene demo! rem -- Slower remix - this is a relaxing video game now! (not twitch response) rem -- 20181201 Enhancement - variable ramp up and music AI (part tracker part algorythm) rem -- using f (apparently unused!) rem Controls: rem --- Joystick controls ship rem --- BW - toggles Motion Blur Reduction on cut scenes rem ---init section, runs once: ------------- gosub moveinit rem ---gameloop subroutine, runs every frame: --- rem BYTErowoffset=120 if z=1 then t=1-t: goto 0 if g=2 then goto top_message t=1-t:rem toggle rem --- check for Winner rem if player0y<3 then CXCLR=0:g=2:for i=0 to 255:AUDF0=i:AUDV0=i:next i:BYTErowoffset=0:py=player0y:gosub setmsg:goto top_message rem -- difficulty doubler - leave this intact and make sure t isn't used! :) if SWCHB|%11110111<>255 then scrollvirtualworldtoggle=35:gosub DLI:scrollvirtualworldtoggle=0:goto 0:rem double speed - every frame if t=0 then scrollvirtualworldtoggle=35:gosub DLI:scrollvirtualworldtoggle=0:return: rem run this DLI every other frame 0 if joy0up=1 then player0y=player0y+1 else player0y=player0y-t missile1y=missile1y+t 1 if joy0left=1 then player0x=player0x-1 else player0x=player0x+2 missile0y=missile0y+1 missile1x=missile1x+1:missile0x=missile0x+t:AUDV0=R(l):COLUBK=r:AUDC0=R(l)*4 3 if g=0 then for j=0 to 7:player0(j)=pl(j):player0colors(j)=p2(j):NUSIZ0=%00000000 else goto 5 4 next j:for x=20 to 70 step 10:for y = 0 to 19:vwpixel(x,y,on):next y,x:g=1 5 if e>f then e=0:BITIndex=BITIndex+1:COLUP1=l*10:SUSTAINFORFRAMES=9:AUDC0=0 else e=e+1:return:data pl 240,255,127,240,0,0,0,0 rem f is initially 11, speed/difficulty setting, also affects music AI algorythm component but not the tracker sequencer directly creating interesting remixes at various speeds/levels! 6 if l<20 then l=l+1 else l=0:data p2 $36,$64,$76,$36:data R 3,8,2,0,3,8,8,5,3,0,3,5,8,8,5 x=BITIndex/10 7 if b=0 then x=BITIndex+10:vwpixel(x,R(l)+10,flip):vwpixel(x,R(l)+11,flip):score=score+1:data R2 5,8,5,3,0,2 return clearscreen for i=12 to 239:virtualworld(i)=0:next i return setmsg rem ---- init score msg based on position m=0:bx=0 rem -- superfluous, already 0! if py >=53 then m=0 if score >=7 then m=60 if score >=21 then m=120 if score >=95 then var2=1:m=0 rem gosub setmsg2 rem if m=0 then j=32 else j=m rem for i=0 to 9:rowcolors(i)=j+i:next i NUSIZ0=%11111111 return bottom_message rem ------- MESSAGING SUBSYSTEM (bottom vertical blank) rem can turn messaging back off here: rem queue delay so message isn't instantly stopped if joy0fire=1 and bx=255 then gosub clearscreen:REFP0=0:BITIndex=0:scrollvirtualworldtoggle=1:CXCLR=0:gosub moveinit:z=1:g=0:return t=1-t: rem s=1-s:rem toggle - s was getting set to 4 sometimes (also flag var) 50 if t=1 then scrollvirtualworldtoggle=35:gosub DLI:scrollvirtualworldtoggle=0:gosub linkplayer:return rem if s=1 then scrollvirtualworldtoggle=35:gosub DLI:scrollvirtualworldtoggle=0:vwpixel(70,8,bindplayer0):gosub linkplayer:return if BITIndex=0 and BYTErowoffset=0 and var1=7 then scrollvirtualworldtoggle=1: rem gosub drawlettersonscreen rem player0x=MUSICINDEX:player0y=MUSICINDEX*2 rem s=0 if var1=0 then BITIndex=BITIndex+1 else var1=var1-1 if BITIndex=72 and BYTErowoffset=120 then BITIndex=0:BYTErowoffset=0:var1=7 if BITIndex=72 and BYTErowoffset=0 then BITIndex=0:BYTErowoffset=120 return rem setmsg2 rem return rem ------------------------------------------------------------- drawlettersonscreen rem ------------------------------------------ rem ---variables---- rem ---var1 phrase delay rem ---m = block index rem ---var2 = target block (0 or 1), up to 512 characters, easily expanded rem ---i,j,k,l - loop vars rem ---n = tracker controller rem for i=0 to 239:virtualworld(i)=0 rem sc if i<60 then RAMplayfield(i)=0 rem next i:rem clear virtualworld gosub clearscreen MUSICINDEX=135 rem 20170307 for i=0 to 9:j=i*2:j=j+py:rowcolors(i)=j:j=j-30:player0colors(i)=j:next i if var2=1 then goto jmpmsgtypes rem hmmm... does the line above mean the two below are superfluous? rem if score >= 96 and m>59 then m=0:rem -- loop winner movtivational progress message 3 rem if score >= 96 then goto jmpmsgtypes if score >= 21 and m>179 then m=120:rem -- loop motivational progress message 2 if score >= 21 then goto jmpmsgtypes if score >=7 and m>119 then m=60:rem -- loop movtivational progress message 1 if score<7 and m>59 then m=0 rem -- or fall through to loop default motivational message sans progress (no criteria met) jmpmsgtypes if m=255 then m=0: rem :var2=var2+1:rem next block, first index rem if var2=2 then var2=0:rem only 2 blocks (512 characters) rem if var2=2 then var2=1:rem only repeat block2 (512 characters) v=2 secondpass if v>2 then v=119:rem second pass for bottom of screen for j=20 to 84 step 8:k=j+8 v=v+1:rem starts at 3...goes 9 accross for i=j to k rem replace this with lookup rem l=j-20:l=l+i:l=l-j:rem l=sprites(l) l=m rem if v>119 then l=l+48:rem adjust overlap placement for 2nd pass if var2=0 then l=textdata(l) if var2=1 then l=text2dat(l) if l>60 and l<97 then l=l+32:rem --- filter uppercase gosub getnumber if l=33 then l=i-j:l=sprites2(l):goto handel_exclamation_too : rem handle ! while out of space for chars! if l=32 then l=0 else l=l-97:l=l*8:l=l+i:l=l-j:loadplayer1upsidedown(l):l=player1: rem 20170307 inefficient... AFP l=player1(0): rem l=sprites(l) handel_exclamation_too virtualworld(v)=l v=v+12 next i m=m+1: rem next letter v=v-96:rem 12*8; return to the relative top row v=v-12:rem why? next j if v<122 then m=m-3: goto secondpass rem 20170307 ---- AFP color changes: for i=0 to 17 j=m+i: rem j=j+i rowcolors(i)=j+1 rem player0colors(i)=player0colors(i)+8 next i return getnumber if l=48 then l=111: rem 0 maps to O if l=49 then l=105: rem 1 maps to i if l=56 then l=98: rem 8 maps to B if l=53 then l=115: rem 5 maps to S if l=50 then l=123: rem 2 maps to z+1 if l=51 then l=124: rem 3 maps to z+2 if l=52 then l=125: rem 4 maps to z+3 if l=54 then l=126: rem 6 maps to z+4 if l=55 then l=127: rem 7 maps to z+5 if l=57 then l=128: rem 9 maps to z+6 return data sprites2 %00000000 data sprites2a %00000000 data sprites2b %00001100 data sprites2c %00001100 data sprites2d %00001100 data sprites2e %00000100 data sprites2f %00000000 data sprites2g %00001100 rem --- Message Data can be ASCII codes in BASIC data statements --- rem --- or direct text in the special format shown! :) --- rem data textdata 104,101,108,108,111,32,119,111,114,108,100,32,116,104,105,115,105,115,97,116,101,115,116,111,102,116,104,101,97,116,97,114,105,50,54,48,48,98,105,103,116,101,120,116,115,99,114,111,108,108,101,114,116,104,97,116,114,117,110,115,97,116,54,48,104,122,111,114,51,48,104,122,44,97,110,100,51,48,102,112,115,119,104,105,108,101,114,117,110,110,105,110,103,97,103,97,109,101,97,110,100,112,108,97,121,105,110,103,116,114,97,99,107,101,114,116,117,110,101,115,111,110,115,116,111,99,107,86,67,83,100,111,117,98,108,101,116,114,117,101,100,111,117,98,108,101,116,114,117,101,32,105,115 rem ---- Plain text (easier) can be added directly like this: rem motivational messages with description of use: rem opening and novice level message: data textdata "Gatecrasher IIA" data textdata7 "alternative mix" data textdata8 "Pass 96 Gates!!" data textdata9 "Ready PlayerOne" rem intermediate level progress message: data textdata6 "Great progress!" data textdataB "Level II BASIC!" data textdataC "BOOT camp grad!" data textdatad "Play to qualify" rem advanced progress almost there message: data textdataaa "Super Awesome!!" data textdataa9 "Gatecrasher pro" data textdataa8 "can you do just" data textdataa7 "a fewgates more" rem you know what this is: data textdataa6 "Have you played" data textdataaB "Atari today!msg" data textdataaC "easter-egg fun!" data textdataad "I love writing " data textdataae "BASIC games!U2?" rem extended winner message - 96 GATES! data text2dat "Fantastic Gate " data text2dat9 "Crashing! Youre" data text2dat8 "The last STAR " data text2dat7 "FIGHTER Atari " data text2dat6 "has been search" data text2datB "ing for! You " data text2datC "navigated all96" data text2datd "gates superbly!" data text2data "Pouet SHOUT OUT" data text2dat9a "to all the cool" data text2dat8a "coders making " data text2dat7a "the scene so " data text2datBa "much fun!Thanks" data text2dat6a "to TJOPPEN JAC!" data text2datCa "CLUSTER DMA! GP" data text2datda "TRILOBIT SVOLLI" data text2datea "NOICE!6502!RIOT" rem ASCII translation key: -97 to get 0, * 8 to get index, different for 0123456789 (remapped) rem ----------------------------------------------------------------- rem ----------------------------------------------------------------- 17 rem ---gameloop2 subroutine, runs every frame: -- if z=1 then goto 18 if g=2 then goto bottom_message if SWCHB|%11110111<>255 then scrollvirtualworldtoggle=8:gosub DLI:scrollvirtualworldtoggle=0:goto 18:rem double speed - every frame if t=1 then scrollvirtualworldtoggle=8:gosub DLI:scrollvirtualworldtoggle=0:return: rem run this DLI every other frame 18 rem COLUBK=0 if score>95 then g=2:z=0:gosub setmsg: rem winner rem -- Ramp up game difficulty and create new AI musical themes: if score=20 then f=21:rem medium, new music AI theme from the algorythm if score=30 then f=18:rem hard, new music AI theme from the algorythm if score=40 then f=14:rem really hard if score=50 then f=10:rem experts only, must pass another 46 Gates to win! 8 if CXP0FB=130 or CXM1P>127 or CXM0P>127 then CXCLR=0:g=2:z=0:gosub setmsg:BITIndex=0: rem game over rem -- removing rowcolor animation change - transition too quick here, making it part of the ramp up instead, was: if BITIndex>71 then BITIndex=0 else for j=0 to 9:rowcolors(j)=rowcolors(j)+2:next j:scrollvirtualworldtoggle=1 rem don't like this, reverting to trance inducing color animation... change was: rem f BITIndex>71 then BITIndex=0 else scrollvirtualworldtoggle=1 rem if e=f then for j=0 to 9:rowcolors(j)=rowcolors(j)+2:next j rem cutting transition time in half with 1 increment (already halved in the atari 7 bit palette) was - if BITIndex>71 then BITIndex=0 else for j=0 to 9:rowcolors(j)=rowcolors(j)+2:next j:scrollvirtualworldtoggle=1 9 if BITIndex>71 then BITIndex=0 else for j=0 to 9:rowcolors(j)=rowcolors(j)+1:next j:scrollvirtualworldtoggle=1 return top_message rem ------ MESSAGING SUBSYSTEM (top vertical blank) rem g=0 --- can't turn messaging back off here because the bottom blank code will break... if bx<>255 then bx=bx+1 65 if var1>0 then VBLANK=2:rem disable TIA output while reguaging display 70 if t=1 then scrollvirtualworldtoggle=32:gosub DLI:scrollvirtualworldtoggle=6:scrollvirtualworldtoggle=0:return 77 if SWCHB|%11110111<>255 then VBLANK=2:rem disable TIA output for 30 HZ view with COLOR switch return moveinit f=28:rem 11:rem initial difficulty level affecting speed difficulty and music algorytm AI! z=0 :rem game not in play yet score=0:var2=0 MUSICINDEX=135 g=2 rem --- queue intro scene: gosub 3: g=2:py=77:gosub setmsg rem for i = 0 to 239 rem virtualworld(i)=0:next i rem a=0: gosub loadvirtualworld player0y=50:player0x=52:BYTErowoffset=120 return linkplayer if u=0 then player0y=player0y+2 else player0y=player0y-1 if player0y>96 then u=1 if player0y<8 then u=0 if px=0 then player0x=player0x+2 else player0x=player0x-1 if player0x>140 then px=1:REFP0=255 if player0x<8 then px=0:REFP0=0 rem if player0x>136 then player0x=0:player0y=0 rem if player0x>0 then player1x=player0x+36:player1y=player0y else player1x=0:player1y=0 rem if player1x>136 then player1x=0:player1y=0 player1x=player1x+1:player1y=player1y+2 missile1y=missile1y+3:missile1x=missile1x+1 missile0y=missile0y+2:missile0x=missile0x+1 return 19 rem ---KITCHENSINK subroutine, runs when scrollvirtualworldtoggle=1 if g=2 then gosub drawlettersonscreen: goto skipscore rem goto skipscore rem if score<10 then l=score else l=score/10 rem l=l+48:gosub getnumber: l=l-97:l=l*8:l=l+1 rem loadplayer1(l):player1y=15:player1x=152:COLUP1=100 if score<10 then by=number(score) else by=score/10:by=number(by) loadplayer1(by):player1y=20:player1x=152:COLUP1=rowcolors(3) rem can reuse var2 in this routine with no issues: goto skipscore:rem, scroll score digits if px=0 then goto skipscore if var2>6 then var2=0 for x=var2 to 0 step -1 i=x+1 player1(x)=player1(i):rem player1(i)=0 next x var2=var2+1 rem lookup table for sprite library ASCII characters 0-9: data number 112,64,208,216,224,144,232,240,8,248 skipscore if SWCHB|%11111101=255 then goto skipselect px=1-px:rem toggle cycle colors skipselect if px=0 then goto skip_cyclecolors for i=0 to 9:rowcolors(i)=rowcolors(i)+16:next i skip_cyclecolors rem player0colors $3c,$3c,$3a,$3a,$38,$38,$36,$36 rem rowcolors $72,$62,$52,$54,$56,$46,$44,$42,$42,$46,$44 rem player0colors 100,255,100,100,200,200,200,200 rem rowcolors 30,30,30,30,30,30,30,30,70,30 virtualworld xx..xxxx..x..xxx.x...xxx...x..x.x.x.xxx.x.x.x.x..xx..xx..xx.x.x.x.x.x..xxxx.x.xxx..xx.xx.xx. xxx..x.xx..xx.x.xx.x.xx.x.xx.x.x.x.x.x.x.x.x.xxx.x.x.x.x.x.x.x..x.xxx.x..x.xxxx.xx..xxxx.... ...x...................................................................xxxx................. ...xx.................................................................x..x.................. ..xxxx...........................................xxxx................xxxx................... ..xXXXXx.........................................x..x...............x..x.................... ..XX.xx.XX.......................................xxxx..............x.xx..................... ...XxxxxxXX.........................................xx.xx.........xxxx...................... ....xxXXXX.x.........................................xxxx................................... .....XX....XX............................................................................... .......xxxxxx............................................................................... .........xxxx............................................................................... ......................xxxxxxxx.............................................................. ......................x......x.............................................................. ......................xxxxxxxx.............................................................. ............................................................................................ ............................................................................................ ............................................................................................ ............................................................................................ ............................................................................................ sprites ........ ........ .XXXXXX. .X....X. xXXXXXX. XX....X. XX....X. XX....X. ........ ........ XXXXXX.. XX...X.. XXXXXXX. XX....X. XX....X. XXXXXXX. ........ ........ XXXXXX.. X...XX.. X....... X....... X....X.. XXXXXX.. ........ ........ XXXXXX.. XX....X. XX....X. XX....X. XX....X. XXXXXX.. ........ ........ XXXXXXX. X....... XXXXXXX. XX...... XX...... XXXXXXX. ........ ........ .XXXXXX. .XX..... .XXXXXX. ..X..... ..X..... ..X..... ........ ........ XXXXXXX. XX...XX. XX...... XX...XX. XX....X. XXXXXXX. ........ ........ X.....X. X.....X. XXXXXXX. XX....X. XX....X. XX....X. ........ ........ ...XX... ...XX... ...XX... ..XXX... ..XXX... ..XXX... ........ ........ .....X.. .....X.. .....X.. .....XX. XX...XX. XXXXXXX. ........ ........ X..X.... X.X..... XXXXXX.. XX..XX.. XX..XX.. XX..XX.. ........ ........ .X...... .X...... .X...... XX...... XX...... XXXXXX.. ........ ........ XXX.XXX. X..X.XX. X....XX. X....XX. X.XX.XX. X.XX.XX. ........ ........ XX....X. X.X...X. X..X..X. X...X.X. X.X..XX. X.XX..X. ........ ........ XXXXXXX. X.....X. X....XX. X....XX. X....XX. XXXXXXX. ........ ........ XXXXXXX. X.....X. XXXXXXX. XX...... XX...... XX...... ........ ........ XXXXXXX. X.....X. XX....X. XX....X. XX..X.X. XXXXXXX. ........ ........ XXXXXx.. X....X.. XXXXXX.. XX...XX. XX...XX. XX...XX. ........ ........ XXXXXXX. X....... XXXXXXX. ......X. XX....X. XXXXXXX. ........ ........ XXXXXXX. ...XX... ...XX... ...XX... ...XX... ...XX... ........ ........ X....XX. X....XX. X....XX. X....XX. X....XX. XXXXXXX. ........ ........ X....XX. X....XX. X....XX. X....XX. .X...X.. ..XXX... ........ ........ XX.XX.X. XX.XX.X. XX....X. XX.X..X. XXX.X.X. XX...XX. ........ ........ XX...XX. .XX.XX.. ..XXX... ..XXX... .XX.XX.. XX...XX. ........ ........ X.....X. X.....X. .X...X.. ..XXX... ..XXX... ..XXX... ........ ........ XXXXXXX. X...XX.. ...XX... ..XX.... .XX..XX. XXXXXXX. ........ ........ .XXXXXX. ......X. .XXXXXX. .X...... .X...... .XXXXXX. ........ ........ .XXXXX.. .....X.. .XXXXXX. .....XX. .....XX. .XXXXXX. ........ ........ XX...... XX...... XX...... XX...XX. XXXXXXX. .....XX. ........ ........ XXXXXX.. X....X.. X....... XXXXXXX. X.....X. XXXXXXX. ........ ........ XXXXXXX. XX...X.. ....X... ...X.... ...X.... ...X.... ........ ........ XXXXXXX. X....XX. XXXXXXX. .....XX. .....XX. .....XX. ........ ........ ..xxx... .x.x.x.. xxxxxxx. x.xxx.x. .x...x.. ..xxx... chiptunes 1, 18, 1, 18, 8 1, 23, 1, 23, 12 1, 31, 1, 31, 12 1, 18, 1, 18, 14 1, 15, 1, 15, 12 1, 14, 1, 14, 15 1, 18, 1, 18, 15 1, 9, 1, 9, 18 1, 8, 1, 8, 29 0, 0, 0, 0, 222 1, 9, 1, 9, 12 1, 8, 1, 8, 16 7,24,0,0,12 12, 24, 0, 0, 24 12, 19, 0, 0, 12 12, 15, 0, 0, 12 12, 14, 0, 0, 18 12, 15, 12, 19, 24 12, 15, 0, 0, 12 12, 19, 0, 0, 12 12, 15, 12, 19, 120 0, 0, 0, 0, 254 3, 5, 3, 12, 8 15, 17, 15, 19, 8 15, 5, 15, 12, 8 15, 17, 15, 19, 8 15, 5, 15, 12, 8 15, 17, 15, 19, 16 7, 5, 7, 12, 30 3, 5, 3, 12, 15 15, 17, 15, 19, 10 15, 5, 15, 12, 10 15, 17, 15, 19, 10 15, 5, 15, 12, 10 15, 5, 15, 12, 15 0, 0, 0, 0, 68 7,30,0,0,8 7,24,0,0,8 7,20,0,0,8 7,24,0,0,7 30,0,0,8,7 24,0,0,8,7 20,0,0,8,7 24,0,0,8,7 22,0,0,8,7 22,0,0,8,7 22,0,0,8,7 24,0,0,8,7 27,0,0,8,7 30,0,0,8,7 30,0,0,8,7 24,0,0,8,7 20,0,0,8,7 24,0,0,8,7 30,0,0,8,7 24,0,0,8,7 20,0,0,8,7 24,0,0,8,7 22,0,0,8,7 22,0,0,8,7 22,0,0,8,7 24,0,0,8,7 27,0,0,8,7 30,0,0,8,12 24,0,0,8,12 24,0,0,8,12 19,0,0,8,12 15,0,0,8,12 24,0,0,8,12 15,0,0,8,12 24,0,0,8,12 19,0,0,8,7 30,0,0,8,7 24,0,0,8,7 20,0,0,8,7 30,0,0,8,7 24,0,0,8,7 20,0,0,8,7 30,0,0,8,7 24,0,0,8,7 20,0,0,8,24 7,30,0,0,8 7,24,0,0,8 7,20,0,0,8 7,24,0,0,7 30,0,0,8,7 24,0,0,8,7 20,0,0,8,7 24,0,0,8,7 22,0,0,8,7 22,0,0,8,7 22,0,0,8,7 24,0,0,8,7 27,0,0,8,7 30,0,0,8,24 8,7,22,0,0 8,7,22,0,0 8,7,24,0,0 8,7,27,0,0 0,0,1,12,24 0,0,8,12,24 0,0,8,12,19 0,0,8,7,30 0,0,8,7,24 0,0,8,7,20 0,0,8,12,15 0,0,0,0,0