Jump to content
IGNORED

Atari 2600 BASIC compiler is here!


batari

Recommended Posts

Just got a chance to look at your code... I think I answered the wrong question before, as the scrolling into the score was a bug in Alpha 0.1.  This has been fixed in Alpha 0.2, so removing the rem in line 80 scrolls properly.  The code needed to be fixed up a bit to compile in Alpha 0.2, since inline asm needs to be indented now.

894152[/snapback]

 

Ok, thanks for looking at it. Just d/l'd the latest, greatest and yes that did fix my scrolling issue. Was going to stick in another couple of quick changes and post a new source, but I've run into another issue. I can't get score to decrement properly. score = score - 1 yields 67.

 

Just to see if it was my program, I changed the following lines in your sample.bas

 

60 if joy0up then score = score + 1

80 if joy0down then score = score - 1

 

Hit up a couple of times, then hit down.

894414[/snapback]

You're right - it's a bug in the compiler. This had been added to the todo list for Alpha 0.3.

Link to comment
Share on other sites

You're right - it's a bug in the compiler.  This had been added to the todo list for Alpha 0.3.

894490[/snapback]

 

Ok. Thanks. I replaced my posted source with a new version that is compatible with the current release (clouds scroll now :) ). I probably won't release another update until the next version of bB comes out.

Edited by s0c7
Link to comment
Share on other sites

Could you perhaps change it? also a little bit because my ide doesnt work with the files in 2600basic.zip and needs the latest version..

 

2600basic.zip ( 110.9k ) Number of downloads: 173 <---

batari_basic_alpha2.zip ( 148.74k ) Number of downloads: 10

894185[/snapback]

Yeah, it doesn't make much sense to continue to have Alpha 0.1 there, so I removed the file.

894487[/snapback]

 

Thanks, lol your a very busy man now, phew.

Edited by attendo
Link to comment
Share on other sites

Ok, thanks for looking at it.  Just d/l'd the latest, greatest and yes that did fix my scrolling issue.  Was going to stick in another couple of quick changes and post a new source, but I've run into another issue.  I can't get score to decrement properly.  score = score - 1 yields 67.

 

Just to see if it was my program, I changed the following lines in your sample.bas

 

60 if joy0up then score = score + 1

80 if joy0down then score = score - 1

894490[/snapback]

Just thinking out loud... One way to do score=score-1 is score=score+999999. This will work now and also will carry over to later versions.

Link to comment
Share on other sites

Just a note, I will keep an archive of versions, just because at some point we might end up with source code that won't turn into ASM with the updated versions.

 

batari, if you get the chance, would you be able to put up a list of "likely" and "possible" and "in a perfect world" features for future versions? Or do you think it might make people too crazy if they don't see or end up getting their favorite features? In particular, I'm wondering about aliases for the A-Z variables and being able to ditch line numbers and to label subroutines with names rather than numbers...

 

Man, I forgot how brutal old school BASIC was...in some ways worse than DASM! There's that famous "GOTO considered harmful" where that one guy thought if a student leans BASIC first, they may be broken for life as a programmer...I know enough programming now that I can compensate (I think) by making myself follow certain patterns, putting everything in subroutines and using comments, but still

 

(I don't mean to sound ungrateful Batari! It's no coincidence that bB is getting me to FINALLY start coding some projects I've been toying with for a long time...)

Link to comment
Share on other sites

Just thinking out loud... One way to do score=score-1 is score=score+999999.  This will work now and also will carry over to later versions.

894543[/snapback]

 

That works as far as the display. I'm also having problems getting score to work correctly in conditional situations. This may be my fault, not sure. Make the following changes to sample.bas to see what I'm talking about. Again, up/down the joystick to increment/decrement the score. The score color doesn't change if it goes over 10. However, if you roll it backwards to 999999 it will change.

 

35 if score > 10 then scorecolor = 80 : goto 45

60 if joy0up then score = score + 1

80 if joy0down then score = score + 999999

Link to comment
Share on other sites

Incidentally, batari, if you want me to write a kernel for you, just let me know - I'd be happy to.  Just tell me what it should do and I'll code it (and actually test it, :lol:).  If you want to write 'em, cool; I just wanted to get the offer on the table.

Hey, are you gonna do requests? ;-)

 

