+TwentySixHundred Posted December 21, 2011 Share Posted December 21, 2011 Hi im just starting off using bB but i have ran into a little problem that when i have compiled the code it runs but is just a flashing screen? Probably sounds a bit silly but if some one could point out what i done wrong in the code would be great. Thanks. Oh it seems my project didnt compile or something it says 0k and isnt bas.bin just bas. So how am i going to show the code does AA allow people to post code? Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 21, 2011 Share Posted December 21, 2011 Does AA allow people to post code? Check out the useful AtariAge links near the top of the following page: http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html Quote Link to comment Share on other sites More sharing options...
+TwentySixHundred Posted December 21, 2011 Author Share Posted December 21, 2011 Oh ok thanks here is the bas file i have found in the folder i was trying to upload and yeah i fully understand about people demanding answers. If you can find the time to have a look that would be great and i will still keep looking over my code to find out what i have done wrong.Thanks againdefault.bas Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 21, 2011 Share Posted December 21, 2011 You don't seem to have any working code, just a few rem statements. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted December 21, 2011 Share Posted December 21, 2011 If the compile doesn't succeed, the ROM image may be 0 bytes or some other funky size, in which case it won't run. You can attach bB programs to your posts, but you may need to rename the file to have a TXT file extension if the forum software doesn't like the real extension. I think the BAS extension is okay, but the ASM extension isn't. You can also paste your program into a code window, but attaching a file is usually easier and better. (Sometimes the program listing gets mucked up a bit if you paste it, such as losing leading spaces, or binary numbers not coming out as intended, etc.) One of the most common problems with beginning bB programmers is not indenting the program lines correctly. Line labels are not indented, but code lines must be indented, like this: rem * a simple bB program * COLUBK = $44 : rem * set the background color to red scorecolor = $1A : rem * set the score color to yellow loop drawscreen goto loop "loop" is a line label and is not indented, but the other lines are code lines and must be indented. A single space is enough indentation, but I like to indent at least 3 spaces so the indented lines stand out better from the line labels. (With an indentation of only 1 space, it's a little harder to tell the difference.) Another common problem is not having everything installed correctly, including the environment variables. Or the compile batch file might need to be edited slightly to make it more Windows-friendly (like changing some slashes to backslashes). Another problem may be failure to capitalize the names of the TIA registers (like saying "colubk" instead of "COLUBK"). I would recommend starting with a very simple program, like the one above, to see if you can get it to compile and run correctly. If you can do that, then you can rule out things like setup issues if you do run into problems compiling a more complex program. Once you're able to compile successfully, you might want to modify the compile batch to save a full assembly listing whenever you compile, so you can search through the assembly listing for error messages if a particular program isn't compiling successfully. Quote Link to comment Share on other sites More sharing options...
+TwentySixHundred Posted December 21, 2011 Author Share Posted December 21, 2011 Ok reading on with your tips looks like i got alot to learn but anyway i put the code in a notepad++ bB.txt Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted December 21, 2011 Share Posted December 21, 2011 You don't seem to have any working code, just a few rem statements. Yes, that will not work. Every program-- be it written in batari Basic or assembly code-- must have a loop so it keeps repeating, and it should display something if you want to see something on the screen. So the simplest, most basic bB program looks something like this: loop drawscreen goto loop However, if you compile that program it will run, but the screen will be totally blank (black), because the program never sets any colors or defines any graphical shapes. So if you want to *see* that your program is running successfully, you should at least set the background color with a "COLUBK =" statement, like this: COLUBK = $94 loop drawscreen goto loop That will display a blue screen ($94 is blue) with a black score. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted December 21, 2011 Share Posted December 21, 2011 Ok reading on with your tips looks like i got alot to learn but anyway i put the code in a notepad++ bB.txt That's close, but you need to move a few lines to the left-- line labels must not be indented, and the "end" statement should also not be indented. Also, you've got one line that is checking a missile's position but there's no value after the greater than. I've corrected most of those below, except the missing value after the greater than: playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end COLUBK = $50 COLUPF = 212 player0x=50:player0y=50 player1x=20:player1y=20 missile0height=4:missile0y=255 NUSIZ0 = 16 sprites player0: %00111100 %00011000 %00111100 %00011000 %00111100 %00011000 %00011000 %00000000 end player1: %00000000 %00000000 %00000000 %01011010 %01011010 %10000001 %01000010 %00111100 end if missile0y>then goto skip missile0y = missile0y-2:goto draw_loop skip if joy0fire then missile0y = player0y-2:missile0x=player0x+4 draw_loop drawscreen if player1y < player0y then player1y = player1y+1 if player1y > player0y then player1y = player1y+1 if player1x < player0y then player1x = player1x+1 if player1x > player0y then player1x = player1x+1 player1x = player1x:player1y = player1y if joy0up then player0y = player0y-1:goto jump if joy0down then player0y = player0y+1:goto jump if joy0left then player0x = player0x-1:goto jump if joy0right then player0x = player0x+1:goto jump if collision(missile0.player1)then score=score+1:player1x=rand/2:player1y=missile0y=255 if collision(player0.player1)then score=score-1:player1x=rand/2:player1y=missile0y=255 jump goto sprites Quote Link to comment Share on other sites More sharing options...
+TwentySixHundred Posted December 21, 2011 Author Share Posted December 21, 2011 Thanks alot for the help i fixed the missing value for the missile but have an syntax error with the file im trying to compile. Quote Link to comment Share on other sites More sharing options...
jwierer Posted December 21, 2011 Share Posted December 21, 2011 Why don't you first try to compile some of the samples and start by modifying those. http://www.atariage.com/forums/topic/109288-code-snippets-samples-for-bb-beginners/ -Jeff Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted December 21, 2011 Share Posted December 21, 2011 Thanks alot for the help i fixed the missing value for the missile but have an syntax error with the file im trying to compile. If the syntax error mentions a line number, you might count down to that line to see if you can find the error. Note that spacing between keywords is also important. I think I see a few places where you need a space before a "then" (after a parenthesis). Also, it looks like you're using periods in the collision functions, but they should be commas. Quote Link to comment Share on other sites More sharing options...
+TwentySixHundred Posted December 21, 2011 Author Share Posted December 21, 2011 (edited) Edit: Ok fixed that and now i can get it to run however cant start it lol ,ill just keep working on it newtest1.bas.bin Edited December 21, 2011 by Tony The 2600 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.