include div_mul.asm set romsize 16kSC rem set kernel_options no_blank_lines data way 0,0,0,1,1,1,0,0,0 end ;``````````````````````````````````````````````````````````````` ; Splits up the score into 3 parts. ; dim _sc1 = score dim _sc2 = score+1 dim _sc3 = score+2 ;*************************************************************** ; ; Enables pfscore bars. ; const pfscore = 1 ;*************************************************************** ; ; Sets up pfscore bars. ; pfscore1 = %10101010 : pfscore2 = %11111111 const _P_Edge_Top = 9 const _P_Edge_Bottom = 88 const _P_Edge_Left = 1 const _P_Edge_Right = 153 const _M_Edge_Top = 2 const _M_Edge_Bottom = 88 const _M_Edge_Left = 2 const _M_Edge_Right = 159 dim frame_counter = a dim p0_direction = i dim p1_shape = j dim p1_direction = k dim p1_fire = l dim timer = m dim _BitOp_P0_M0_Dir = n dim _Bit0_P0_Dir_Up = n dim _Bit1_P0_Dir_Down = n dim _Bit2_P0_Dir_Left = n dim _Bit3_P0_Dir_Right =n dim _Bit4_M0_Dir_Up = n dim _Bit5_M0_Dir_Down = n dim _Bit6_M0_Dir_Left = n dim _Bit7_M0_Dir_Right = n dim _Bit0_Reset_Restrainer = y dim _Bit7_M0_Moving = y const pfres=32 __Start_Restart timer = 0 frame_counter=0 p0_direction = 0 player1y = 0 scorecolor = $CB pfscorecolor = $CB p1_fire = 0 AUDV0 = 0 : AUDV1 = 0 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 : z = 0 player0x = 77 : player0y = 53 player1x = 40 : player1y = 0 missile0x = 200 : missile0y = 200 NUSIZ0 = $25 : missile0height = 4 COLUPF = $96 _Bit3_P0_Dir_Right{3} = 1 _Bit0_Reset_Restrainer{0} = 1 ;*************************************************************** ; ; Sets up the playfield. ; playfield: .X.............X....X......X.... ................................ ................................ ...X.....X....X................X ................................ .................X.............. ..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.......... ....X...........X............... ................................ ..............................X. ...X......X.......X.......X..... ................................ .....................X.......X.. ......X......................... ................................ end ;*************************************************************** ; ; Sets ball on playfield ; ballheight = 4 CTRLPF = $21 : rem * Ball 4 pixels wide. ;*************************************************************** ;*************************************************************** ; ; MAIN LOOP (MAKES THE PROGRAM GO) ; ; p0_direction = 1 p1_shape = 0 NUSIZ1 = $16 __Main_Loop if collision(missile0,player1) then p1_shape=4 : gosub explosion if p1_fire = 0 then _skip_collison rem if collision(missile0,playfield) then score = score + 1 temp5 = missile0height + 4 rem temp6 = (missile0y-temp5)/3 temp6 = (missile0y)/3 temp4 = (missile0x-17)/4 rem pfpixel temp4 temp6 on if pfread(temp4,temp6) then pfpixel temp4 temp6 off : score = score + 1 _skip_collison timer = timer + 1 if p1_shape = 4 then frame_counter = frame_counter + 1 if timer = 2 && player1x < player0x then player1x = player1x + 1 if timer = 2 && player1x > player0x then player1x = player1x - 1 if timer = 2 then player1y = player1y + 4 if player1y > 100 then player1y = 0 if p0_direction = 1 && timer = 4 then pfscroll down : pfscroll down if p0_direction = 0 && timer = 4 then pfscroll up if p0_direction = 3 && timer = 4 then pfscroll right if p0_direction = 2 && timer = 4 then pfscroll left if p0_direction = 0 then NUSIZ0 = $10 : missile0height = 4 if p0_direction = 1 then NUSIZ0 = $10 : missile0height = 4 if p0_direction = 2 then NUSIZ0 = $30 : missile0height = 1 if p0_direction = 3 then NUSIZ0 = $30 : missile0height = 1 _p0_move if p1_shape = 0 && p1_fire = 1 then missile1y = missile1y + 2 if p1_shape = 1 && p1_fire = 1 then missile1y = missile1y - 2 if p1_shape = 2 && p1_fire = 1 then missile1x = missile1x + 4 if p1_shape = 3 && p1_fire = 1 then missile1x = missile1x - 4 if frame_counter = 30 then frame_counter = 0 : AUDV1 = 0 : AUDC1 = 0 : AUDF1 = 0 : p1_shape = 0 : player1y = 0 : player1x = (rand&127) if timer = 4 then timer = 0 if joy0down then p0_direction = 0 if joy0up then p0_direction = 1 if joy0right then p0_direction = 2 if joy0left then p0_direction = 3 if p1_shape = 0 then gosub Shape1 if p1_shape = 1 then gosub Shape2 if p1_shape = 2 then gosub Shape3 if p1_shape = 3 then gosub Shape4 if p1_shape = 4 then gosub Shape5 if p1_shape = 0 then NUSIZ1 = $10 if p1_shape = 1 then NUSIZ1 = $10 if p1_shape = 2 then NUSIZ1 = $20 if p1_shape = 3 then NUSIZ1 = $20 if p1_shape = 0 && p1_fire = 1 && missile1y > _P_Edge_Bottom then p1_fire = 0 if p1_shape = 1 && p1_fire = 1 && missile1y < _P_Edge_Top then p1_fire = 0 if p1_shape = 2 && p1_fire = 1 && missile1x > _P_Edge_Right then p1_fire = 0 if p1_shape = 3 && p1_fire = 1 && missile1x < 10 then p1_fire = 0 if p1_shape = 0 && p1_fire = 0 then p1_fire = 1 : missile1x = player1x + 4 : missile1y = player1y + 7 : missile1height = 4 if p1_shape = 1 && p1_fire = 0 then p1_fire = 1 : missile1x = player1x + 4 : missile1y = player1y - 9 : missile1height = 4 if p1_shape = 2 && p1_fire = 0 then p1_fire = 1 : missile1x = player1x + 12 : missile1y = player1y - 3 : missile1height = 1 if p1_shape = 3 && p1_fire = 0 then p1_fire = 1 : missile1x = player1x - 4 : missile1y = player1y - 3 : missile1height = 1 rem runter if p0_direction = 0 then player0: %00011000 %00111100 %00011000 %00011000 %10111101 %11111111 %11011011 %10000001 end rem hoch if p0_direction = 1 then player0: %10000001 %11011011 %11111111 %10111101 %00011000 %00011000 %00111100 %00011000 end rem rechts if p0_direction = 2 then player0: %11110000 %01100000 %00110010 %01111111 %01111111 %00110010 %01100000 %11110000 end rem links if p0_direction = 3 then player0: %00001111 %00000110 %01001100 %11111110 %11111110 %01001100 %00000110 %00001111 end ;*************************************************************** ; ; Sets sprite colors. ; COLUP1 = $5C COLUP0 = $1E COLUPF = $96 ;*************************************************************** ; ; Joystick movement precheck. ; ;``````````````````````````````````````````````````````````````` ; Skips section if joystick hasn't been moved. ; if !joy0up && !joy0down && !joy0left && !joy0right then goto __Skip_Joystick_Precheck ;``````````````````````````````````````````````````````````````` ; Clears player0 direction bits since joystick has been moved. ; _BitOp_P0_M0_Dir = _BitOp_P0_M0_Dir & %11110000 __Skip_Joystick_Precheck ;*************************************************************** ; ; Joy0 up check. ; ;``````````````````````````````````````````````````````````````` ; Skips this section if joystick isn't moved up. ; if !joy0up then goto __Skip_Joy0_Up ;``````````````````````````````````````````````````````````````` ; Turns on the up direction bit. ; _Bit0_P0_Dir_Up{0} = 1 ;``````````````````````````````````````````````````````````````` ; Skips this section if hitting the edge. ; if player0y <= _P_Edge_Top then goto __Skip_Joy0_Up ;``````````````````````````````````````````````````````````````` ; Moves player0 up. ; player0y = player0y - 1 __Skip_Joy0_Up ;*************************************************************** ; ; Joy0 down check. ; ;``````````````````````````````````````````````````````````````` ; Skips this section if joystick isn't moved down. ; if !joy0down then goto __Skip_Joy0_Down ;``````````````````````````````````````````````````````````````` ; Turns on the down direction bit. ; _Bit1_P0_Dir_Down{1} = 1 ;``````````````````````````````````````````````````````````````` ; Skips this section if hitting the edge. ; if player0y >= _P_Edge_Bottom then goto __Skip_Joy0_Down ;``````````````````````````````````````````````````````````````` ; Moves player0 down. ; player0y = player0y + 1 __Skip_Joy0_Down ;*************************************************************** ; ; Joy0 left check. ; ;``````````````````````````````````````````````````````````````` ; Skips this section if joystick isn't moved to the left. ; if !joy0left then goto __Skip_Joy0_Left ;``````````````````````````````````````````````````````````````` ; Turns on the left direction bit. ; _Bit2_P0_Dir_Left{2} = 1 ;``````````````````````````````````````````````````````````````` ; Skips this section if hitting the edge. ; if player0x <= _P_Edge_Left then goto __Skip_Joy0_Left ;``````````````````````````````````````````````````````````````` ; Moves player0 to the left. ; player0x = player0x - 1 __Skip_Joy0_Left ;*************************************************************** ; ; Joy0 right check. ; ;``````````````````````````````````````````````````````````````` ; Skips this section if joystick isn't moved to the right. ; if !joy0right then goto __Skip_Joy0_Right ;``````````````````````````````````````````````````````````````` ; Turns on the right direction bit. ; _Bit3_P0_Dir_Right{3} = 1 ;``````````````````````````````````````````````````````````````` ; Skips this section if hitting the edge. ; if player0x >= _P_Edge_Right then goto __Skip_Joy0_Right ;``````````````````````````````````````````````````````````````` ; Moves player0 to the right. ; player0x = player0x + 1 __Skip_Joy0_Right ;*************************************************************** ; ; Fire button check. ; ; Turns on missile1 movement if fire button is pressed and ; missile1 is not moving. ; ;``````````````````````````````````````````````````````````````` ; Skips this section if the fire button is not pressed. ; if !joy0fire then goto __Skip_Fire ;``````````````````````````````````````````````````````````````` ; If missile0 is moving, skip this subsection. ; if _Bit7_M0_Moving{7} then goto __Skip_Fire ;``````````````````````````````````````````````````````````````` ; Turns on missile0 movement. ; _Bit7_M0_Moving{7} = 1 ;``````````````````````````````````````````````````````````````` ; Takes a 'snapshot' of player0 direction so missile0 will ; stay on track until it hits something. ; _Bit4_M0_Dir_Up{4} = _Bit0_P0_Dir_Up{0} _Bit5_M0_Dir_Down{5} = _Bit1_P0_Dir_Down{1} _Bit6_M0_Dir_Left{6} = _Bit2_P0_Dir_Left{2} _Bit7_M0_Dir_Right{7} = _Bit3_P0_Dir_Right{3} ;``````````````````````````````````````````````````````````````` ; Sets up starting position of missile0. ; if _Bit4_M0_Dir_Up{4} then missile0x = player0x + 4 : missile0y = player0y - 5 if _Bit5_M0_Dir_Down{5} then missile0x = player0x + 4 : missile0y = player0y - 1 if _Bit6_M0_Dir_Left{6} then missile0x = player0x + 2 : missile0y = player0y - 3 if _Bit7_M0_Dir_Right{7} then missile0x = player0x + 6 : missile0y = player0y - 3 __Skip_Fire ;*************************************************************** ; ; Missile0 movement check. ; ;``````````````````````````````````````````````````````````````` ; Skips this section if missile0 isn't moving. ; if !_Bit7_M0_Moving{7} then goto __Skip_Missile ;``````````````````````````````````````````````````````````````` ; Moves missile0 in the appropriate direction. ; if _Bit4_M0_Dir_Up{4} then missile0y = missile0y - 2 if _Bit5_M0_Dir_Down{5} then missile0y = missile0y + 2 if _Bit6_M0_Dir_Left{6} then missile0x = missile0x - 2 if _Bit7_M0_Dir_Right{7} then missile0x = missile0x + 2 if _Bit4_M0_Dir_Up{4} then temp5 = (missile1x+4)/4 : temp6 = (missile1y-5)/3 if _Bit5_M0_Dir_Down{5} then temp5 = (missile1x+4)/4 : temp6 = (missile1y-1)/3 if _Bit6_M0_Dir_Left{6} then temp5 = (missile1x+2)/4 : temp6 = (missile1y-3)/3 if _Bit7_M0_Dir_Right{7} then temp5 = (missile1x+6)/4 : temp6 = (missile1y-3)/3 _skip_erase ;``````````````````````````````````````````````````````````````` ; Clears missile0 if it hits the edge of the screen. ; if missile0y < _M_Edge_Top then goto __Delete_Missile if missile0y > _M_Edge_Bottom then goto __Delete_Missile if missile0x < _M_Edge_Left then goto __Delete_Missile if missile0x > _M_Edge_Right then goto __Delete_Missile ;``````````````````````````````````````````````````````````````` ; Skips rest of section if no collision. ; goto __Skip_Missile __Delete_Missile ;``````````````````````````````````````````````````````````````` ; Clears missile0 moving bit and moves missile0 off the screen. ; _Bit7_M0_Moving{7} = 0 : missile0x = 200 : missile0y = 200 __Skip_Missile ;*************************************************************** ; ; Displays the screen. ; drawscreen ;*************************************************************** ; ; 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 Shape1 player1: %00100100 %00100100 %01111110 %01111110 %11100111 %11100111 %01111110 %00111100 end return Shape2 player1: %00111100 %01111110 %11100111 %11100111 %01111110 %01111110 %00100100 %00100100 end return Shape3 player1: %00110000 %01111100 %11111111 %11001100 %11001100 %11111111 %01111100 %00110000 end return Shape4 player1: %00001100 %00111110 %11111111 %00110011 %00110011 %11111111 %00111110 %00001100 end return Shape5 player1: %01000001 %00100000 %01001010 %00010100 %00100010 %01010000 %00000100 %00100000 end return Shape6 player1: %00100100 %01000010 %00111100 %01100110 %11111111 %01011010 end return Shape7 player1: %00011000 %00111100 %00111100 %11111111 %01111110 %11111111 %00111100 %00111100 %00011000 end return Shape8 player1: %00011000 %01111110 %01101110 %11111111 %01110110 %01111110 %00011000 end return Shape9 player1: %00011000 %00111100 %01111110 %11000011 %11100111 %11000011 %01111110 %00011000 end return Shape10 player1: %00111100 %01111110 %11100111 %11000011 %11100111 %01111110 %00111100 end return Shape11 player1: %00111100 %11100111 %00111100 %00011000 end return _collision_missile_playfield temp3 = (player0x-17)/4 temp6 = (player0y/4)-2 pfpixel temp3 temp6 on rem if pfread(temp3,temp6) then pfpixel temp3 temp6 off return explosion missile1y = 200 missile1x = 200 AUDV1 = 8 : AUDC1 = 8 : AUDF1 = 14 if b >= 180 then AUDV1 = 0 : AUDC1 = 0 : AUDF1 = 0 : rem ende sound player1: %01000001 %00100000 %01001010 %00010100 %00100010 %01010000 %00000100 %00100000 end return