Actually there's an interesting challenge here. Batari should consider writing up a quick standards doc for kernals--ideally they should use as much of the same variables (in terms of positioning things) as is feasible, given the feature layout of the given kernal.

 

I'd love to see that kernal that lets you read in a background from "DATA" like statements.....

Link to comment
Share on other sites

Just thinking out loud... One way to do score=score-1 is score=score+999999.  This will work now and also will carry over to later versions.

894543[/snapback]

 

That works as far as the display. I'm also having problems getting score to work correctly in conditional situations. This may be my fault, not sure. Make the following changes to sample.bas to see what I'm talking about. Again, up/down the joystick to increment/decrement the score. The score color doesn't change if it goes over 10. However, if you roll it backwards to 999999 it will change.

 

35 if score > 10 then scorecolor = 80 : goto 45

60 if joy0up then score = score + 1

80 if joy0down then score = score + 999999

894600[/snapback]

Right now, using the score in an if-then won't work as you expect... Instead, accessing "score" really gives you the BCD value of the highest two digits. You meed to break the score into three individual BCD values by dimming variables, then doing the following checks:

 

dim scorevalue2=score+2

dim scorevalue1=score+1

dim scorevalue0=score

if scorevalue2>$10 || scorevalue1>1 then scorecolor=80:goto 45

if scorevalue0>1 then scorecolor=80:goto 45

 

EDIT: OOPS, error in above, left out the "then"

 

I haven't tried this, but I think it will work.

Edited by batari
Link to comment
Share on other sites

batari, if you get the chance, would you be able to put up a list of "likely" and "possible" and "in a perfect world" features for future versions? Or do you think it might make people too crazy if they don't see or end up getting their favorite features?  In particular, I'm wondering about aliases for the A-Z variables and being able to ditch line numbers and to label subroutines with names rather than numbers...

894552[/snapback]

You must be too busy to read the README :D

Aliases: already in Alpha 0.2

Linenumbers: now optional in Alpha 0.2

Labels: now allowed, but also optional in Alpha 0.2

 

But yeah, I think such a list would be helpful.

Link to comment
Share on other sites

Incidentally, batari, if you want me to write a kernel for you, just let me know - I'd be happy to.  Just tell me what it should do and I'll code it (and actually test it, :lol:).  If you want to write 'em, cool; I just wanted to get the offer on the table.

894565[/snapback]

:cool: I'll PM you with particulars later tonight... I don't want to announce anything publicly until we have something workable.

Link to comment
Share on other sites

Yep, Potatohead is right - the compiler currently doesn't like -1.  Just replace -1 with 255, and it will compile and work how you want it to.  No need to define player 1.

894483[/snapback]

 

Yep, that did the trick. Can't imagine the logic behind this, but hey, if it works, it works!

 

Thanks for the advice. I'll tweak this a little more and see what happens.

 

JR

Link to comment
Share on other sites

Yep, Potatohead is right - the compiler currently doesn't like -1.  Just replace -1 with 255, and it will compile and work how you want it to.  No need to define player 1.

894483[/snapback]

 

Yep, that did the trick. Can't imagine the logic behind this, but hey, if it works, it works!

894662[/snapback]

For an explanation, read the section on negative numbers here:

 

http://alienbill.com/2600/basic/downloads/0.2/help.html

Link to comment
Share on other sites

Look at me! I'm flyin', I'm flyin'!

 

By the way, Player0 will not work as part of an IF/THEN statement. HOWEVER, you can use IF/THEN statements to skip over the shapes you don't wish to use, thus creating limited animation.

 

