;*************************************************************** ; ; Code written by Caleb Yoder (ChilePepper) ; ; Special thanks to all the wonderful folks at AtariAge who helped me with my many issues: ; KevKelly, bogax, Lillapodkenaon, TwentySixHundred, KaeruYojimbo, ; Gemintronic, Karl G, and of course, Random Terrain. ; Thank you all for showing me the amazing world of Atari 2600 programming! ; ;*************************************************************** set romsize 16k set kernel_options no_blank_lines ;*************************************************************** ; ; Variable aliases go here (DIMs). ; ; You can have more than one alias for each variable. ; If you use different aliases for bit operations, ; it's easier to understand and remember what they do. ; ; I start variable aliases with one underscore so I won't ; have to worry that I might be using bB keywords by mistake. ; I also start labels with two underscores for the same ; reason. The second underscore also makes labels stand out ; so I can tell at a glance that they are labels and not ; variables. ; ; Use bit operations any time you need a simple off/on ; variable. One variable essentially becomes 8 smaller ; variables when you use bit operations. ; ; I start my bit aliases with "_Bit" then follow that ; with the bit number from 0 to 7, then another underscore ; and the name. Example: _Bit0_Reset_Restrainer ; ;``````````````````````````````````````````````````````````````` ; Playfield color. ; dim _PF_Color = a ;``````````````````````````````````````````````````````````````` ; Background color. ; dim _BK_Color = b ;``````````````````````````````````````````````````````````````` ; All-purpose bits for various jobs. ; dim _BitOp_01 = y dim _Bit0_Reset_Restrainer = y ;``````````````````````````````````````````````````````````````` ; Makes better random numbers. ; dim rand16 = z ;*************************************************************** ;*************************************************************** ; ; PROGRAM START/RESTART ; ; __Start_Restart ;*************************************************************** ; ; Mutes volume of both sound channels. ; AUDV0 = 0 : AUDV1 = 0 ;*************************************************************** ; ; Moves ball off screen. ; ballx = 200 : bally = 200 ;*************************************************************** ; ; Clears most normal variables. The variable z is used for ; random numbers in this program and clearing it would mess ; up those random numbers. ; a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 0 : h = 0 : i = 0 j = 0 : k = 0 : l = 0 : m = 0 : n = 0 : o = 0 : p = 0 : q = 0 : r = 0 s = 0 : t = 0 : u = 0 : v = 0 : w = 0 : x = 0 : y = 0 ;*************************************************************** ;*************************************************************** ; ; TITLE SCREEN SETUP ; ; __Title_Screen_Setup ;*************************************************************** ; ; Sets up the playfield. ; playfield: ................................ ................................ ................................ .XX..X.XXX.X...XX..X..X...X.XX.. X...X.X.X.X.X.X...X.X.XX.XX.X.X. X...XXX.X.XXX.X...X.X.X.X.X.XX.. X...X.X.X.X.X.X...X.X.X...X.X.X. .XX.X.X.X.X.X..XX..X..X...X.XX.. ................................ ................................ ................................ end ;*************************************************************** ; ; Sets colors of background and playfield. ; COLUBK = 0 COLUPF = 2 ;*************************************************************** ; ; Restrains the reset switch for the title screen loop. ; ; This bit fixes it so the reset switch becomes inactive if ; it hasn't been released after being pressed once. ; _Bit0_Reset_Restrainer{0} = 1 ;*************************************************************** ;*************************************************************** ; ; TITLE SCREEN LOOP ; ; __Title_Screen_Loop ;*************************************************************** ; ; Displays the screen. ; drawscreen ;*************************************************************** ; ; Reset/fire check and end of title screen loop. ; ;``````````````````````````````````````````````````````````````` ; Turns off reset restrainer bit and jumps to beginning of ; title loop if reset/fire is not pressed. ; if !switchreset && !joy0fire then _Bit0_Reset_Restrainer{0} = 0 : goto __Title_Screen_Loop ;``````````````````````````````````````````````````````````````` ; Jumps to beginning of title loop if the reset switch hasn't ; been released after being pressed. ; if _Bit0_Reset_Restrainer{0} then goto __Title_Screen_Loop ;``````````````````````````````````````````````````````````````` ; Starts the game. ; _Bit0_Reset_Restrainer{0} = 1 : goto __Main_Loop_Setup ;*************************************************************** ;*************************************************************** ; ; MAIN LOOP SETUP ; ; __Main_Loop_Setup ballx = 80 : bally = 80 ballheight = 4 CTRLPF = $21 ;*************************************************************** ;*************************************************************** ; ; RANDOM SCREEN JUMP ; ; __Random_Screen temp5 = rand if temp5 < 15 then goto __S_1 if temp5 >= 15 && temp5 < 30 then goto __S_2 if temp5 >= 30 && temp5 < 45 then goto __S_3 if temp5 >= 45 && temp5 < 60 then goto __S_4 if temp5 >= 60 && temp5 < 75 then goto __S_5 bank2 if temp5 >= 75 && temp5 < 90 then goto __S_6 bank2 if temp5 >= 90 && temp5 < 105 then goto __S_7 bank2 if temp5 >= 105 && temp5 < 120 then goto __S_8 bank2 if temp5 >= 120 && temp5 < 135 then goto __S_9 bank2 if temp5 >= 135 && temp5 < 150 then goto __S_10 bank3 if temp5 >= 150 && temp5 < 165 then goto __S_11 bank3 if temp5 >= 165 && temp5 < 180 then goto __S_12 bank3 if temp5 >= 180 && temp5 < 195 then goto __S_13 bank3 if temp5 >= 195 && temp5 < 210 then goto __S_14 bank4 if temp5 >= 210 && temp5 < 225 then goto __S_15 bank4 if temp5 >= 225 && temp5 < 240 then goto __S_16 bank4 if temp5 >= 240 then goto __S_17 bank4 ;*************************************************************** ;*************************************************************** ; ; MAIN LOOP ; ; __Main_Loop ;*************************************************************** ; ; Sets colors of background and playfield. ; COLUBK = _BK_Color COLUPF = _PF_Color ;*************************************************************** ; ; Displays the screen. ; drawscreen ;*************************************************************** ; ; Player movement. ; if joy0up then bally = bally - 1 if joy0down then bally = bally + 1 if joy0left then ballx = ballx - 1 if joy0right then ballx = ballx + 1 ;*************************************************************** ; ; Moves to new room if player goes too far. ; if bally < 4 then ballx = 80 : bally = 80 : goto __Random_Screen if bally > 85 then ballx = 80 : bally = 6 : goto __Random_Screen if ballx < 5 then ballx = 150 : bally = 46 : goto __Random_Screen if ballx > 155 then ballx = 6 : bally = 46 : goto __Random_Screen ;*************************************************************** ; ; Reset switch check and end of main loop. ; ; Any Atari 2600 program should restart when the reset ; switch is pressed. It is part of the usual standards ; and procedures. ; ;``````````````````````````````````````````````````````````````` ; Turns off reset restrainer bit and jumps to beginning of ; main loop if the reset switch is not pressed. ; if !switchreset then _Bit0_Reset_Restrainer{0} = 0 : goto __Main_Loop ;``````````````````````````````````````````````````````````````` ; Jumps to beginning of main loop if the reset switch hasn't ; been released after being pressed. ; if _Bit0_Reset_Restrainer{0} then goto __Main_Loop ;``````````````````````````````````````````````````````````````` ; Restarts the program. ; goto __Start_Restart __S_1 playfield: XXXXXXXXXXXXX......XXXXXXXXXXXXX X..............................X X..............................X X..............................X ................................ ................................ ................................ X..............................X X..............................X X..............................X XXXXXXXXXXXXX......XXXXXXXXXXXXX end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop __S_2 playfield: XXXXXXXXXXXXX......XXXXXXXXXXXXX X..............................X X..............................X X..............................X ..............XXXX.............. .............X....X............. .............X....X............. X.............XXXX.............X X..............................X X..............................X XXXXXXXXXXXXX......XXXXXXXXXXXXX end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop __S_3 playfield: XXXXXXXXXXXXX......XXXXXXXXXXXXX X..............................X X..X........................X..X X..............................X ................................ ................................ ................................ X..............................X X..X........................X..X X..............................X XXXXXXXXXXXXX......XXXXXXXXXXXXX end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop __S_4 playfield: .....XXXXXXXX......XXXXXXXX..... ....X......................X.... ...X........................X... ..X..........................X.. ................................ ................................ ................................ ..X..........................X.. ...X........................X... ....X......................X.... .....XXXXXXXX......XXXXXXXX..... end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank 2 __S_5 playfield: .XX.XX.XX.XX........XX.XX.XX.XX. X..X..X..X..X......X..X..X..X..X X..............................X X..............................X ................................ ................................ ................................ X..............................X X..............................X X..X..X..X..X......X..X..X..X..X .XX.XX.XX.XX........XX.XX.XX.XX. end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_6 playfield: X..............................X ................................ ................................ ...........X.XXXXX.X............ ............X.X.X.X............. ............XX.X.XX............. ............X.X.X.X............. ...........X.XXXXX.X............ ................................ ................................ X..............................X end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_7 playfield: ...............................X ...............................X ...............................X ...............................X ................................ ................................ ................................ ...............................X ...............................X ...............................X ...............................X end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_8 playfield: X............................... X............................... X.....................XXXXX..... X..........................X.... ........................X..X.... ...........................X.... ......................XXXXX..... X............................... X............................... X............................... X............................... end _BK_Color = 244 _PF_Color = 240 goto __Main_Loop bank1 __S_9 playfield: XXXXXXXXXXXXX......XXXXXXXXXXXXX X...........X......X...........X X.X........X........X........X.X XX............................XX ................................ ................................ ................................ XX............................XX X.X........X........X........X.X X...........X......X...........X XXXXXXXXXXXXX......XXXXXXXXXXXXX end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 bank 3 __S_10 playfield: XXXXXXXXXXXXX......XXXXXXXXXXXXX X.....X.....X......X.....X.....X X..............................X XXX..........................XXX ................................ ................................ ................................ XXX..........................XXX X..............................X X.....X.....X......X.....X.....X XXXXXXXXXXXXX......XXXXXXXXXXXXX end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_11 playfield: X.X.X.X.X.X.X......X.X.X.X.X.X.X ................................ X..............................X X..............................X ................................ ................................ ................................ X..............................X X..............................X ................................ X.X.X.X.X.X.X......X.X.X.X.X.X.X end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_12 playfield: X.........X..........X.........X .X.........X........X.........X. ..X.........X......X.........X.. ...XXXXXXXXXX......XXXXXXXXXX... ................................ ................................ ................................ ...XXXXXXXXXX......XXXXXXXXXX... ..X.........X......X.........X.. .X.........X........X.........X. X.........X..........X.........X end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_13 playfield: X..............................X .XXX........................XXX. ....X......................X.... ..X.X......................X.X.. ...X........................X... ................................ ................................ ................................ ................................ ................................ ................................ end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 bank 4 __S_14 playfield: X..........X........X..........X .X..........X......X..........X. X..............................X .X............................X. ................................ ................................ ................................ .X............................X. X..............................X .X..........X......X..........X. X..........X........X..........X end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_15 playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X............XXXXX.............X X...........X.....X............X X..........X...X...X...........X X..............................X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end _BK_Color = 244 _PF_Color = 24 goto __Main_Loop bank1 __S_16 playfield: X..X........................X..X ..X..........................X.. XX............................XX ................................ ................................ ................................ ................................ ................................ XX............................XX ..X..........................X.. X..X........................X..X end _BK_Color = 244 _PF_Color = 2 goto __Main_Loop bank1 __S_17 playfield: X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end _BK_Color = 244 _PF_Color = 64 goto __Main_Loop bank1