1 rem Atari OS v1.0, THE GUI for the Atari 2600 2 COLUBK = 0 : COLUP0 = y : COLUP1 = y : player0x = 75 : player0y = 70 : player1x = 91 3 player1y = 70 : NUSIZ0 = $05 : NUSIZ1 = $05 : ballx = 0 : bally = y : c = c + 1 4 if c = 3 then c = c - 3 5 if c = 1 then y = y + 1 6 d = d + 1 7 if d = 14 then AUDV0 = 15 : AUDV1 = 15 : AUDC0 = 12 : AUDC1 = 12 : AUDF0 = 9 : AUDF1 = 9 8 if d = 18 then AUDF0 = 7 : AUDF1 = 7 9 if d = 22 then AUDV0 = 0 : AUDV1 = 0 10 if d = 100 then goto 16 11 if y = 14 then y = y - 2 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 1 16 x = 95 : y = 50 : c = 4 : d = 0 : g = 0 : f = 0 : i = 0 : ballx = 0 : bally = 0 17 pfhline 0 1 31 off : pfpixel 16 0 off : pfpixel 16 2 off 18 pfhline 0 8 31 off : pfpixel 16 4 off : pfpixel 16 6 off 19 pfvline 0 1 7 off : pfpixel 16 8 off : pfpixel 16 10 off 20 pfvline 31 1 7 off 21 if switchbw then goto 87 22 if !switchleftb && !switchrightb then a = 132 23 if switchleftb && !switchrightb then a = 66 24 if !switchleftb && switchrightb then a = 194 25 if switchleftb && switchrightb then a = 54 26 COLUBK = a : COLUP0 = 14 : COLUP1 = 14 : scorecolor = a : 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 28 if d = 1 then player1x = 41 : player1y = 30 29 if d = 0 then missile0x = 0 : missile0y = 0 : missile0height = 0 30 if d = 1 then 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 AUDV0 = 15 : AUDC0 = 12 : AUDF0 = 4 : AUDV1 = 15 : AUDC1 = 12 : AUDF1 = 4 49 c = 2 50 goto 21 51 AUDV0 = 0 : AUDV1 = 0 52 goto 35 53 d = 0 54 pfhline 0 1 31 off 55 pfhline 0 8 31 off 56 pfvline 0 1 7 off 57 pfvline 31 1 7 off 58 AUDV0 = 15 : AUDC0 = 12 : AUDF0 = 6 : AUDV1 = 15 : AUDC1 = 12 : AUDF1 = 6 59 c = 2 60 goto 21 61 t = 1 62 if x < 20 then t = 0 63 if x > 28 then t = 0 64 if y < 7 then t = 0 65 if y > 15 then t = 0 66 if t = 1 && d = 0 then goto 43 67 t = 1 68 if x < 153 then t = 0 69 if x > 157 then t = 0 70 if y < 11 then t = 0 71 if y > 14 then t = 0 72 if t = 1 && d = 1 then goto 53 73 t = 1 74 if x < 41 then t = 0 75 if x > 49 then t = 0 76 if y < 22 then t = 0 77 if y > 30 then t = 0 78 if t = 1 && d = 1 then goto 117 79 goto 21 80 COLUBK = 0 : COLUPF = 0 : COLUP0 = 14 : COLUP1 = 14 : scorecolor = 0 : player0x = 85 : player0y = 70 : player1x = 93 : player1y = 70 : missile0x = 0 : missile0y = 0 : missile1x = 0 : missile1y = 0 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 : player1x = 93 : player1y = 60 : d = d + 1 88 if !switchbw then goto 21 89 if d = 10 then c = c + 1 90 if d = 10 then d = d - 10 : if c = 12 then c = c - 12 91 if c = 0 then player0: %11100011 %10010010 %10001010 %11001010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00101010 %00111011 end 92 if c = 0 then player1: %10001110 %10010010 %10100010 %10100110 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10111000 end 93 if c = 1 then player0: %01110011 %01001010 %01000110 %01100110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00011111 end 94 if c = 1 then player1: %10011110 %10100010 %11000010 %11000110 %11011000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11001000 %11111000 end 95 if c = 2 then player0: %01110111 %01001101 %01000101 %01100101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00010101 %00011111 end 96 if c = 2 then player1: %01111100 %10000100 %00000100 %00001100 %01110000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %11110000 end 97 if c = 3 then player0: %00111000 %00100111 %00100110 %00110110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00010110 %00011111 end 98 if c = 3 then player1: %11111100 %00000100 %00000100 %00000100 %11111000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %11111000 end 99 if c = 4 then player0: %00110011 %00101100 %00101000 %00111000 %00011011 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011111 end 100 if c = 4 then player1: %11111000 %00001000 %00001000 %00001000 %11110000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %11110000 end 101 if c = 5 then player0: %00110111 %00111000 %00010000 %00010000 %00010111 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00011111 end 102 if c = 5 then player1: %11111000 %00001000 %00001000 %00010000 %11110000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %11110000 end 103 if c = 6 then player0: %00011111 %00010000 %00010000 %00010000 %00011111 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00011111 end 104 if c = 6 then player1: %11111000 %00001000 %00001000 %00001000 %11111000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %11111000 end 105 if c = 7 then player0: %00011111 %00010000 %00010000 %00001000 %00001111 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001111 end 106 if c = 7 then player1: %11101100 %00011100 %00001000 %00001000 %11101000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %11111000 end 107 if c = 8 then player0: %00011111 %00010000 %00010000 %00010000 %00001111 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001111 end 108 if c = 8 then player1: %11001100 %00110100 %00010100 %00011100 %11011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %11111000 end 109 if c = 9 then player0: %00111111 %00100000 %00100000 %00100000 %00011111 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00010000 %00011111 end 110 if c = 9 then player1: %00011100 %11100100 %01100100 %01101100 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %11111000 end 111 if c = 10 then player0: %00111110 %00100001 %00100000 %00110000 %00001110 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001000 %00001111 end 112 if c = 10 then player1: %11101110 %10110010 %10100010 %10100110 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %10101000 %11111000 end 113 if c = 11 then player0: %01111001 %01000101 %01000011 %01100011 %00011011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00010011 %00011111 end 114 if c = 11 then player1: %11001110 %01010010 %01100010 %01100110 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %01101000 %11111000 end 115 drawscreen 116 goto 1 117 pfhline 0 1 31 off 118 pfhline 0 8 31 off 119 pfvline 0 1 7 off 120 pfvline 31 1 7 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 SpeedX = 255 : SpeedY = 1 : scorecolor = 15 Score1 = 0 : Score2 = 0 : pause = 1 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 AUDC0 = 12 : AUDF0 = 8 if collision(player0, ball) then AUDC1 = 12 : AUDF1 = 8 if collision(player0, ball) then AUDV0 = 15 : AUDV1 = 15 if collision(player0, ball) then s = 3 if collision(player1, ball) then AUDC0 = 12 : AUDF0 = 8 if collision(player1, ball) then AUDC1 = 12 : AUDF1 = 8 if collision(player1, ball) then AUDV0 = 15 : AUDV1 = 15 if collision(player1, ball) then s = 3 if bally = 5 || bally = 90 then AUDC0 = 12 : AUDF0 = 9 if bally = 5 || bally = 90 then AUDC1 = 12 : AUDF1 = 9 if bally = 5 || bally = 90 then AUDV0 = 15 : AUDV1 = 15 if bally = 5 || bally = 90 then s = 3 if pause = 1 && v = 0 && w = 1 then AUDC0 = 12 : AUDF0 = 3 if pause = 1 && v = 0 && w = 1 then AUDC1 = 12 : AUDF1 = 3 if pause = 1 && v = 0 && w = 1 then AUDV0 = 15 : AUDV1 = 15 if pause = 1 && v = 0 && w = 1 then s = 3 if pause = 1 then v = 1 s = s - 1 if s = 0 then AUDV0 = 0 : AUDV1 = 0 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 temp1 = temp1 - 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