I have an idea for a video game which may just be possible with Batari BASIC. With some clever programming and a little flicker, I may be able to draw out every onscreen character, with a minimum of those chunky blocks.

 

JR

jtest2.bin

Edited by Jess Ragan
Link to comment
Share on other sites

I seem to be getting a lot of bogus

Max. nested gosubs exceeded in line 65

As far as I can tell I'm not nesting ANY gosubs....just a series of gosubs with each sub returning once it's done... any idea?

894683[/snapback]

Yes, it's bogus, caused by fuzzy thinking on my calculation nested gosubs.

 

Until I fix, a workaround would be to stick inline asm in there:

 

gosub subroutine

 

would become

 

asm

jsr subroutine

end

 

This should work, and bypass the incorrect checking for nested gosubs.

Edited by batari
Link to comment
Share on other sites

I've got a question about the score counter. It only seems to count upwards... any attempts to initialize it or count downward with it end in failure. What I'd like to do is split the score counter into two parts; one for the actual score, then another for a countdown timer which would end the game once it reaches zero. Is there any way to do this?

 

JR

Link to comment
Share on other sites

I know I said I'd wait until the next release..... :ponder:

 

Here is the latest version of F-4.

What's new/changes:

- You now start with a score of 3. For every hit, add 1. For every miss, subtract 1. If your score reaches 0, game over.

