Jump to content



1

bB newbie in need of some help


11 replies to this topic

#1 Tony The 2600 OFFLINE  

Tony The 2600

    Star Raider

  • 76 posts
  • 1.19 MHz
  • Location:Australia

Posted Tue Dec 20, 2011 10:58 PM

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?

#2 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 20,923 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Tue Dec 20, 2011 11:00 PM

View PostTony The 2600, on Tue Dec 20, 2011 10:58 PM, said:

Does AA allow people to post code?

Check out the useful AtariAge links near the top of the following page:

http://www.randomter...c-commands.html

#3 Tony The 2600 OFFLINE  

Tony The 2600

    Star Raider

  • 76 posts
  • 1.19 MHz
  • Location:Australia

Posted Tue Dec 20, 2011 11:16 PM

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 againAttached File  default.bas   363bytes   21 downloads

#4 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 20,923 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Tue Dec 20, 2011 11:19 PM

You don't seem to have any working code, just a few rem statements.

#5 SeaGtGruff ONLINE  

SeaGtGruff

    River Patroller

  • 4,546 posts
  • Location:Georgia, USA

Posted Tue Dec 20, 2011 11:37 PM

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.

#6 Tony The 2600 OFFLINE  

Tony The 2600

    Star Raider

  • 76 posts
  • 1.19 MHz
  • Location:Australia

Posted Tue Dec 20, 2011 11:40 PM

Ok reading on with your tips looks like i got alot to learn but anyway i put the code in a notepad++
Attached File  bB.txt   1.57K   29 downloads

#7 SeaGtGruff ONLINE  

SeaGtGruff

    River Patroller

  • 4,546 posts
  • Location:Georgia, USA

Posted Tue Dec 20, 2011 11:46 PM

View PostRandom Terrain, on Tue Dec 20, 2011 11:19 PM, said:

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.

#8 SeaGtGruff ONLINE  

SeaGtGruff

    River Patroller

  • 4,546 posts
  • Location:Georgia, USA

Posted Tue Dec 20, 2011 11:51 PM

View PostTony The 2600, on Tue Dec 20, 2011 11:40 PM, said:

Ok reading on with your tips looks like i got alot to learn but anyway i put the code in a notepad++
Attachment 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


#9 Tony The 2600 OFFLINE  

Tony The 2600

    Star Raider

  • 76 posts
  • 1.19 MHz
  • Location:Australia

Posted Wed Dec 21, 2011 12:03 AM

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.

#10 jwierer ONLINE  

jwierer

    Dragonstomper

  • 746 posts
  • Location:Seattle,WA

Posted Wed Dec 21, 2011 12:09 AM

Why don't you first try to compile some of the samples and start by modifying those.
http://www.atariage....r-bb-beginners/

-Jeff

#11 SeaGtGruff ONLINE  

SeaGtGruff

    River Patroller

  • 4,546 posts
  • Location:Georgia, USA

Posted Wed Dec 21, 2011 12:14 AM

View PostTony The 2600, on Wed Dec 21, 2011 12:03 AM, said:

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.

#12 Tony The 2600 OFFLINE  

Tony The 2600

    Star Raider

  • 76 posts
  • 1.19 MHz
  • Location:Australia

Posted Wed Dec 21, 2011 12:44 AM

Edit: Ok fixed that and now i can get it to run however cant start it lol ,ill just keep working on it

Attached Files


Edited by Tony The 2600, Wed Dec 21, 2011 1:29 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users