Primordial Ooze Posted March 25, 2008 Share Posted March 25, 2008 (edited) I am getting this error: ---------- Capture Output ----------> "C:\Atari2600\bB\2600bas.bat" C:\Projects\Atari2600\OpenSourcePong\OpenSourcePong.bas 2600 Basic compilation complete. DASM V2.20.07, Macro Assembler ©1988-2003 bytes of ROM space left --> start f1b6 > Terminated with exit code 0. Any ideas? Here is my code: rem Open Source Pong rem an Open Source Pong Remake rem Updated: March 17, 2008 rem Website: http://opensourcepong.freepgs.com goto setup rem setup all the game variables setup rem include for player scores multikernel include playerscores.asm rem include bcd math helper include bcd_math.asm rem set the rom size set romsize 2k rem define the number of player scores const playerscores = 2 rem define noscores constant const noscore = 1 rem set kernel options rem readpaddle - set it so the paddle controlers are read set kernel_options no_blank_lines readpaddle rem set an alias for the ball's x velocity dim ballxvelocity = a rem set an alias for the ball's y velocity dim ballyvelocity = b rem set an alias for troggling the 2 player mode dim playervsplayer = c rem set an alias for the sound effects timer dim soundeffectstimer = d rem set an alias for weither high boink should play dim hiboinkplaying = e rem set an alias for weither low boink should play dim loboinkplaying = f rem color the background green COLUBK = 198 rem set the color of the playfield to white COLUPF = 14 rem set player 2's score color to his sprite color player0scorecolor = $1C rem set player 1's score color to his sprite color player1scorecolor = $8C rem define the playfield playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end rem define player 1's sprite player0: %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 end rem define player 2's sprite player1: %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 end rem finished seting up the game variables rem start the game loop goto startNewGame rem start a new game and reset everything that was changed during rem the course of the game startNewGame rem set player 1's inital x positon player0x = 140 rem set player 1's inital y positon player0y = 45 rem set a default value for the 2 player troggle playervsplayer = 0 rem if the left switch is set to B, paddle 1 controls the rem computers paddle if !switchleftb then playervsplayer = 1 rem set player2's inital x positon player1x = 15 rem set player2's inital y positon player1y = 45 rem set ball's inital x positon ballx = 80 rem set ball's inital y positon bally = 45 rem set the ball's initial x velocity ballxvelocity = 1 rem set the ball's initial x velocity ballyvelocity = 1 rem reset player 1's score player0score = $00 rem reset player 1's score player1score = $00 rem reset high boink playing to 0 hiboinkplaying = 0 rem reset low boink playing to 0 loboinkplaying = 0 rem finished reseting all the game variables changed during rem the course of the game rem go to the game loop goto gameLoop rem start of the game loop gameLoop rem if the user presses the reset switch, start a new game if switchreset then goto startNewGame rem color player 1's paddle COLUP0 = 140 rem color player 2's paddle COLUP1 = 28 rem read paddle 0, use it to position player 1 across the screen currentpaddle = 0 rem draw the game screen drawscreen rem set player1's y position to the paddle control's axis rem plus 8 player0y = paddle + 8 rem make sure player 1 doesn't go off the top screen if player0y < 16 then player0y = 16 rem make sure player 1 doesn't go off the bottom screen if player0y > 79 then player0y = 79 rem if the 2 player mode is activated then paddle 1 controls the rem second paddle if playervsplayer = 1 then gosub player2controls rem otherwise set player 2's y position to the balls y position if playervsplayer = 0 then player1y = bally rem make sure player 2 doesn't go off the top screen if player1y < 16 then player1y = 16 rem make sure player 2 doesn't go off the bottom screen if player1y > 79 then player1y = 79 rem move the ball ballx = ballx + ballxvelocity bally = bally + ballyvelocity rem make sure the ball doesn't go off the top screen if bally < 9 then ballyvelocity = 0 - ballyvelocity rem make sure the ball doesn't go off the bottom screen if bally > 77 then ballyvelocity = 0 - ballyvelocity rem if the ball collides with player 1's paddle if collision(player0, ball) then gosub player1collision rem if highboinkplaying is 1 then play the high boink sound effect if hiboinkplaying = 1 then gosub hiboink rem if the ball collides with player 2's paddle if collision(player1, ball) then gosub player2collision rem if loghboinkplaying is 1 then play the low boink sound effect if loboinkplaying = 1 then gosub loboink rem if the ball goes past player 1's paddle if ballx > 160 then gosub player2scores rem if the ball goes past the computer paddle if ballx < 1 then gosub player1scores rem if player 1 scores 11 points then its game if player0score > $10 then goto gameover rem if player 2 scores 11 points then its game if player1score > $10 then goto gameover goto gameLoop rem end of the game loop code, restart the game loop rem code for handling collision between player and ball player1collision rem set high boink playing to 1 hiboinkplaying = 1 rem move the ball a bit so it doesn't stick ballx = ballx - 3 rem and reverse its x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 1 collision code rem code for handling the high boink sound effect hiboink rem increase the music timer musictimer = musictimer + 1 rem play the high bounk sound effect AUDV0 = 12 AUDC0 = 7 AUDF0 = 3 rem if 1 second has passed then don't play the boink sound rem anymore if musictimer > 59 then AUDV0 = 0 if musictimer > 59 then hiboinkplaying = 0 if musictimer > 59 then musictimer = 0 return rem end of high boink code rem code for handling when the ball hits player 2's paddle player2collision rem set low boink playing to 1 loboinkplaying = 1 rem move the ball a bit so it doesn't stick ballx = ballx + 3 rem and reverse its x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 2 collision code rem code for handling the low boink sound effect loboink rem increase the music timer musictimer = musictimer + 1 rem play the low bounk sound effect AUDV0 = 12 AUDC0 = 7 AUDF0 = 3 rem if 1 second has passed then don't play the boink sound rem anymore if musictimer > 59 then AUDV0 = 0 if musictimer > 59 then loboinkplaying = 0 if musictimer > 59 then musictimer = 0 return rem end of low boink code rem code for handling when the ball goes past player 2's paddle rem and the player 1 scores player1scores rem increase player 1's score by 1 player1score = addbcd(player1score,1) rem have the computer serve the ball ballx = player1x + 3 bally = player1y - 5 rem reverse the balls x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 1 scores rem code for handling when player 1 misses the ball and rem player 2 scores player2scores rem increase player 2's score by 1 player0score = addbcd(player0score,1) rem have the player serve the ball ballx = player0x - 3 bally = player0y - 5 rem reverse the balls x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 2 scores code rem code for handling when the 2 player troggle is enabled and rem the second paddle controls the computer paddle player2controls rem read paddle 1, use it to position player 2's paddle across the screen currentpaddle = 1 rem draw the game screen drawscreen rem set player 2's y position to the paddle 2's control's axis rem plus 8 player1y = paddle + 8 return rem end of player 2 controls code rem code for handling when either players score reaches 11 rem and its gameover gameover rem if the user presses the reset switch, start a new game if switchreset then goto startNewGame rem color player 1's paddle COLUP0 = 140 rem color player 2's paddle COLUP1 = 28 rem draw the screen drawscreen rem if the user presses the fire button, start a new game if joy0left then goto startNewGame rem otherwise just keep looping goto gameover Please let me know at your earliest convenience. Sincerely, Open Source Pong Edited March 25, 2008 by Open Source Pong Quote Link to comment Share on other sites More sharing options...
Fort Apocalypse Posted March 26, 2008 Share Posted March 26, 2008 (edited) goto setup rem setup all the game variables setup That goto is unnecessary. Labels don't interrupt the flow of code. In fact if you don't have a return or goto code will just run "off" the end of your source if you let it! rem include for player scores multikernel include playerscores.asm rem include bcd math helper include bcd_math.asm Did you actually download and put the playerscores.asm and the other asm (I think it is bcd_math.asm but I forget. it mentions it in the playerscores thread) into the includes directory under the bB install that your IDE is using? Also, these should be at the *end* of the source, not the beginning, at least in a 4k game. and they should be inline instead of include so take those out and put these at the end: rem should be last lines in game inline playerscores.asm inline bcd_math.asm let's move on... rem set the rom size set romsize 2k I don't know if they will work in 2k or not. Try it with 4k (or just don't define since 4k is default). I'd think 2k would work though. rem define the number of player scores const playerscores = 2 rem define noscores constant const noscore = 1 rem set kernel options rem readpaddle - set it so the paddle controlers are read set kernel_options no_blank_lines readpaddle rem set an alias for the ball's x velocity dim ballxvelocity = a rem set an alias for the ball's y velocity dim ballyvelocity = b rem set an alias for troggling the 2 player mode dim playervsplayer = c rem set an alias for the sound effects timer dim soundeffectstimer = d rem set an alias for weither high boink should play dim hiboinkplaying = e rem set an alias for weither low boink should play dim loboinkplaying = f rem color the background green COLUBK = 198 rem set the color of the playfield to white COLUPF = 14 rem set player 2's score color to his sprite color player0scorecolor = $1C rem set player 1's score color to his sprite color player1scorecolor = $8C I'm not sure but I think you have to define the player0scorecolor and player1scorecolor before every drawscreen. rem define the playfield playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end This is a waste for a few reasons: * You can use: pfclear pfhline 0 0 31 on pfhline 0 10 31 on instead (or if you want to get tricky do the pfscroll upup hack to get an extra playfield line of resolution - see other threads for better explanation, because you can only do it once I think, so you have to set a flag showing you did it and check for that flag if you do that trick). BUT I would just leave out the lines - you don't need them as the ball could just bounce off the top and bottom. You might also try PF0 for border to see if that would help (but that would be more for sides). rem define player 1's sprite player0: %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 end rem define player 2's sprite player1: %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 end Instead of doing this, use either ball and missile1 (if want no lined playfield) or missile0 and missile1 and use TIA registers to make width 2 (NUSIZ0=$10 : NUSIZ1=$10 : CTRLPF=$11 - notice that ball/playfield TIA is defined with 1 at end and not 0!) and use missile1height, ballheight to make height 8. rem finished seting up the game variables rem start the game loop goto startNewGame rem start a new game and reset everything that was changed during rem the course of the game startNewGame rem set player 1's inital x positon player0x = 140 rem set player 1's inital y positon player0y = 45 rem set a default value for the 2 player troggle playervsplayer = 0 rem if the left switch is set to B, paddle 1 controls the rem computers paddle if !switchleftb then playervsplayer = 1 rem set player2's inital x positon player1x = 15 rem set player2's inital y positon player1y = 45 rem set ball's inital x positon ballx = 80 rem set ball's inital y positon bally = 45 rem set the ball's initial x velocity ballxvelocity = 1 rem set the ball's initial x velocity ballyvelocity = 1 rem reset player 1's score player0score = $00 rem reset player 1's score player1score = $00 rem reset high boink playing to 0 hiboinkplaying = 0 rem reset low boink playing to 0 loboinkplaying = 0 rem finished reseting all the game variables changed during rem the course of the game rem go to the game loop goto gameLoop rem start of the game loop gameLoop rem if the user presses the reset switch, start a new game if switchreset then goto startNewGame rem color player 1's paddle COLUP0 = 140 rem color player 2's paddle COLUP1 = 28 rem read paddle 0, use it to position player 1 across the screen currentpaddle = 0 rem draw the game screen drawscreen rem set player1's y position to the paddle control's axis rem plus 8 player0y = paddle + 8 rem make sure player 1 doesn't go off the top screen if player0y < 16 then player0y = 16 rem make sure player 1 doesn't go off the bottom screen if player0y > 79 then player0y = 79 rem if the 2 player mode is activated then paddle 1 controls the rem second paddle if playervsplayer = 1 then gosub player2controls rem otherwise set player 2's y position to the balls y position if playervsplayer = 0 then player1y = bally rem make sure player 2 doesn't go off the top screen if player1y < 16 then player1y = 16 rem make sure player 2 doesn't go off the bottom screen if player1y > 79 then player1y = 79 rem move the ball ballx = ballx + ballxvelocity bally = bally + ballyvelocity rem make sure the ball doesn't go off the top screen if bally < 9 then ballyvelocity = 0 - ballyvelocity rem make sure the ball doesn't go off the bottom screen if bally > 77 then ballyvelocity = 0 - ballyvelocity rem if the ball collides with player 1's paddle if collision(player0, ball) then gosub player1collision rem if highboinkplaying is 1 then play the high boink sound effect if hiboinkplaying = 1 then gosub hiboink rem if the ball collides with player 2's paddle if collision(player1, ball) then gosub player2collision rem if loghboinkplaying is 1 then play the low boink sound effect if loboinkplaying = 1 then gosub loboink rem if the ball goes past player 1's paddle if ballx > 160 then gosub player2scores rem if the ball goes past the computer paddle if ballx < 1 then gosub player1scores rem if player 1 scores 11 points then its game if player0score > $10 then goto gameover rem if player 2 scores 11 points then its game if player1score > $10 then goto gameover goto gameLoop rem end of the game loop code, restart the game loop rem code for handling collision between player and ball player1collision rem set high boink playing to 1 hiboinkplaying = 1 rem move the ball a bit so it doesn't stick ballx = ballx - 3 rem and reverse its x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 1 collision code rem code for handling the high boink sound effect hiboink rem increase the music timer musictimer = musictimer + 1 rem play the high bounk sound effect AUDV0 = 12 AUDC0 = 7 AUDF0 = 3 rem if 1 second has passed then don't play the boink sound rem anymore if musictimer > 59 then AUDV0 = 0 if musictimer > 59 then hiboinkplaying = 0 if musictimer > 59 then musictimer = 0 Don't do that. Use this: if musictimer > 59 then AUDV0 = 0 : hiboinkplaying = 0 : musictimer = 0 and you shouldn't need hiboinkplaying either I'd think. save a variable and just change the TIA reg with the frequency of the beep and reset the timer whenever there is a collision and set vol to 0 when timer hits limit. and now back to the program... return rem end of high boink code rem code for handling when the ball hits player 2's paddle player2collision rem set low boink playing to 1 loboinkplaying = 1 rem move the ball a bit so it doesn't stick ballx = ballx + 3 rem and reverse its x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 2 collision code rem code for handling the low boink sound effect loboink rem increase the music timer musictimer = musictimer + 1 rem play the low bounk sound effect AUDV0 = 12 AUDC0 = 7 AUDF0 = 3 rem if 1 second has passed then don't play the boink sound rem anymore if musictimer > 59 then AUDV0 = 0 if musictimer > 59 then loboinkplaying = 0 if musictimer > 59 then musictimer = 0 return rem end of low boink code rem code for handling when the ball goes past player 2's paddle rem and the player 1 scores player1scores rem increase player 1's score by 1 player1score = addbcd(player1score,1) rem have the computer serve the ball ballx = player1x + 3 bally = player1y - 5 rem reverse the balls x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 1 scores rem code for handling when player 1 misses the ball and rem player 2 scores player2scores rem increase player 2's score by 1 player0score = addbcd(player0score,1) rem have the player serve the ball ballx = player0x - 3 bally = player0y - 5 rem reverse the balls x velocity ballxvelocity = 0 - ballxvelocity return rem end of player 2 scores code rem code for handling when the 2 player troggle is enabled and rem the second paddle controls the computer paddle player2controls rem read paddle 1, use it to position player 2's paddle across the screen currentpaddle = 1 rem draw the game screen drawscreen rem set player 2's y position to the paddle 2's control's axis rem plus 8 player1y = paddle + 8 return rem end of player 2 controls code rem code for handling when either players score reaches 11 rem and its gameover gameover rem if the user presses the reset switch, start a new game if switchreset then goto startNewGame rem color player 1's paddle COLUP0 = 140 rem color player 2's paddle COLUP1 = 28 rem draw the screen drawscreen rem if the user presses the fire button, start a new game if joy0left then goto startNewGame rem otherwise just keep looping goto gameover Hope that helps Edited March 26, 2008 by Fort Apocalypse Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.