- You have to use the reset button to start a game (fire won't do it anymore).

- Revamped the source somewhat. Added even more comments.

 

Big thanks to batari for getting back to me so quick on the questions I posted earlier. I kind of cheated with my solution to the If..Then score issue. :evil:

 

Still some things I want to do, but this is getting close.

 

 

** Update 7/20 - d/l removed. See post 340 for the latest version.

Edited by s0c7
Link to comment
Share on other sites

I've got a question about the score counter.  It only seems to count upwards... any attempts to initialize it or count downward with it end in failure.  What I'd like to do is split the score counter into two parts; one for the actual score, then another for a countdown timer which would end the game once it reaches zero.  Is there any way to do this?

 

JR

894733[/snapback]

There's not really any way to do it right now. But later I might allow two 3 digit scores which would allow you to do this.
Link to comment
Share on other sites

All right, this is the last version of my demo for the day. With any luck, it will evolve into a full-fledged game in the next few days.

 

I couldn't get the ship to properly wrap around the screen, so instead I've created boundaries to keep it in check. Now it's time to bring an enemy to this little party...

 

JR

jgame.bin

Link to comment
Share on other sites

I know I said I'd wait until the next release..... :ponder:

 

Here is the latest version of F-4. 

What's new/changes:

- You now start with a score of 3.  For every hit, add 1.  For every miss, subtract 1.  If your score reaches 0, game over.

- You have to use the reset button to start a game (fire won't do it anymore).

- Revamped the source somewhat.  Added even more comments.

 

Big thanks to batari for getting back to me so quick on the questions I posted earlier.  I kind of cheated with my solution to the If..Then score issue.  :evil:

 

Still some things I want to do, but this is getting close.

894739[/snapback]

 

Geez, this is seriously impressive. The scrolling screen totally floored me, and you came up with a pretty clever way to subtract points from the score. My only complaint is the random enemy movement... the rival jet looks like it's being flown by a coffee addict. Other than that, you've done a most excellent job!

 

JR

Link to comment
Share on other sites

Thanks for your help from the other day. I'm getting closer to completing the game I'm working on. My game is basically running around trying to avoid getting hit by falling pf pixels and a bouncing missile. Because I feel that that may not be great by itself, I've been trying to add everything I could think of including animations for when you reach a certain score, music, and hopefully a title screen. The music is giving me the most trouble right now. I guess I should write a quick program to find out what the TIA can do.

Link to comment
Share on other sites

So I've finally got of my butt and MADE something with this great tool. Not a game, more of a toy...plus, I made a Playfield Graphic Editor that some of you may find useful.

 

The toy name is "NECG DRUMMA v0.1". Screenshot and binary attached I hope. I made extensive use of pfpixel to write the title of the game in the background. It's New England Classic Gamers' own "PacPilgrim" for a simple drum machine: left is bass, right is snare, button is high hat.

 

The quick and dirty tool I made for that is here: the bBpf Editor. You can use the keyboard to enter Xs and.s to draw the pixels, and it translates them to individual pfpixel calls, with a few formatting option. It's not super-well tested, doesn't warn you if you do something that exceeds what bB can do, but it worked pretty well for me!

 

I'm including the text of the game here becuase I think it uses some good practices available with the 0.2 Alpha that I haven't heard much talk about: it shuns line numbers, uses descriptive labels for both goto-locations and variable names.

 

 dim pacMouthTime=a 
dim voice0vol=b
dim voice1vol=c
dim okToReadStick=d

COLUPF = 90

player0x = 128 : player0y = 35
player1x = 127 : player1y = 40

okToReadStick = 1

setHatGraphic player0:
%11111111
%00110100
%00111100
%00111100
%00111100
end

pfpixel 0 0 on : pfpixel 3 0 on : pfpixel 5 0 on : pfpixel 6 0 on
pfpixel 7 0 on : pfpixel 10 0 on : pfpixel 11 0 on : pfpixel 14 0 on
pfpixel 15 0 on : pfpixel 0 1 on : pfpixel 1 1 on : pfpixel 3 1 on
pfpixel 5 1 on : pfpixel 9 1 on : pfpixel 13 1 on : pfpixel 20 1 on
pfpixel 22 1 on : pfpixel 26 1 on : pfpixel 27 1 on : pfpixel 28 1 on
pfpixel 30 1 on : pfpixel 0 2 on : pfpixel 2 2 on : pfpixel 3 2 on
pfpixel 5 2 on : pfpixel 6 2 on : pfpixel 9 2 on : pfpixel 13 2 on
pfpixel 15 2 on : pfpixel 16 2 on : pfpixel 20 2 on : pfpixel 22 2 on
pfpixel 26 2 on : pfpixel 28 2 on : pfpixel 30 2 on : pfpixel 0 3 on
pfpixel 3 3 on : pfpixel 5 3 on : pfpixel 9 3 on : pfpixel 13 3 on
pfpixel 16 3 on : pfpixel 21 3 on : pfpixel 24 3 on : pfpixel 26 3 on
pfpixel 27 3 on : pfpixel 28 3 on : pfpixel 30 3 on : pfpixel 0 4 on
pfpixel 3 4 on : pfpixel 5 4 on : pfpixel 6 4 on : pfpixel 7 4 on
pfpixel 10 4 on : pfpixel 11 4 on : pfpixel 14 4 on : pfpixel 15 4 on
pfpixel 4 6 on : pfpixel 5 6 on : pfpixel 8 6 on : pfpixel 9 6 on
pfpixel 12 6 on : pfpixel 14 6 on : pfpixel 16 6 on : pfpixel 20 6 on
pfpixel 22 6 on : pfpixel 26 6 on : pfpixel 29 6 on : pfpixel 4 7 on
pfpixel 6 7 on : pfpixel 8 7 on : pfpixel 10 7 on : pfpixel 12 7 on
pfpixel 14 7 on : pfpixel 16 7 on : pfpixel 17 7 on : pfpixel 19 7 on
pfpixel 20 7 on : pfpixel 22 7 on : pfpixel 23 7 on : pfpixel 25 7 on
pfpixel 26 7 on : pfpixel 28 7 on : pfpixel 30 7 on : pfpixel 4 8 on
pfpixel 6 8 on : pfpixel 8 8 on : pfpixel 9 8 on : pfpixel 12 8 on
pfpixel 14 8 on : pfpixel 16 8 on : pfpixel 18 8 on : pfpixel 20 8 on
pfpixel 22 8 on : pfpixel 24 8 on : pfpixel 26 8 on : pfpixel 28 8 on
pfpixel 29 8 on : pfpixel 30 8 on : pfpixel 4 9 on : pfpixel 6 9 on
pfpixel 8 9 on : pfpixel 10 9 on : pfpixel 12 9 on : pfpixel 14 9 on
pfpixel 16 9 on : pfpixel 20 9 on : pfpixel 22 9 on : pfpixel 26 9 on
pfpixel 28 9 on : pfpixel 30 9 on : pfpixel 4 10 on : pfpixel 5 10 on
pfpixel 8 10 on : pfpixel 10 10 on : pfpixel 12 10 on : pfpixel 13 10 on
pfpixel 14 10 on : pfpixel 16 10 on : pfpixel 20 10 on : pfpixel 22 10 on
pfpixel 26 10 on : pfpixel 28 10 on : pfpixel 30 10 on

startLoop

rem player1x = 127
player1y = 47


if okToReadStick = 0 then goto doneStick

if joy0left then player1x = 117 : voice0vol = 12 : AUDF0 = 30 : AUDC0 = 15 : okToReadStick = 0 : goto doneStick
if joy0right then player1x = 137 : voice0vol = 8 : AUDF0 = 8 : AUDC0 = 8 : okToReadStick = 0 : goto doneStick


rem if joy0up then player1y = 20
rem if joy0down then player1y = 60

doneStick


if joy0left then goto stickAintClear
if joy0right then goto stickAintClear
okToReadStick = 1;
stickAintClear

if joy0fire then player1y = 37 : voice1vol = 8 : AUDF1 = 0 : AUDC1 = 8

if voice0vol = 0 then goto doneLowerVoice0
voice0vol = voice0vol - 1
doneLowerVoice0
if voice1vol = 0 then goto doneLowerVoice1
voice1vol = voice1vol - 1
doneLowerVoice1


AUDV0 = voice0vol
AUDV1 = voice1vol



if player1x < 127 then player1x = player1x + 1: REFP1 = 8 : REFP0 = 8
if player1x > 127 then player1x = player1x - 1: REFP1 = 0 : REFP0 = 0
if player1y < 47 then player1y = player1y + 1
if player1y > 47 then player1y = player1y - 1




player0y = player0y + 5 
player0x = player0x - 1

if player0x < player1x then player0x = player0x + 1
if player0x > player1x then player0x = player0x - 1
if player0y < player1y then player0y = player0y + 1
if player0y > player1y then player0y = player0y - 1

player0y = player0y - 5 
player0x = player0x + 1


goto doPacGraphic
returnFromPacGraphic

COLUP0 = $04 : COLUP1 = $1C
drawscreen

goto startLoop



doPacGraphic
pacMouthTime = pacMouthTime + 1
if pacMouthTime > 20 then pacMouthTime = 1
if pacMouthTime > 10 then goto setPacGraphic2
setPacGraphic1 player1:
 %00011000
 %00111100
 %01110000
 %01100000
 %01110000
 %00111100
 %00011000
end
goto doneSettingPacGraphic
setPacGraphic2 player1:
%00011000
%00111100
%01111110
%01100000
%01111110
%00111100
%00011000
end
doneSettingPacGraphic
goto returnFromPacGraphic

rem X..X.XXX..XX..XX................
rem XX.X.X...X...X......X.X...XXX.X.
rem X.XX.XX..X...X.XX...X.X...X.X.X.
rem X..X.X...X. .X..X....X..X.XXX.X.
rem X..X.XXX..XX..XX................
rem ................................
rem ....XX..XX..X.X.X...X.X...X..X..
rem ....X.X.X.X.X.X.XX.XX.XX.XX.X.X.
rem ....X.X.XX..X.X.X.X.X.X.X.X.XXX.
rem ....X.X.X.X.X.X.X...X.X...X.X.X.
rem ....XX..X.X.XXX.X...X.X...X.X.X.

post-1875-1121839387.gif

necgdrumma.bin

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...