1 rem Atari OS v1.0, THE GUI for the Atari 2600 2 COLUBK = 0 : ballx = 0 COLUP0 = y : COLUP1 = y : bally = y player0x = 75 player1x = 91 3 player1y = 70 : player0y = 70 NUSIZ0 = $05 : NUSIZ1 = $05 c = c + 1 4 if c = 3 then c = 0 5 if c = 1 then y = y + 1 6 d = d + 1 7 if d = 14 then temp1 = 9 : gosub audio_on 8 if d = 18 then AUDF0 = 7 : AUDF1 = 7 9 if d = 22 then gosub audio_off 10 if d = 100 then goto 16 11 if y = 14 then y = 12 12 player0: %00111100 %01000010 %10000001 %10000001 %10000001 %10000001 %01000010 %00111100 %00000000 %00000000 %11110001 %11110001 %11111001 %11111001 %00011101 %00011101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 %00001101 end 13 player1: %00111110 %01000001 %00000001 %00000001 %00111110 %01000000 %01000001 %00111110 %00000000 %00000000 %10001111 %10001111 %10011111 %10011111 %10111000 %10111000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 %10110000 end 14 drawscreen 15 goto 2 16 x = 95 y = 50 c = 4 d = 0 : g = 0 : f = 0 : i = 0 : ballx = 0 : bally = 0 gosub pflines_off pfpixel 16 0 off pfpixel 16 2 off pfpixel 16 4 off pfpixel 16 6 off pfpixel 16 8 off pfpixel 16 10 off 21 if switchbw then goto 87 22 if !switchleftb then if !switchrightb then a = 132 else a = 194 23 if switchleftb then if !switchrightb then a = 66 else a = 54 26 COLUBK = a : scorecolor = a COLUP0 = 14 : COLUP1 = 14 NUSIZ0 = $20 NUSIZ1 = $10 COLUPF = 10 missile1x = x missile1y = y missile1height = 2 player0x = 20 player0y = 15 27 if d = 0 then player1x = 0 : player1y = 0 : missile0x = 0 : missile0y = 0 : missile0height = 0 28 if d = 1 then player1x = 41 : player1y = 30 : missile0x = 154 : missile0y = 14 : missile0height = 3 31 player0: %00111100 %00011000 %11111111 %10000001 %10000001 %10000001 %10000001 %11111111 end 32 player1: %11111111 %10000001 %10110001 %10111101 %10110101 %10111101 %10000001 %11111111 end 33 c = c - 1 34 if c = 0 then goto 51 35 drawscreen 36 if switchselect then goto 80 37 if joy0fire then goto 61 38 if joy0up && y > 3 then y = y - 1 39 if joy0down && y < 87 then y = y + 1 40 if joy0left && x > 16 then x = x - 1 41 if joy0right && x < 174 then x = x + 1 42 goto 21 43 d = 1 44 pfhline 0 1 31 on 45 pfhline 0 8 31 on 46 pfvline 0 1 7 on 47 pfvline 31 1 7 on 48 temp1 = 4 : gosub audio_on 49 c = 2 50 goto 21 51 gosub audio_off 52 goto 35 53 d = 0 gosub pflines_off 58 temp1 = 6 : gosub audio_on 59 c = 2 60 goto 21 61 t = 1 62 if x < 20 || x > 28 then t = 0 64 if y < 7 || y > 15 then t = 0 66 if t = 1 && d = 0 then goto 43 67 t = 1 68 if x < 153 || x > 157 then t = 0 70 if y < 11 || y > 14 then t = 0 72 if t = 1 && d = 1 then goto 53 73 t = 1 74 if x < 41 || x > 49 then t = 0 76 if y < 22 || y > 30 then t = 0 78 if t = 1 && d = 1 then goto 117 79 goto 21 80 COLUBK = 0 : COLUPF = 0 : scorecolor = 0 : missile0x = 0 : missile0y = 0 : missile1x = 0 : missile1y = 0 COLUP0 = 14 : COLUP1 = 14 player0x = 85 player0y = 70 : player1y = 70 player1x = 93 81 player0: %00000000 %10010100 %10010100 %11010100 %10000110 %11010100 %00000000 %00000000 %10001001 %10001001 %11101001 %10101101 %11101001 %00000000 %00000000 %00000000 %00000000 %01000101 %10100100 %10100100 %10100100 %00000000 %00000000 %01001000 %10100100 %10101000 %01000100 %00000000 %00000000 %10100100 %11100100 %10101110 %11000100 end 82 player1: %00000000 %11000000 %10000000 %11000000 %10000000 %11000000 %00000000 %00000000 %10110110 %00010010 %10110110 %00100100 %10110110 %00000000 %00000000 %00000000 %00000000 %00100000 %01010000 %01010000 %00100000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %10101001 %11101001 %10101100 %11001001 end 83 drawscreen 84 if switchbw then goto 87 85 if joy0fire then goto 21 86 goto 80 87 COLUBK = 0 COLUP0 = 14 : COLUP1 = 14 player0x = 85 player0y = 60 : player1y = 60 player1x = 93 d = d + 1 88 if !switchbw then goto 21 89 if d = 10 then c = c + 1 : d = 0 : if c = 12 then c = 0 91 if c = 0 then gosub c_0 93 if c = 1 then gosub c_1 95 if c = 2 then gosub c_2 97 if c = 3 then gosub c_3 99 if c = 4 then gosub c_4 101 if c = 5 then gosub c_5 103 if c = 6 then gosub c_6 105 if c = 7 then gosub c_7 107 if c = 8 then gosub c_8 109 if c = 9 then gosub c_9 111 if c = 10 then gosub c_10 113 if c = 11 then gosub c_11 115 drawscreen 116 goto 1 117 gosub pflines_off 121 missile0x = 0 : missile0y = 0 : missile1x = 0 : missile1y = 0 if switchbw then goto 87 rem bBASIC Pong for Atari OS rem ======================== rem Define our variables dim Paddle1X = a dim Paddle1Y = b dim Paddle2X = c dim Paddle2Y = d dim BallX = e dim BallY = f dim SpeedX = g dim SpeedY = h dim Score1 = m dim Score2 = n dim jitter = o dim pause = p dim ScoreMid = score+1 rem Set default values Paddle1X = 20 : Paddle1Y = 20 : Paddle2Y = 20 Paddle2X = 160 BallX = 120 BallY = 80 w = 0 : Score1 = 0 : Score2 = 0 SpeedX = 255 SpeedY = 1 : pause = 1 scorecolor = 15 gosub RandomizeJitter score = 0 dim preblank = score+1 score = score + 0 preblank = preblank || $AA rem Set paddle graphics player0: %11110000 %11110000 %11110000 %11110000 %11110000 %11110000 %11110000 %11110000 %11110000 %11110000 end player1: %00001111 %00001111 %00001111 %00001111 %00001111 %00001111 %00001111 %00001111 %00001111 %00001111 end rem Draw Playfield pfpixel 16 0 on pfpixel 16 2 on pfpixel 16 4 on pfpixel 16 6 on pfpixel 16 8 on pfpixel 16 10 on MainLoop player0x = Paddle1X player0y = Paddle1Y player1x = Paddle2X player1y = Paddle2Y ballx = BallX bally = BallY COLUP0 = 15 : COLUP1 = 15 : COLUPF = 15 COLUBK = 0 ballheight = 2 CTRLPF = $11 if collision(player0, ball) then temp1 = 8 : gosub audio_on : s = 3 if collision(player1, ball) then temp1 = 8 : gosub audio_on : s = 3 if bally = 5 || bally = 90 then temp1 = 9 : gosub audio_on : s = 3 if pause = 1 && v = 0 && w = 1 then temp1 = 3 : gosub audio_on : s = 3 if pause = 1 then v = 1 s = s - 1 if s = 0 then gosub audio_off drawscreen if joy0fire && i = 1 then pause = 0 if !joy0fire then i = 1 if switchreset then goto 16 if pause > 0 then goto MainLoop w = 1 v = 0 if joy0up then Paddle1Y = Paddle1Y - 1 if joy0down then Paddle1Y = Paddle1Y + 1 BallX = BallX + SpeedX BallY = BallY + SpeedY temp1 = Paddle2Y - jitter - 2 temp2 = Paddle2Y + jitter temp3 = BallY + 4 : rem The ball seems to be off a bit. This should correct. if SpeedX > 127 then goto SkipAI if temp3 < temp1 then Paddle2Y = Paddle2Y - 1 if temp3 > temp2 then Paddle2Y = Paddle2Y + 1 SkipAI if Paddle1Y < 15 then Paddle1Y = 15 if Paddle1Y > 90 then Paddle1Y = 90 if Paddle2Y < 15 then Paddle2Y = 15 if Paddle2Y > 90 then Paddle2Y = 90 if BallY <= 5 then temp1 = SpeedY + SpeedY : SpeedY = SpeedY - temp1 if BallY >= 90 then temp1 = SpeedY + SpeedY : SpeedY = SpeedY - temp1 if SpeedX > 127 && collision(player0, ball) then temp1 = SpeedX + SpeedX : SpeedX = SpeedX - temp1 if SpeedX > 127 goto CheckScore if SpeedX > 0 && collision(player1, ball) then temp1 = SpeedX + SpeedX : SpeedX = SpeedX - temp1 : gosub RandomizeJitter CheckScore if BallX < 15 then Score2 = Score2 + 1 : BallX = 120 : gosub SetBallHeight : pause = 1 : gosub RandomizeJitter if BallX > 170 then Score1 = Score1 + 1 : BallX = 40 : gosub SetBallHeight : pause = 1 : jitter = 4 score = 0 dim blank = score+1 score = score + Score2 for i = 0 to Score1 if i < Score1 then score = score + 10000 next i blank = blank || $AA rem ScoreMid = ScoreMid || $AA goto MainLoop RandomizeJitter jitter = rand NormalizeJitter if jitter > 8 then jitter = jitter - 8 : goto NormalizeJitter return SetBallHeight temp1 = rand NormalizeBallHeight if temp1 > 55 then temp1 = temp1 - 55 : goto NormalizeBallHeight BallY = temp1 + 25 return audio_on AUDV0 = 15 : AUDV1 = 15 AUDC0 = 12 : AUDC1 = 12 AUDF0 = temp1 : AUDF1 = temp1 return audio_off AUDV0 = 0 : AUDV1 = 0 return c_0 player0: %11100011 %10010010 %10001010 %11001010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00111011 end player1: %10001110 %10010010 %10100010 %10100110 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10111000 end return c_1 player0: %01110011 %01001010 %01000110 %01100110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00011111 end player1: %10011110 %10100010 %11000010 %11000110 %11011000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11111000 end return c_2 player0: %01110111 %01001101 %01000101 %01100101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00011111 end player1: %01111100 %10000100 %00000100 %00001100 %01110000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %11110000 end return c_3 player0: %00111000 %00100111 %00100110 %00110110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00011111 end player1: %11111100 %00000100 %00000100 %00000100 %11111000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %11111000 end return c_4 player0: %00110011 %00101100 %00101000 %00111000 %00011011 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011111 end player1: %11111000 %00001000 %00001000 %00001000 %11110000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %11110000 end return c_5 player0: %00110111 %00111000 %00010000 %00010000 %00010111 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00011111 end player1: %11111000 %00001000 %00001000 %00010000 %11110000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %11110000 end return c_6 player0: %00011111 %00010000 %00010000 %00010000 %00011111 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00011111 end player1: %11111000 %00001000 %00001000 %00001000 %11111000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %11111000 end return c_7 player0: %00011111 %00010000 %00010000 %00001000 %00001111 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001111 end player1: %11101100 %00011100 %00001000 %00001000 %11101000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %11111000 end return c_8 player0: %00011111 %00010000 %00010000 %00010000 %00001111 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001111 end player1: %11001100 %00110100 %00010100 %00011100 %11011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %11111000 end return c_9 player0: %00111111 %00100000 %00100000 %00100000 %00011111 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00011111 end player1: %00011100 %11100100 %01100100 %01101100 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %11111000 end return c_10 player0: %00111110 %00100001 %00100000 %00110000 %00001110 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001111 end player1: %11101110 %10110010 %10100010 %10100110 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %11111000 end return c_11 player0: %01111001 %01000101 %01000011 %01100011 %00011011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00011111 end player1: %11001110 %01010010 %01100010 %01100110 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %11111000 end return pflines_off pfhline 0 1 31 off pfhline 0 8 31 off pfvline 0 1 7 off pfvline 31 1 7 off return