rem SMB Clone by Chris Spry, 2012. rem Variable definitions rem a - Animation Timer b - Level Data Pointer rem c - Coin Counter d - Player data Flags (See Below) rem e - Level Timer f - Player Animation Frame rem g - Extra Bit Flags (See Below) h - Object Scroll In data rem i - Enemy Type j - Enemy Momentum rem k - Star Invincibility Timer l - lives Counter rem m - Momentum left & right n - Momentum up & down rem o - Farthest Traveled on Level p - Music Duration rem q - Music data r - Music data rem s - Moving Shell X coordinate t - Moving Shell Y Coordinate rem u - Miscellaneous v - World rem w - Level x,y,z - miscellaneous rem .... rem D Flags rem 0 - Player Facing Direction (0-right 1-left) rem 1 - Jumping Flag rem 2 - Fire Button Pressed Flag rem 3 - Power = Super Mario rem 4 - Power = Firey Mario rem 5 - Ducking Flag rem 6 - No Power (Regular Mario) rem 7 - Mario Invincibility Flag rem .... rem G Flags rem 0 - Mario Fireball Going down & enabled if set rem 1 - Mario Fireball Going up & enabled if set rem 2 - Mario Fireball Direction (0-left 1-right) rem 3 - Enemy Direction (0-left 1-right) rem 4 - Enemy Dead Flag rem 5 - Moving Turtle Shell Direction (0-left 1-right) rem 6 - Checkpoint Flag rem 7 - Mario Sprite on-off flag for invincibility rem .... rem Enemy & Object Type (i) number assignments. Note - Odd number is reserved for the enemy's 2nd animation frame rem 0 - Goomba....2 - Green Koopa....4 - Beetle....6 - Spiney....8 - Red Koopa....10 - Flying Green Koopa....12 - Bullet Bill rem 14 - Flying Red Koopa....16 - Spiney Ball....18 - Fireball (Enemy)....20 Flagpole (Object)...22 - Special Note Item Box (Object not yet implemented) rem 32 - Beetle Shell....34 - Green Shell....36 - Red Shell rem More will be made later for Koopa Kid Bosses. set kernel_options playercolors player1colors pfcolors set tv ntsc set romsize 32k set optimization speed set smartbranching on set optimization noinlinedata set optimization inlinerand rem set debug rem const pfscore=1 v=1:w=1:l=3:score=0:c=0 pfscore2=0: d{6}=1:d{4}=0:d{5}=0:g{6}=0 init drawscreen gosub introscreen bank4 main h=0 COLUP1 = $80 COLUP0 = $0E COLUPF = $42 gosub setupmario gosub renderscreen goto enemycolroutine bank2 mhit1 if d{7} then goto draw bank3 if d{6} then goto mariodeath bank3 rem powerdown mario routine if d{4} then d{3}=1:d{4}=0 else d{6}=1:d{3}=0 y=8:u=0 for z=1 to 8 for x=1 to 4 if d{3} then gosub firemariocolor:gosub supermario else gosub supermariocolor:gosub supermario gosub powerdownsoundfx gosub renderscreen next x for x=1 to 4 if d{3} then gosub supermariocolor:gosub supermario else gosub MarioColor:gosub Mario gosub powerdownsoundfx gosub renderscreen next x next z rem set Mario's invincibility flag here or else he'll just keep getting hit till he dies. Being scarce on variables, we'll use the level timer to fix the duration of rem Mario's invincibility. So if you get hit, it'll actually give you a little extra time to finish the level. lol rem D7 = invincibility bit. E = level timer turnover (reset to start invincibility time). G7 = Mario Invisible bit d{7}=1 : e=0 : g{7}=0 goto draw bank3 main2 gosub renderscreen rem move mario if he has momentum if m>0 && d{0} then player0x=player0x-m if m>0 && !d{0} then player0x=player0x+m if n>0 && d{1} then player0y=player0y-n if n>0 && !d{1} then player0y=player0y+n rem scroll screen if moving in middle also check for edge of levels if player0x<17 then player0x=17 if player0x>137 then player0x=137 if !d{0} && player0x>80 && b<127 then player0x=80 : goto scrollleft bank5 if d{0} && player0x<72 && b>32 then player0x=72: goto scrollright bank5 rem collision detection with playfield rem first for falling fallcolcheck rem skip check if jumping if d{1} then goto jumpcolcheck rem if already falling check current position for collision and if not, check one pixel below to see if standing on something if n>0 then z=0 else z=1 rem 15 & 11 are used so the player can't fall through a single playfield block if that's all there is to detect. It takes away from the edges a little, but compromises need to be made y=(player0y+z)/8 x=(player0x-15)/4 rem this will check if character has collided with a platform and if so, then we will reset the character one pixel above that platform and mark him as no longer falling if he ever was in the first place. rem if we found it here then skip ahead for next detection. No need to waste precious clock cycles for another redundant check in the next lines if pfread(x,y) then player0y=(y*8)-1:n=0:goto jumpcolcheck x=(player0x-11)/4 if pfread(x,y) then player0y=(y*8)-1:n=0:goto jumpcolcheck rem this gets exectued if nothing is below the character and is falling or continues to fall rem momentum (gravity) increase if not at terminal velocity. Can't go above 6 as I have found or else he can fall through platforms! :( if n<7 then n=n+1 if player0y>96 then goto mariodeath bank3 jumpcolcheck rem skip if not jumping if !d{1} then goto leftrightcheck if d{3} || d{4} then y=(player0y-24)/8:z=10 if d{5} || d{6} then y=(player0y-14)/8:z=0 if y<0 || y>11 then goto jcc2 x=(player0x-15)/4 if pfread(x,y) then player0y=(y*8)+18+z:d{1}=0:n=1:goto bonuscheck x=(player0x-11)/4 if pfread(x,y) then player0y=(y*8)+18+z:d{1}=0:n=1:goto bonuscheck rem if nothing is above then continue jumping up until momentum runs out, once it does turn jump flag off so he can start falling again jcc2 n=n-1 if n<1 then n=1:d{1}=0 if player0y<8 then player0y=8 leftrightcheck rem we only check this if momentum is moving left or right or else its just a waste of more cycles since nothing will be there anyway unless he's ducking then there might if m=0 then goto finishcheck if d{0} then x=(player0x-17)/4 else x=(player0x-9)/4 y=(player0y-4)/8 if pfread(x,y) then goto fixmario y=(player0y-11)/8 if pfread(x,y) then goto fixmario if d{5} || d{6} then goto finishcheck y=(player0y-18)/8 if pfread(x,y) then goto fixmario goto finishcheck bonuscheck rem after done with this check do not do a leftrightcheck. It makes Mario bounce off the bricks weird. Plus it'll save on a few cycles. if player1y31 && y>1 && !d{6} then goto hiddenblock bb2 if d{6} then goto finishcheck AUDV0 = 10 AUDC0 = 7 AUDF0 = 22 score=score+10 pfpixel x y off goto finishcheck yellowblock pfpixel x y off if a>1 || d{4} then score=score+100:goto addcoincounter score=score+1000 if d{4} then goto finishcheck if d{3} then d{3}=0:d{4}=1 else d{3}=1:d{4}=0:d{6}=0 y=31:u=0 for z=1 to 8 for x=1 to 4 if d{3} then gosub supermariocolor:gosub supermario else gosub firemariocolor:gosub supermario gosub powerupsoundfx gosub renderscreen next x for x=1 to 4 if d{3} then gosub MarioColor:gosub Mario else gosub supermariocolor:gosub supermario gosub powerupsoundfx gosub renderscreen next x next z goto finishcheck hiddenblock u=e+a if u=10 || u=16 then goto hb2 if u=25 then goto hb2 goto bb2 hb2 g{3}=0 player1x=(x*4)+17 player1y=y*8 i=22 if a>3 && k=0 then i=24 if a=6 then i=26 j=3 goto bb2 enemybump u=((y-1)*8) if u<>player1y then goto bc2 u=(x*4)+16:z=(x*4)+22 if player1x>x && player1x7 then c=0:pfscore2=pfscore2*2|1 AUDV0 = 12 AUDC0 = 4 AUDF0 = 7 if pfscore2<250 then goto finishcheck y=11:u=0:l=l+1 if l=255 then l=254 1up gosub 1upsoundfx gosub renderscreen:gosub renderscreen:gosub renderscreen:gosub renderscreen g{7}=1:d{7}=1 gosub renderscreen:gosub renderscreen:gosub renderscreen:gosub renderscreen g{7}=0:d{7}=0:gosub setupmario if y=3 then pfscore2=0:goto finishcheck goto 1up fixmario if d{0} then player0x=(x*4)+21 else player0x=(x*4)+9 m=0 finishcheck rem when the screen starts scrolling, the enemies, fireballs, etc, get moved too, but if we draw them before they get a chance to move on their routine there will be a double flicker effect rem so we turn them off for now until its their time for a full render on the next drawscreen. This may cause a touch of flicker, but its better than double-vision. if ballx>0 then z=bally:bally=120 if h>0 && d{0} && player1x>0 then player1x=player1x+4 if h>0 && !d{0} && player1x>0 then player1x=player1x-4 if s>0 || t>0 then gosub redrawshell gosub renderscreen rem the enemy routine is in bank 2 goto fberoutine bank2 redrawshell rem ran out of cycles for this so it'll do one extra drawscreen here, which will slow down gameplay a little but only when the shell is moving on a scroll, so it won't happen that often gosub renderscreen if h>0 && d{0} then s=s+1 if h>0 && !d{0} then s=s-1 if s<0 || s>30 then s=0:t=0:return pfpixel s t on x=s+1 pfpixel x t on return setupmario if d{5} then f=3 if d{1} || n>0 then f=2 if d{6} then goto smallmario if d{3} then goto bmario on f gosub firemariocolor firemariocolor firemariojumpcolor firemarioduckcolor goto bigmariosprite bmario on f gosub supermariocolor supermariocolor supermariojumpcolor marioduckcolor bigmariosprite on f gosub supermario supermario2 supermariojump marioduck return smallmario on f gosub MarioColor MarioColor MarioJumpColor MarioColor on f gosub Mario Mario2 MarioJump Mario return powerupsoundfx y=y-1:u=u+1 if u>21 then y=y+18:u=0 AUDV0 = 8 AUDC0 = 4 AUDF0 = y AUDV1 = 0 return powerdownsoundfx y=y+1 temp4=8 if u>6 then y=8:u=0 if y>30 then u=u+1:y=9:temp4=8-u AUDV0 = temp4 AUDC0 = 6 AUDF0 = y AUDV1 = 0 return 1upsoundfx y=y-2:u=u+1 if u=4 then u=0:y=7 AUDV0=8 AUDC0=4 AUDF0=y AUDV1=0 return renderscreen COLUPF = $42 if d{0} then REFP0=8 else REFP0=0 if g{3} then REFP1=8 else REFP1=0 if d{7} && g{7} then g{7}=0:gosub nomario:goto ds if d{7} && !g{7} then g{7}=1 ds drawscreen return MarioColor player0color: $44 $44 $FE $44 $44 $44 $FE $FE $FE $FE $FE $44 $44 end return MarioJumpColor player0color: $44 $44 $44 $FE $44 $44 $FE $FE $FE $FE $FE $44 $44 $FE $FE end return Mario player0: %01111100 %01111000 %01100100 %11110000 %11110110 %01101100 %00111110 %01110000 %11011011 %10010111 %00110100 %11111111 %01111100 end return Mario2 player0: %11100110 %11000011 %11001010 %11100000 %11110110 %01101100 %00111110 %01110000 %11011011 %10010111 %00110100 %11111111 %01111100 end return MarioJump player0: %10000110 %11000011 %11000011 %11001010 %11100101 %01101010 %00111110 %01110000 %11011011 %10010111 %00110100 %11111111 %01111100 %00000011 %00000111 end return supermariocolor player0color: $44 $44 $44 $44 $FE $FE $44 $44 $44 $44 $44 $44 $FE $FE $FE $FE $FE $FE $FE $FE $44 $44 $44 $44 end return supermario player0: %01111111 %01111110 %00111000 %00000000 %11000010 %11100010 %11110000 %11110111 %11110111 %11100111 %11101110 %01100000 %00111110 %01111000 %11100011 %10110111 %00111111 %00110100 %01110100 %00111100 %11000000 %11111111 %01111100 %00111100 end return firemariocolor player0color: $3A $38 $36 $16 $FE $FE $16 $1E $1C $1A $18 $16 $FE $FE $FE $FE $FE $FE $FE $FE $36 $38 $3A $3C end return firemariojumpcolor player0color: $3A $38 $36 $16 $FE $FE $1E $1E $1C $1A $18 $16 $FE $FE $FE $FE $FE $FE $FE $FE $36 $38 $3A $3C $FE $FE end return supermario2 player0: %01100110 %11000111 %11000011 %00000000 %00011010 %00011010 %00111000 %01110111 %11110111 %11101111 %11101110 %01000000 %00111110 %01111000 %11100011 %10110111 %00111111 %00110100 %01110100 %00111100 %11000000 %11111111 %01111100 %00111100 end return supermariojumpcolor player0color: $44 $44 $44 $44 $FE $FE $44 $44 $44 $44 $44 $44 $FE $FE $FE $FE $FE $FE $FE $FE $44 $44 $44 $44 $FE $FE end return supermariojump player0: %11000110 %11000111 %01000111 %01100011 %11001001 %11101001 %11100000 %11110110 %11110110 %11100101 %11101101 %01100000 %00111110 %01110000 %11000011 %01101111 %00111111 %01101010 %01101010 %00111100 %11000001 %11111111 %01111101 %00111101 %00000011 %00000111 end return marioduckcolor player0color: $44 $44 $44 $44 $44 $44 $44 $FE $FE $44 $44 $44 $44 end return firemarioduckcolor player0color: $3A $38 $1C $1A $1A $18 $16 $FE $FE $36 $38 $3A $3C end return marioduck player0: %00111100 %01111000 %00000110 %01110110 %11110000 %11111100 %01101100 %01101101 %00101100 %11111011 %01110110 %00110110 %00011100 end return nomario player0: %11100111 end return bank 2 fberoutine rem object & enemy routines rem new enemy/object on scroll check. if there is a new one, initialize it then return. Not enough time to do anything else after an init. if h>1 then gosub initenemy if ballx>0 then bally=z rem first we do mario's fireball rem if fireball isn't out then onto the next part if ballx=0 then goto enemyroutine if g{2} then ballx=ballx+6 else ballx=ballx-6 if g{0} then bally=bally+3 else bally=bally-3 if !g{0} && g{1} then g{0}=1:g{1}=0 if !g{0} && !g{1} then g{1}=1 x=(ballx-17)/4:y=bally/8 if pfread(x,y) then goto fireballcol if ballx>137 then gosub killfireball if ballx<17 then gosub killfireball if bally>96 then gosub killfireball goto enemyroutine fireballcol if !g{0} then gosub killfireball if g{0} then g{0}=0:g{1}=0:bally=bally-6 enemyroutine rem if there are no enemies on the screen then just loop game cycle. Going back to main renders a new screen. if s>0 || t>0 then gosub movingshellroutine if t>0 && player1x>0 then gosub renderscreenb2 if player1x=0 then goto main bank1 rem if enemy goes off screen then get rid of it if player1x>136 || player1x<17 then gosub killenemy:goto eer rem if enemy has been killed then continue dying routine if g{4} then goto enemydeathroutine if i=14 then goto rfkoopa if i=16 then goto sball if i=18 then goto fball if i=20 then goto edcheck if i>20 && i<28 then goto SpecialItem if i>31 && i<38 then goto edcheck rem the first 7 enemy types will go left or right if i=12 then x=2 else x=1 if g{3} then player1x=player1x+x else player1x=player1x-x if player1x<17 || player1x>137 then gosub killenemy:goto main bank1 rem enemy collision detection routines edcheck rem if the enemy is airborn then we don't need to see if its standing on a platform if i>8 then goto elrcheck if j<7 then j=j+1 player1y=player1y+j if g{3} then x=(player1x-17)/4 else x=(player1x-9)/4 y=(player1y+1)/8 if pfread(x,y) then player1y=(y*8)-1:j=0:goto elrcheck rem if its the red turtle he wont fall off platform if i=8 then gosub fixenemy:goto elrcheck if player1y>90 then gosub killenemy:goto main bank1 elrcheck rem if its bullet bill then he can pass through the playfield if i=12 then goto enemyendmove if g{3} then x=(player1x-9)/4 else x=(player1x-17)/4 y=(player1y-4)/8 if pfread(x,y) then gosub fixenemy rem prep correct object or enenmy to display enemyendmove if i>31 then goto enemyendmove32 if a>3 && !g{4} then x=i+1 else x=i on x gosub GoombaC GoombaC GKC GKC BeetleC BeetleC SpineyC SpineyC GKC GKC GKC GKC BulletBill BulletBill RKC RKC SballC SballC FireballC FireballC Flagpole Flagpole CoinC CoinC StarC1 StarC2 1UPC 1UPC on x gosub Goomba1 Goomba2 Koopa1 Koopa2 Beetle1 Beetle2 Spiney1 Spiney2 Koopa1 Koopa2 FKoopa1 FKoopa2 BulletBill BulletBill FKoopa1 FKoopa2 Sball1 Sball2 Fireball1 Fireball2 Flagpole Flagpole Coin1 Coin2 Star Star 1UPMush 1UPMush goto main bank1 enemyendmove32 x=i-32 on x gosub SBColor SBColor SGKColor SGKColor SRKColor SRKColor if a>3 && !g{4} then x=x+1 if x<2 then gosub ShellB else gosub ShellK rem store enemy data into their proper containers before going to start of game cycle estore rem reset new object variable to 0 so if the screen doesn't scroll on the next game cycle we don't have to worry about repositioning enemy sprites next time eer goto main bank1 rfkoopa if g{3} then player1y=player1y+2 else player1y=player1y-2 if player1y>72 then gosub fixenemy:player1y=72 if player1y<24 then gosub fixenemy:player1y=24 goto enemyendmove sball player1y=player1y+4 if g{3} then x=(player1x-17)/4 else x=(player1x-9)/4 y=(player1y+1)/8 if pfread(x,y) then i=6 goto enemyendmove fball if g{3} then player1y=player1y+6 else player1y=player1y-6 if g{3} && player1y>150 then g{3}=0 if !g{3} && player1y<40 then g{3}=1 goto enemyendmove killfireball ballx=0:bally=120 return thisbank initenemy rem if enemy is already on sceen then we can't put another on unless its the flagpole then it gets priority if h>152 then goto ie2 if player1x>0 then return thisbank ie2 i=h/8 i=i-1 g{4}=0 if i>7 && i<15 then z=(a+3)*8:goto finisheinit if i=16 then z=8:goto finisheinit if i=18 then z=151:goto finisheinit y=0 if d{0} then x=0 else x=31 initenemyplacement y=y+1 rem if there is no surface to init enemy on then return if y=11 then return if pfread(x,y) then z=(y*8)-1 else goto initenemyplacement finisheinit if d{0} then x=19 else x=135 if d{0} && i<8 then g{3}=1 if !d{0} && i<8 then g{3}=0 player1x=x:player1y=z if i=20 then g{3}=0 gosub renderscreenb2 return thisbank repositionenemy if d{0} then y=0 else y=8 player1x=player1x+4-y return thisbank killenemy player1x=0:player1y=150:i=0:g{3}=0:j=0:g{4}=0 return thisbank fixenemy if g{3} then g{3}=0 else g{3}=1 return thisbank enemydeathroutine player1y=player1y+j if j<6 then j=j+1 if player1y>90 then gosub killenemy if j=6 then goto enemyendmove temp4=26-j AUDV0 = 12 AUDC0 = 4 AUDF0 = temp4 goto enemyendmove movingshellroutine x=s+1 pfpixel s t off pfpixel x t off if g{5} then s=s-2 else s=s+2 if s<0 then s=0:t=0:return thisbank if s>30 then s=0:t=0:return thisbank y=t+1 if pfread(s,y) then goto msr2 if pfread(x,y) then goto msr2 t=t+1 if t=11 then s=0:t=0:return thisbank msr2 y=0 if pfread(s,t) then goto changeshelldirection y=1 x=s+1 if pfread(x,t) then goto changeshelldirection msr3 x=s+1 pfpixel s t on pfpixel x t on rem check for shell hitting enemy if g{4} then return thisbank x=(s*4)+17 y=(s*4)+25 if player1x>=x && player1x<=y then goto msr4 return thisbank msr4 x=(t*8) y=(t*8)+8 if player1y>=x && player1y<=y then g{4}=1:score=score+400 return thisbank changeshelldirection if t<8 then goto destroyblock AUDV0 = 12 AUDC0 = 1 AUDF0 = 31 csd2 if g{5} then s=s+4:g{5}=0:goto msr3 if !g{5} then s=s-4:g{5}=1 goto msr3 destroyblock score=score+20 if y=0 then pfpixel s t off if y=1 then pfpixel x t off AUDV0 = 10 AUDC0 = 7 AUDF0 = 22 goto csd2 enemycolroutine rem fireball collision with enemy check if collision(ball,player1) && !g{4} then goto enemyhitbyfireball bank3 rem mario death and mario - enemy collision detections are here since we just finished plotting the enemy character for a final accurate screen render if player0y>119 then goto init bank1 if s>0 && t>0 then goto movingshellcol ecr2 if !collision(player0,player1) then goto draw bank3 if g{4} then goto draw bank3 rem if mario is above the enemy then he wins if i=20 then goto levelcompleted bank3 if i=22 then goto 8coins bank3 if i=24 then goto starpower bank3 if i=26 then goto 1upmushroom bank3 if k>0 then goto enemyhit bank3 if i=6 then goto mhit1 bank1 if i=16 then goto mhit1 bank1 if i=18 then goto mhit1 bank1 if i>19 then goto enemyhit bank3 x=player0y+1 if x6 then j=6 player1y=player1y+j if player1y>96 then i=0:player1x=0:player1y=150 goto enemyendmove GoombaC player1color: $06 $06 $2E $2E $36 $36 $36 $36 $36 $36 $36 end return Goomba1 player1: %11100110 %01000011 %00111100 %00111100 %01111110 %11111111 %11011011 %11000011 %10111101 %01111110 %00111100 end return Goomba2 player1: %01100111 %11000010 %00111100 %00111100 %01111110 %11111111 %11011011 %11000011 %10111101 %01111110 %00111100 end return BeetleC player1color: $2E $2E $36 $28 $2A $2A $36 $36 $36 $38 end return Beetle1 player1: %01100011 %00110110 %00111111 %11110101 %11010101 %01110101 %10001001 %01110001 %00100010 %00011100 end return Beetle2 player1: %00110110 %00110110 %00111111 %11110101 %11010101 %01110101 %10001001 %01110001 %00100010 %00011100 end return BulletBill player1color: $0A $0C $0E $0E $0C $0A end player1: %00111101 %01000111 %10000111 %10100111 %01000111 %00111101 end return FireballC player1color: $44 $46 $38 $3A $3A $38 $46 $44 end return Fireball1 player1: %00111010 %01110100 %11110001 %11111100 %11011110 %11101110 %01111110 %00111100 end return Fireball2 player1: %00111100 %01111110 %01110111 %01111011 %00111111 %10001111 %00101110 %01011100 end return GKC player1color: $2E $2E $C4 $C6 $C8 $C8 $C6 $2E $2E $2E $2E $2E $2E end return RKC player1color: $2E $2E $48 $4A $4A $48 $46 $2E $2E $2E $2E $2E $2E end return FKoopa1 player1: %01110111 %00100010 %00111110 %01101011 %01010101 %00101010 %00011100 %11100010 %00110101 %11010110 %10110111 %10100011 %01100001 end return FKoopa2 player1: %00110110 %00110110 %00111110 %01101011 %01010101 %00101010 %00011100 %11100010 %00110111 %11010011 %10110000 %10100000 %01100000 end return Koopa1 player1: %01110111 %00100010 %00111110 %01101011 %01010101 %00101010 %00011100 %11100000 %00110000 %11010000 %10110000 %10100000 %01100000 end return Koopa2 player1: %00110110 %00110110 %00111110 %01101011 %01010101 %00101010 %00011100 %11100000 %00110000 %11010000 %10110000 %10100000 %01100000 end return SballC player1color: $1E $48 $48 $46 $44 $44 $46 $48 $1E end return Sball1 player1: %01010100 %00111100 %01101110 %11011111 %11111111 %11111011 %01110110 %00111100 %00101010 end return Sball2 player1: %00101010 %00111100 %01110110 %11111011 %11111111 %11011111 %01101110 %00111100 %01010100 end return SBColor player1color: $36 $26 $2A $2A $36 $36 $36 $38 end return ShellB player1: %00111100 %01100110 %10000001 %10000001 %01001010 %01000010 %00100100 %00011000 end return SGKColor player1color: $2E $2E $C8 $CA $CA $C8 $C8 $C6 end return SRKColor player1color: $2E $2E $48 $4A $4A $48 $48 $46 end return ShellK player1: %00100100 %01011010 %10111101 %11011011 %01100110 %01011010 %00111100 %00011000 end return SpineyC player1color: $2E $2E $46 $44 $44 $48 $1A $1C $1E end return Spiney1 player1: %01110111 %00100010 %01111111 %10110101 %11101011 %00110110 %00101010 %00101010 %00001000 end return Spiney2 player1: %00110110 %00110110 %01111111 %10110101 %11101011 %00110110 %00101010 %00101010 %00001000 end return Flagpole player1color: $0A $08 $C4 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C4 $0A $0C $0E $0E $0E $0C $0A $CA end player1: %00000111 %00000011 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00001110 %00111110 %11101010 %11110110 %11110110 %00111110 %00001110 %00000001 end return 1UPC player1color: $2A $2A $D8 $C6 $0C $0C $C6 $C8 end return 1UPMush player1: %00110100 %00111100 %11111111 %11111111 %11001111 %01010110 %00100100 %00011000 end return CoinC player1color: $08 $0A $0C $0C $0C $0C $0A $08 end return Coin1 player1: %00011000 %00100100 %01011010 %01011010 %01011010 %01011010 %00100100 %00011000 end return Coin2 player1: %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 end return StarC1 player1color: $1E $1E $1E $1E $1E $1E $1E $1E end return StarC2 player1color: $1E $28 $28 $28 $28 $28 $28 $28 end return Star player1: %00000000 %11000110 %01101100 %00111000 %01111100 %11010110 %00111000 %00010000 end return bank 3 draw a=a+1 if a>7 then a=0 : e=e+1 rem if level timer is at max then take a notch off overall level timer and set invincibilty flag to 0 if e>6 && d{7} && k=0 then d{7}=0 if k>0 then k=k+1 if k=160 then k=0:e=0:gosub OWMusic bank7 if e>25 then e=0: pfscore1=pfscore1/2 if pfscore1=0 then goto mariodeath if pfscore1<6 && pfscore1>2 && e<5 then AUDV0=10:AUDC0=1:AUDF0=10 if a>3 then f=1 else f=0 if m=0 then f=0 if !joy0down then d{5}=0 if joy0down && player0y=63 && n=0 && b>100 then goto checkpoint morejoychecks if joy0down && !d{6} then d{5}=1 if joy0left && !d{5} then d{0}=1 : goto moving if joy0right && !d{5} then d{0}=0 :goto moving if m>0 then m=m-1 goto checkfire moving m=m+1 if joy0up && m>4 then m=4 if !joy0up && m>2 then m=2 checkfire if joy0up && d{4} && ballx=0 then gosub initfire checkjump if !joy0fire then d{2}=0 if joy0fire && !d{1} && n=0 && !d{2} then gosub initjump rem jumping sound effect if !d{1} then goto checkshell temp4=6+n AUDV0 = 12 AUDC0 = 12 AUDF0 = temp4 rem turn off moving shell if its around for one draw because if we don't then the mario playfield collision routines will get confused with it checkshell if s=0 && t=0 then goto MusicPart pfpixel s t off x=s+1 pfpixel x t off MusicPart if k>0 then goto GetStarMusic bank7 : goto GotMusic if v=1 || v=3 then goto GetMusic bank7 GotMusic goto main2 bank1 initjump d{1}=1 :n=7 :d{2}=1 if m=4 then n=8 return initfire if d{0} then ballx=player0x:g{2}=0 else ballx=player0x+4:g{2}=1 bally=player0y-8 g{0}=1:g{1}=0 ballheight=2 CTRLPF=$11 AUDV0 = 12 AUDC0 = 4 AUDF0 = 11 return enemyhit score=score+200 if i<20 && k=0 then d{1}=1:n=2:d{2}=1 if i<18 && joy0fire then n=6 else player0y=player0y-3 if k>0 then player0y=player0y+3:goto eh1 if i=10 then i=2:goto draw if i=14 then i=8:goto draw if i=2 then i=34:goto draw if i=4 then i=32:goto draw if i=8 then i=36:goto draw if i>31 &&i<38 then goto initkickedshell eh1 player1y=player1y-3 g{4}=1 goto draw enemyhitbyfireball ballx=0: bally=120 if i=4 then goto draw if i=12 then goto draw if i=32 then goto draw if i>17 && i<27 then goto draw if i=16 then i=6 player1y=player1y-3 score=score+100 g{4}=1 goto draw initkickedshell player0y=player0y+3 i=0:g{3}=0:j=0:g{4}=0 if !d{0} then g{5}=0 else g{5}=1 s=(player1x-13)/4:t=(player1y-4)/8 if g{5} then s=s-1 else s=s+1 player1x=0:player1y=150 goto draw mariodeath if player0y>96 then player0y=150 gosub DeathMusic gosub Mariodie p=1:l=l-1:d{6}=1:d{4}=0:d{3}=0:s=0:t=0 ballx=0:bally=150 for x=6 to 0 step -1 if player0y<>150 then player0y=player0y-x gosub PlayDeathmusic gosub renderscreenb3:gosub renderscreenb3:gosub renderscreenb3 next x mariodeath2 if x<7 then x=x+1 if player0y<>150 then player0y=player0y+x gosub PlayDeathmusic if p=255 then goto checklives gosub renderscreenb3:gosub renderscreenb3:gosub renderscreenb3 if player0y>120 then player0y=120 goto mariodeath2 checklives i=0:player1y=150:player1x=0:k=0:d{7}=0:g{7}=0:d{5}=0:e=0:n=0:m=0:d{1}=0 if l<1 then goto GameOverScreen bank4 else goto init bank1 checkpoint x=(player0x+11)/4 if !pfread(x,9) then goto morejoychecks x=(player0x+37)/4 if !pfread(x,9) then goto morejoychecks y=8:u=0 ballx=0:bally=150:k=0:d{7}=0:g{7}=0 fl2 CTRLPF=$15 player0y=player0y+1 gosub powerdownsoundfx bank1 gosub renderscreenb3 if player0y<79 then goto fl2 player0x=0:player0y=150 pfclear b=32:g{6}=1 for x=1 to 32 gosub powerdownsoundfx bank1 gosub renderscreenb3 next x gosub ic3 bank4 player0x=24: player0y=80 fl3 player0y=player0y-1 gosub powerdownsoundfx bank1 gosub renderscreenb3 if player0y<64 then goto morejoychecks goto fl3 levelcompleted ballx=0:bally=150 gosub Flagpoledown gosub FanFareMusic x=player1y-player0y if x=0 then x=1 AUDV0=0 AUDV1=0 player0y=player1y a=0: p=1:d{1}=0:d{0}=0:d{5}=0:n=0 f=0:gosub setupmario bank1 for y=1 to x score=score+100 gosub renderscreenb3 AUDV0=8 AUDC0=12 AUDF0=y next y AUDV0=0 elr3 gosub PlayFFmusic a=a+1 player0x=player0x+1 if player0x>137 then player0x=137:player0y=150 if a>6 then a=0 if a>3 then f=1 else f=0 gosub setupmario bank1 gosub renderscreenb3:gosub renderscreenb3 if p<>255 then goto elr3 elr4 if pfscore1=0 then goto elr5 AUDV0 = 8 AUDC0 = 4 AUDF0 = 8 AUDV1 = 0 pfscore1=pfscore1/2 score=score+500 gosub renderscreenb3 AUDV0=0 gosub renderscreenb3 goto elr4 elr5 for x=1 to 64 gosub renderscreenb3 next x g{6}=0: i=0:player1y=150:player1x=0:k=0:d{7}=0:g{7}=0:d{5}=0:e=0 s=0:t=0:d{1}=0:n=0:m=0 goto init bank1 8coins score=score+800 pfscore2=pfscore2*2|1 AUDV0 = 12 AUDC0 = 4 AUDF0 = 7 player1x=0:player1y=150:i=0 if pfscore2<250 then goto draw bank3 pfscore2=0 goto 1upmushroom starpower k=1:d{7}=1:g{7}=1 score=score+1000 player1x=0:player1y=150:i=0 p=1 gosub starpowermusic bank7 goto draw bank3 1upmushroom y=11:u=0:l=l+1 if l=255 then l=254 player1x=0:player1y=150:i=0 1um2 gosub 1upsoundfxb3 gosub renderscreenb3:gosub renderscreenb3:gosub renderscreenb3:gosub renderscreenb3 x=player0x:z=player0y:player0x=0:player0y=150 gosub renderscreenb3:gosub renderscreenb3:gosub renderscreenb3:gosub renderscreenb3 player0x=x:player0y=z if y=3 then goto draw bank3 goto 1um2 1upsoundfxb3 y=y-2:u=u+1 if u=4 then u=0:y=7 AUDV0=8 AUDC0=4 AUDF0=y AUDV1=0 return thisbank renderscreenb3 COLUPF = $42 if d{0} then REFP0=8 else REFP0=0 if g{3} then REFP1=8 else REFP1=0 drawscreen return thisbank PlayDeathmusic rem * Check for end of current note p=p-1 if p>0 then goto GotDeathMusic rem * Retrieve channel 0 data temp4 = sread(DeathMusicData) temp5 = sread(DeathMusicData) temp6 = sread(DeathMusicData) rem * Check for end of data if temp4=255 then p = 255 : goto GotDeathMusic rem * Play channel 0 AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 rem * Retrieve channel 1 data temp4 = sread(DeathMusicData) temp5 = sread(DeathMusicData) temp6 = sread(DeathMusicData) rem * Play channel 1 AUDV1 = temp4 AUDC1 = temp5 AUDF1 = temp6 rem * Set duration p = sread(DeathMusicData) GotDeathMusic return DeathMusic sdata DeathMusicData=q 8,4,29 0,0,0 1 8,4,27 0,0,0 1 8,4,26 0,0,0 1 0,0,0 0,0,0 9 8,4,31 4,12,26 3 8,4,21 4,4,26 3 4,4,21 2,4,26 3 8,4,21 4,12,26 2 4,4,21 2,12,26 1 8,4,21 4,12,26 4 8,4,23 4,12,23 4 8,4,26 4,12,20 4 8,4,29 4,12,19 3 8,12,15 2,12,19 3 4,12,15 4,12,26 3 8,12,15 2,12,26 3 8,12,19 4,1,31 3 4,12,19 2,1,31 3 0,0,0 0,0,0 9 255 end return thisbank PlayFFmusic rem * Check for end of current note p=p-1 if p>0 then goto GotFFMusic rem * Retrieve channel 0 data temp4 = sread(FanFareMusicData) temp5 = sread(FanFareMusicData) temp6 = sread(FanFareMusicData) rem * Check for end of data if temp4=255 then p = 255 : goto GotFFMusic rem * Play channel 0 AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 rem * Retrieve channel 1 data temp4 = sread(FanFareMusicData) temp5 = sread(FanFareMusicData) temp6 = sread(FanFareMusicData) rem * Play channel 1 AUDV1 = temp4 AUDC1 = temp5 AUDF1 = temp6 rem * Set duration p = sread(FanFareMusicData) GotFFMusic return thisbank FanFareMusic sdata FanFareMusicData=q 8,12,26 4,12,26 4 8,12,19 4,12,31 4 8,12,15 4,12,26 4 8,4,19 3,1,31 4 8,4,29 4,12,31 4 8,4,23 4,12,26 4 8,4,19 4,12,15 12 8,4,23 4,12,19 12 8,12,24 4,12,24 4 8,12,19 3,1,26 4 8,12,16 4,12,24 4 6,1,4 3,1,31 4 8,4,29 3,1,26 4 8,4,24 4,12,24 4 8,4,18 4,12,16 12 8,4,24 4,12,19 12 6,1,8 0,0,0 4 8,12,17 4,12,29 4 8,12,14 3,1,8 4 6,1,8 3,1,13 4 8,4,26 4,12,29 4 8,4,21 3,1,8 4 8,4,16 4,12,14 10 4,4,16 2,12,14 2 8,4,16 4,12,17 3 4,4,16 2,12,17 1 8,4,16 4,12,17 3 4,4,16 2,12,17 1 8,4,16 4,12,17 3 4,4,16 2,12,17 1 8,4,14 4,12,15 24 0,0,0 0,0,0 12 255 end return thisbank Mariodie player0color: $44 $44 $FE $44 $44 $FE $FE $FE $FE $FE $FE $44 $44 $FE $FE end player0: %11011011 %10111101 %00100100 %01000010 %11011011 %00111100 %01000010 %10011001 %00111100 %11011011 %01011010 %10111101 %11011011 %11000011 %01000010 end return Flagpoledown player1color: $0A $08 $C4 $0A $0C $0E $0E $0E $0C $0A $C6 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $C8 $CA end player1: %00000111 %00000011 %00000001 %00001110 %00111110 %11101010 %11110110 %11110110 %00111110 %00001110 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 %00000001 end return thisbank bank 4 introscreen AUDV0 = 0 AUDV1 = 0 pfclear ic2 x=v-1:y=w-1 gosub NumberColorsP0 : gosub NumberColorsP1 on x gosub 1World 2World 3World 4World on y gosub 1Level 2Level 3Level 4Level player0x=73:player0y=32 player1x=81:player1y=32 COLUP0=$0E COLUP1=$0E drawscreen x=l-1 gosub MarioIcon gosub NumberColorsP1 on x gosub 1Mario 2Mario 3Mario 4Mario 5Mario 6Mario 7Mario 8Mario 9Mario player0x=71:player1x=81 player0y=56:player1y=54 COLUP1=$0E drawscreen if !joy0fire then goto ic2 e=0: pfscore1=255 ic3 d{2}=1 x=((v-1)*2)+((w-1)*2) player0y=79 if g{6} then x=x+1:player0y=63 on x gosub W11ASetup W11BSetup W12Setup W13Setup W14Setup COLUBK = $00 scorecolor = $0E m = 0 : a=0 :b=32 : f=0 : p=1: n=0 :h=0 : o=0 : g{5}=1:s=0 player0x=24 player1x=0 player1y=150 pfscorecolor=28 var44=0:var45=0:var46=0:var47=0 ballx=0:bally=150 return otherbank W11ASetup gosub OW1Colors gosub OWMusic bank7 playfield: .......................XXXXX.... ......................X......... .................XXXXX.......... ................................ ................................ .................XXXXX.......... ................X.....X.....X... .......................XXXXX.... ................................ ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end return thisbank W11BSetup gosub OW1Colors gosub OWMusic bank7 playfield: ................................ .............X.................. ................................ ................................ ................................ .........................XXXX... ........X....X....X............. ................................ .XXX............................ .XXX............................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end return W12Setup W13Setup W14Setup OW1Colors pfcolors: $42 $1A $42 $42 $42 $42 $1A $42 $C6 $C6 $3E end return thisbank GameOverScreen pfclear gosub GameOverMusic p=1 GOS2 gosub NumberColorsP0:gosub NumberColorsP1 gosub GA:gosub ME player0x=73:player0y=32 player1x=81:player1y=32 gosub PlayGameOverMusic drawscreen gosub OV:gosub ER player0x=73:player0y=44 player1x=81:player1y=44 gosub PlayGameOverMusic drawscreen if p=255 then v=1:w=1:l=3:score=0:c=0:g{6}=0:d{6}=1:d{3}=0:d{4}=0:pfscore2=0:goto init bank1 goto GOS2 NumberColorsP0 player0color: $0E $0E $0E $0E $0E $0E $0E $0E end return thisbank NumberColorsP1 player1color: $0E $0E $0E $0E $0E $0E $0E $0E end return thisbank 1World player0: %01111000 %00110000 %00110000 %00110011 %00110000 %00110000 %01110000 %00110000 end return thisbank 2World player0: %01111000 %01111000 %01100000 %01110011 %00111000 %00011000 %01111000 %01110000 end return thisbank 3World player0: %01110000 %01111000 %00011000 %01111011 %01111000 %00011000 %01111000 %01110000 end return thisbank 4World player0: %00011000 %00011000 %00011000 %00111011 %01111000 %01101000 %01101000 %01101000 end return thisbank 1Level player1: %01111000 %00110000 %00110000 %00110000 %00110000 %00110000 %01110000 %00110000 end return thisbank 2Level player1: %01111000 %01111000 %01100000 %01110000 %00111000 %00011000 %01111000 %01110000 end return thisbank 3Level player1: %01110000 %01111000 %00011000 %01111000 %01111000 %00011000 %01111000 %01110000 end return thisbank 4Level player1: %00011000 %00011000 %00011000 %00111000 %01111000 %01101000 %01101000 %01101000 end return thisbank 1Mario player1: %00001111 %00000110 %00000110 %10100110 %01000110 %10100110 %00001110 %00000110 end return thisbank 2Mario player1: %00001111 %00001111 %00001100 %10101110 %01000111 %10100011 %00001111 %00001110 end return thisbank 3Mario player1: %00001110 %00001111 %00000011 %10101111 %01001111 %10100011 %00001111 %00001110 end return thisbank 4Mario player1: %00000011 %00000011 %00000011 %10100111 %01001111 %10101101 %00001101 %00001101 end return thisbank 5Mario player1: %00001110 %00001111 %00000011 %10100111 %01001110 %10101100 %00001111 %00001111 end return thisbank 6Mario player1: %00001111 %00001101 %00001101 %10101111 %01001111 %10101100 %00001111 %00000111 end return thisbank 7Mario player1: %00000110 %00000110 %00000110 %10100111 %01000011 %10100011 %00001111 %00001111 end return thisbank 8Mario player1: %00001111 %00001111 %00001001 %10101111 %01001111 %10101001 %00001111 %00001111 end return thisbank 9Mario player1: %00000110 %00000111 %00000011 %10100111 %01001101 %10101001 %00001111 %00000110 end return thisbank MarioIcon player0color: $44 $44 $FE $44 $44 $44 $FE $FE $FE $FE $FE $44 $44 end player0: %01111100 %01111000 %01100100 %11110000 %11110110 %01101100 %00111110 %01110000 %11011011 %10010111 %00110100 %11111111 %01111100 end return thisbank GA player0: %11001000 %10101010 %10101010 %10101010 %10001110 %10001010 %10001010 %01100110 end return thisbank ME player1: %10010011 %10001010 %10001010 %10001010 %10101011 %10101010 %11111010 %01111001 end return thisbank OV player0: %11001100 %10101010 %10101010 %10101010 %10101010 %10101010 %10101010 %01100010 end return thisbank ER player1: %11001000 %10001010 %10001010 %10001010 %11101100 %10001010 %10001010 %01101110 end return thisbank PlayGameOverMusic rem * Check for end of current note p=p-1 if p>0 then goto GotGOMusic rem * Retrieve channel 0 data temp4 = sread(GameOverMusicData) temp5 = sread(GameOverMusicData) temp6 = sread(GameOverMusicData) rem * Check for end of data if temp4=255 then p = 255 : goto GotGOMusic rem * Play channel 0 AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 rem * Retrieve channel 1 data temp4 = sread(GameOverMusicData) temp5 = sread(GameOverMusicData) temp6 = sread(GameOverMusicData) rem * Play channel 1 AUDV1 = temp4 AUDC1 = temp5 AUDF1 = temp6 rem * Set duration p = sread(GameOverMusicData) GotGOMusic return thisbank GameOverMusic sdata GameOverMusicData=q 8,4,14 4,4,23 10 4,4,14 2,4,23 10 0,0,0 0,0,0 10 8,4,19 4,4,29 10 4,4,19 2,4,29 10 0,0,0 0,0,0 10 8,4,23 4,12,26 20 8,4,17 4,4,21 13 8,4,15 4,4,21 13 8,4,17 4,4,21 14 8,4,18 4,4,21 20 8,4,16 4,4,21 20 8,4,18 4,4,21 20 8,4,19 4,4,23 10 8,4,19 4,4,26 10 8,4,19 4,4,23 40 0,0,0 0,0,0 4 255 end return thisbank bank 5 scrollleft pfscroll left if ballx>0 then ballx=ballx-4 x=b*2 if x>o then o=x z=((v-1)*8)+((w-1)*2) if g{6} then z=z+1 on z gosub W11A W11B W12 W13 W14 if y{0} then var3 = var3 | 128 else var3 = var3 & 127 rem if Mario has already gotten this far then don't bring back power blocks if o>x then var7=var7 & 127: goto render1 if y{1} then var7 = var7 | 128 else var7 = var7 & 127 render1 if y{2} then var11 = var11 | 128 else var11 = var11 & 127 if y{3} then var15 = var15 | 128 else var15 = var15 & 127 if y{4} then var19 = var19 | 128 else var19 = var19 & 127 if y{5} then var23 = var23 | 128 else var23 = var23 & 127 if o>x then var27 = var27 & 127:goto render2 if y{6} then var27 = var27 | 128 else var27 = var27 & 127 render2 if y{7} then var31 = var31 | 128 else var31 = var31 & 127 x=(b*2)+1 on z gosub W11A W11B W12 W13 W14 if y{0} then var35 = var35 | 128 else var35 = var35 & 127 if y{1} then var39 = var39 | 128 else var39 = var39 & 127 if y{2} then var43 = var43 | 128 else var43 = var43 & 127 if y{3} then h=y else h=1 b=b+1 goto fallcolcheck bank1 scrollright pfscroll right if ballx>0 then ballx=ballx+4 x=(b-32)*2 z=((v-1)*8)+((w-1)*2) if g{6} then z=z+1 on z gosub W11A W11B W12 W13 W14 if y{0} then var0 = var0 | 128 else var0 = var0 & 127 rem mario has been here before since he's going back so don't bring back power blocks var4 = var4 & 127 if y{2} then var8 = var8 | 128 else var8 = var8 & 127 if y{3} then var12 = var12 | 128 else var12 = var12 & 127 if y{4} then var16 = var16 | 128 else var16 = var16 & 127 if y{5} then var20 = var20 | 128 else var20 = var20 & 127 var24 = var24 & 127 if y{7} then var28 = var28 | 128 else var28 = var28 & 127 x=((b-32)*2)+1 on z gosub W11A W11B W12 W13 W14 if y{0} then var32 = var32 | 128 else var32 = var32 & 127 if y{1} then var36 = var36 | 128 else var36 = var36 & 127 if y{2} then var40 = var40 | 128 else var40 = var40 & 127 if y{3} then h=y else h=1 b=b-1 goto fallcolcheck bank1 W11A y=Level1A[x]:return thisbank W11B y=Level1B[x]:return thisbank W12 W13 W14 data Level1A 0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4 64,4,36,4,36,4,36,4,36,4,36,4,66,4,129,4,129,4,129,4,129,4,129,4,64,4,0,4,0,4,0,4 0,4,0,4,0,12,0,12,128,7,128,7,128,7,0,12,8,4,8,4,8,4,8,4,8,4,8,4,8,4 0,12,128,7,128,7,128,7,0,12,0,12,0,12,0,12,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,28,0,28,0,28,0,28,0,28,32,12,32,12,32,12,32,12,64,12,0,4,4,4,4,4,4,4,4,4,4,4,4,4 4,4,36,4,36,4,32,4,32,4,32,4,32,4,0,4,0,4,0,4,0,4,128,4,128,4 128,4,128,4,32,4,32,4,32,4,0,12,0,12,0,12,0,0,8,24,8,24,8,24,8,24,8,24,8,24,8,24 0,0,0,0,0,0,0,0,0,4,0,4,0,4,0,4,0,4,0,7,0,7,0,7,0,4,0,4,0,4,0,4 end data Level1B 0,4,0,7,0,7,0,7,0,12,0,12,0,12,0,12,64,4,0,12,0,12,0,12,0,12,66,4,0,12,0,12,0,12,0,12,64,4,0,12,0,12,0,12,0,12,0,12,0,12,32,4,32,4,32,4,32,4,0,12,0,12,0,12 0,12,0,6,0,7,128,7,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,7,128,7,0,7,0,6,0,28,0,28,0,28,0,28,0,28,16,4,16,4,16,4,16,4,16,4,16,4,16,4,16,4,0,12,0,12 0,12,0,12,0,12,0,12,33,4,33,4,33,4,33,4,33,4,33,4,33,4,33,4,0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12,128,7,128,7,128,7,0,12,0,12,0,12,0,12,64,4,32,4 32,4,32,4,32,4,0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,6,0,7,128,7,128,7,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,172,0,4,0,4,0,4,0,4 end bank 6 data level2 0,0 end return bank 7 rem Soundtrack routines GetMusic rem * Check for end of current note p=p-1 if p>0 then goto GotMusic bank3 rem * Retrieve channel 0 data temp4 = sread(OWMusicData) temp5 = sread(OWMusicData) temp6 = sread(OWMusicData) rem * Check for end of data if temp4=255 then p = 1 : gosub OWMusic:goto GetMusic rem * Play channel 0 if d{1} || g{4} then goto skipmelody AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 skipmelody rem * Retrieve channel 1 data temp4 = sread(OWMusicData) temp5 = sread(OWMusicData) temp6 = sread(OWMusicData) rem * Play channel 1 AUDV1 = temp4 AUDC1 = temp5 AUDF1 = temp6 rem * Set duration p = sread(OWMusicData) goto GotMusic bank3 rem ***************************************************** rem * Music Data Block rem ***************************************************** rem * Format: rem * v,c,f (channel 0) rem * v,c,f (channel 1) rem * d rem * rem * Explanation: rem * v - volume (0 to 15) rem * c - control [a.k.a. tone, voice, and distortion] (0 to 15) rem * f - frequency (0 to 31) rem * d - duration OWMusic sdata OWMusicData=q 8,4,23 4,6,13 2 2,4,23 1,6,13 1 8,4,23 4,6,13 3 2,4,23 1,6,13 3 8,4,23 4,6,13 3 2,4,23 1,6,13 3 8,4,29 4,6,13 3 8,4,23 4,6,13 3 2,4,23 1,6,13 3 8,4,19 4,6,20 3 2,4,19 1,6,20 3 0,0,0 0,0,0 6 8,12,26 4,6,20 3 2,12,26 1,6,20 3 0,0,0 0,0,0 6 8,4,14 4,12,26 3 4,4,14 2,12,26 3 0,0,0 0,0,0 3 8,4,19 4,12,31 3 4,4,19 2,12,31 3 0,0,0 0,0,0 3 8,4,23 4,1,15 3 4,4,23 2,1,15 3 0,0,0 0,0,0 3 8,4,17 4,12,29 3 4,4,17 2,12,29 3 8,4,15 4,12,26 3 4,4,15 2,12,26 3 8,4,16 4,12,27 3 8,4,17 4,12,29 3 4,4,17 2,12,29 3 8,4,19 4,12,31 4 8,4,23 4,12,19 4 8,4,19 4,12,15 4 8,4,17 4,12,14 3 4,4,17 2,12,14 3 8,4,21 4,12,17 3 8,4,19 4,12,15 3 4,4,19 2,12,15 3 8,4,23 4,12,11 3 4,4,23 2,12,11 3 8,4,29 4,12,23 3 8,4,26 4,12,20 3 8,4,31 4,12,26 3 4,4,31 2,12,26 3 0,0,0 0,0,0 3 8,4,29 4,12,26 3 4,4,29 2,12,26 3 0,0,0 0,0,0 3 8,4,19 4,12,31 3 4,4,19 2,12,31 3 0,0,0 0,0,0 3 8,4,23 4,1,15 3 4,4,23 2,1,15 3 0,0,0 0,0,0 3 8,4,17 4,12,29 3 4,4,17 2,12,29 3 8,4,15 4,12,26 3 4,4,15 2,12,26 3 8,4,16 4,12,27 3 8,4,17 4,12,29 3 4,4,17 2,12,29 3 8,4,19 4,12,31 4 8,4,23 4,12,19 4 8,4,19 4,12,15 4 8,4,17 4,12,14 3 4,4,17 2,12,14 3 8,4,21 4,12,17 3 8,4,19 4,12,15 3 4,4,19 2,12,15 3 8,4,23 4,12,11 3 4,4,23 2,12,11 3 8,4,29 4,12,23 3 8,4,26 4,12,20 3 8,4,31 4,12,26 3 4,4,31 2,12,26 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,19 4,4,23 3 8,4,20 4,12,31 3 8,4,21 4,4,26 3 8,4,24 4,4,31 3 4,4,24 4,12,19 3 8,4,23 2,12,19 3 4,4,23 4,12,29 3 4,1,4 2,12,29 3 8,12,11 4,12,14 3 8,4,29 4,12,19 3 4,4,29 4,12,19 3 8,12,11 4,12,19 3 8,4,29 4,12,29 3 8,4,26 4,12,29 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,19 4,4,23 3 8,4,20 4,12,31 3 8,4,21 4,4,26 3 8,4,24 4,4,31 3 4,4,24 4,12,26 3 8,4,23 4,12,19 3 4,4,23 2,12,19 3 8,4,14 8,4,21 3 4,4,14 4,4,21 3 8,4,14 8,4,21 2 4,4,14 4,4,21 1 8,4,14 8,4,21 3 4,4,14 4,4,21 3 0,0,0 4,12,26 3 0,0,0 2,12,26 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,19 4,4,23 3 8,4,20 4,12,31 3 8,4,21 4,4,26 3 8,4,24 4,4,31 3 4,4,24 4,12,19 3 8,4,23 2,12,19 3 4,4,23 4,12,29 3 4,1,4 2,12,29 3 8,12,11 4,12,14 3 8,4,29 4,12,19 3 4,4,29 4,12,19 3 8,12,11 4,12,19 3 8,4,29 4,12,29 3 8,4,26 4,12,29 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,24 4,1,19 3 4,4,24 2,1,19 3 0,0,0 0,0,0 3 8,4,26 4,1,17 3 4,4,26 2,1,17 3 0,0,0 0,0,0 3 8,4,29 4,1,15 3 4,4,29 2,1,15 3 0,0,0 0,0,0 3 0,0,0 4,12,26 2 0,0,0 2,12,26 1 0,0,0 4,12,26 3 0,0,0 2,12,26 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,19 4,4,23 3 8,4,20 4,12,31 3 8,4,21 4,4,26 3 8,4,24 4,4,31 3 4,4,24 4,12,19 3 8,4,23 2,12,19 3 4,4,23 4,12,29 3 4,1,4 2,12,29 3 8,12,11 4,12,14 3 8,4,29 4,12,19 3 4,4,29 4,12,19 3 8,12,11 4,12,19 3 8,4,29 4,12,29 3 8,4,26 4,12,29 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,19 4,4,23 3 8,4,20 4,12,31 3 8,4,21 4,4,26 3 8,4,24 4,4,31 3 4,4,24 4,12,26 3 8,4,23 4,12,19 3 4,4,23 2,12,19 3 8,4,14 8,4,21 3 4,4,14 4,4,21 3 8,4,14 8,4,21 2 4,4,14 4,4,21 1 8,4,14 8,4,21 3 4,4,14 4,4,21 3 0,0,0 4,12,26 3 0,0,0 2,12,26 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,19 4,4,23 3 8,4,20 4,12,31 3 8,4,21 4,4,26 3 8,4,24 4,4,31 3 4,4,24 4,12,19 3 8,4,23 2,12,19 3 4,4,23 4,12,29 3 4,1,4 2,12,29 3 8,12,11 4,12,14 3 8,4,29 4,12,19 3 4,4,29 4,12,19 3 8,12,11 4,12,19 3 8,4,29 4,12,29 3 8,4,26 4,12,29 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,24 4,1,19 3 4,4,24 2,1,19 3 0,0,0 0,0,0 3 8,4,26 4,1,17 3 4,4,26 2,1,17 3 0,0,0 0,0,0 3 8,4,29 4,1,15 3 4,4,29 2,1,15 3 0,0,0 0,0,0 3 0,0,0 4,12,26 2 0,0,0 2,12,26 1 0,0,0 4,12,26 3 0,0,0 2,12,26 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 8,4,29 3,1,9 2 4,4,29 1,1,9 1 8,4,29 3,1,9 3 4,4,29 1,1,9 3 8,4,29 3,1,9 3 4,4,29 1,1,9 3 8,4,29 3,1,9 3 8,4,26 4,12,24 3 4,4,26 2,12,24 3 8,4,23 4,12,26 3 8,4,29 4,12,15 3 4,4,29 2,12,15 3 8,12,11 4,1,31 3 8,12,26 4,12,19 3 4,12,26 2,12,19 3 0,0,0 4,6,20 3 0,0,0 2,6,20 3 8,4,29 3,1,9 2 4,4,29 1,1,9 1 8,4,29 3,1,9 3 4,4,29 1,1,9 3 8,4,29 3,1,9 3 4,4,29 1,1,9 3 8,4,29 3,1,9 3 8,4,26 4,12,24 3 4,4,23 4,12,26 3 0,0,0 2,12,26 3 0,0,0 0,0,0 3 0,0,0 4,1,31 3 0,0,0 2,1,31 3 0,0,0 0,0,0 3 0,0,0 4,6,20 3 0,0,0 2,6,20 3 8,4,29 3,1,9 2 4,4,29 1,1,9 1 8,4,29 3,1,9 3 4,4,29 1,1,9 3 8,4,29 3,1,9 3 4,4,29 1,1,9 3 8,4,29 3,1,9 3 8,4,26 4,12,24 3 4,4,26 2,12,24 3 8,4,23 4,12,26 3 8,4,29 4,12,15 3 4,4,29 2,12,15 3 8,12,11 4,1,31 3 8,12,26 4,12,19 3 4,12,26 2,12,19 3 0,0,0 4,6,20 3 0,0,0 2,6,20 3 255 end return rem starpower music routines GetStarMusic rem * Check for end of current note p=p-1 if p>0 then goto GotMusic bank3 rem * Retrieve channel 0 data temp4 = sread(starpowermusicdata) temp5 = sread(starpowermusicdata) temp6 = sread(starpowermusicdata) rem * Check for end of data if temp4=255 then p = 1 : gosub starpowermusic:goto GetStarMusic rem * Play channel 0 if d{1} || g{4} then goto skipstarmelody AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 skipstarmelody rem * Retrieve channel 1 data temp4 = sread(starpowermusicdata) temp5 = sread(starpowermusicdata) temp6 = sread(starpowermusicdata) rem * Play channel 1 AUDV1 = temp4 AUDC1 = temp5 AUDF1 = temp6 rem * Set duration p = sread(starpowermusicdata) goto GotMusic bank3 rem ***************************************************** rem * Music Data Block rem ***************************************************** rem * Format: rem * v,c,f (channel 0) rem * v,c,f (channel 1) rem * d rem * rem * Explanation: rem * v - volume (0 to 15) rem * c - control [a.k.a. tone, voice, and distortion] (0 to 15) rem * f - frequency (0 to 31) rem * d - duration starpowermusic sdata starpowermusicdata=q 8,4,29 4,1,28 3 4,4,29 2,1,28 1 8,4,29 4,12,14 3 4,4,29 2,12,14 1 8,4,29 4,12,23 3 4,4,29 2,12,23 1 8,12,17 0,0,0 2 8,4,29 4,12,17 2 0,0,0 0,0,0 2 8,4,29 4,12,14 3 4,4,29 2,12,14 1 8,12,17 0,0,0 2 8,4,29 4,12,23 2 8,12,17 4,12,23 2 8,4,29 4,12,17 3 4,4,29 4,12,17 1 8,4,31 4,1,31 3 4,4,29 2,1,31 1 8,4,31 4,12,15 3 4,4,31 2,12,15 1 8,4,31 4,12,26 3 4,4,31 2,12,26 1 8,12,19 0,0,0 2 8,4,31 4,12,19 2 0,0,0 0,0,0 2 8,4,31 4,12,15 3 4,4,31 2,12,15 1 8,12,19 0,0,0 2 8,4,31 4,12,26 2 8,12,19 4,12,26 2 8,4,31 4,12,19 2 8,4,31 4,12,19 3 255 end return