IGNORED

# 7800basic beta, the release thread

## Recommended Posts

Thank you a million.

Cool! A new version of 7800basic!

Another question.

The Rand function produces a random number between 1 and 255.

Is there a way to limit the number? Say a number from 1 to 10?

I'm use to Atari Basic which has RND(1) which produces a random number from 0.00 to 1.00. Then you just tack on a *(some number) to make your limit.

10 A=INT(RND(1)*10)

Which would give you a number form 0 to 9.

Since I can't think of a way to do this in 7800basic.

Allan

##### Share on other sites

That would be pretty expensive, in terms of cycles, why don't you just use AND's?

E.G. RND() & 7 = 0 to 7, or RND() & 31 = 0 to 31

##### Share on other sites

Yep, that's the quick way.

Allan, there's more information on using & to reduce random ranges at RT's bB guide, and it applies equally well to 7800basic.

Thanks, guys.

Allan

##### Share on other sites

This one has initial pokey support. It will autodetect pokey in the standard cart memory location, and it should do the same for XBoard and XM hardware. (I'm unable to confirm)

MESS has the XM/Xboard/Versaboard additional POKEY location mapped and the program finds it...

##### Share on other sites

For sure. MESS is the emulator I use when developing 7800basic, and the fact that it found POKEY in that location gives me confidence. But until someone confirms its working on real XM/XBoard/Versaboard hardware, I'll keep the disclaimer.

Edited by RevEng
##### Share on other sites

I'll have to dl mess if I get started on programing on the 7800

##### Share on other sites

Excellent improvement! I like having the POKEY commands ... here's a couple of other things:

Is there a provision for setting the AUDCTL register? This is a multipurpose audio register, which amongst many other things, allows for you to engage 16-bit POKEY mode ... where you can join two channels and increase your note resolution to \$FFFF (65535). I used this trick for the Bentley Bear title music to get the low bass notes using distortion 10. Other settings involve fancy things like high-pass filters, or setting two-tone serial mode. On the Atari XL this is used to facilitate cassette or disk i/o, but it can also be used to make unique sounds.

This is a fairly good reference for AUDCTL and other things POKEY: http://www.atariarchives.org/dere/chapt07.php

One other possibility, is a DSOUND command (like in TurboBASIC), of the format:

DSOUND channel,note,waveform,volume

channel can be from 0 to 1, which determines whether channels 0 and 1, or 2 and 3 get joined. note is 0-65535, waveform and volume are as with psound command.

So basically, in ML terms, to use 16-bit mode, you would need to set bits 3 or 4 (to engage the 16-bit mode) and 5 or 6 (to change the clock rates on the combined channels to 1.79 mHz) ... the latter is needed so that you can get playable notes. In simpler terms: \$20 in AUDCTL joins channel 0 and 1, \$80 joins channel 2 and 3.

When combined, the first PAUDC register is set to \$00. Volume and waveform are controlled from the second PAUDC register. The frequency is stored in both PAUDF registers, of the order: PAUDF0+256*PAUDF1

Hope this is of some help.

##### Share on other sites

Excellent improvement! I like having the POKEY commands ... here's a couple of other things:

Is there a provision for setting the AUDCTL register?

Sort of. There's a short entry in the docs on setting the pokey registers with assembly. This is a bit different than the usual way of setting the registers, as 7800basic uses indirect addressing because the pokey location can vary.

Eventually I'll get dsound implemented and wrap up some of the trickier stuff in a bow, but for now you can do it the assembly way. (and optionally still use psound to change the 16-bit frequencies one at a time)

##### Share on other sites

(runs install.bat)

"YOU NEED A COPY OF SETX BEFORE YOU CAN BEGIN."

(installs SetX, runs install.bat again)

"YOU NEED A COPY OF SETX BEFORE YOU CAN BEGIN."

(makes noise Sideshow Bob did after he stepped on a rake for the thirteenth time)

We're not off to a great start here.

##### Share on other sites

If you open a CMD window and type "setx" does Windows find it? Also which version of Windows?

##### Share on other sites

It says ERROR: INVALID SYNTAX when I attempt to run SetX. My Windows version is 7.

##### Share on other sites

OK, sounds like setx is failing for some other reason than not being present.

I'm just tied up, but I'll write up some manual instructions a bit later today.

I'm just tied up

##### Share on other sites

That's pretty much it.

Jess, could you please download and move this .bat to your 7800basic directory, and double-click on it in there? It should create an error.txt file, which will help me figure out where things are failing.

install_win_debug.zip

##### Share on other sites

Will give that a shot.

##### Share on other sites

```ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).
Type "SETX /?" for usage.

```

This is what comes up.

##### Share on other sites

Is there a space in the 7800 directory path? If so, for now relocate it so its in a path without a space, and try the install again.

Edited by RevEng
##### Share on other sites

Just to plant the seed of an idea.. I re-discovered SpiceWares blog entry about using jEdit for batari BASIC. If it's just a matter of customizing a configuration file then we could subvert it for 7800BAS.

http://atariage.com/forums/blog/blog-148/cat-88-batari-basic

##### Share on other sites

*Sees RevEng's sig for the first time*

Ohmygodohmygodohmygod!

Will definitely dip my toes into this program soon.

Also:

When you double-click 7800bas.bat and see the window appear and disappear, it's normal. It does that because it's the batch file is meant to be run from a CMD window, instead of being double-clicked. (but I should probably add some kind of detection for this, with a warning message)

I can see alot of other programs ran from the command line benefiting from this...

##### Share on other sites

Okay, it's working and compiling software now. I still have a lot of questions, though. I noticed you can use indexed graphic files with the compiler, but it looks like you have to define colors in the program itself. Is there a table of available 7800 colors? How do I know which colors to assign? What's the best tool to use to make graphics? Will IrfanView get the job done? How do I swap character graphics for animation? Is PRINT baked right in or do I have to create a character set like I did with Dragon BASIC on the Game Boy Advance?

I, uh, have a lot of questions.

##### Share on other sites

Is there a table of available 7800 colors? How do I know which colors to assign?

It's more or less the same as the VCS colors, except you can use odd values as well.

7800basic also creates color constants by doing a translation of each color index from the PNG's RGB to Atari's color scheme. In the manual under "incgraphic" it gives the example of using one of those color constants... "P0C1 = foobar3_color1"

What's the best tool to use to make graphics? Will IrfanView get the job done?

I don't know irfanView. I use The Gimp. A tool should work provided it can save an indexed png file at bit depths the user selects.

How do I swap character graphics for animation? Is PRINT baked right in or do I have to create a character set like I did with Dragon BASIC on the Game Boy Advance?

It depends on whether you're printing out ROM or RAM locations. If ROM, the easiest thing to do is use if...then to just switch which character is being displayed. If RAM, and you need to change a specific character, you could use pokechar to update the memory location.

There's no default character set, but 7800basic comes with a few. There's an example of printing text strings in the pokey sound test.

I will say that text is a little bit cumbersome because you need to define the text in an "alphadata" statement first. I'm looking into making it a bit more streamlined in an upcoming build.

In its present state it works fine for text labels and such in a game screen. Not so hot if you want to write a text adventure.

Edited by RevEng
##### Share on other sites

Yes, the palette differs from the 2600 (and 5200/XL/XE non-GTIA) one, in that it is a 256 (16 hue x 16 chroma) palette as opposed to the 128 (16 hue x 8 chroma) one found on the 2600 and Atari 5200/XL/XE (when using non GTIA modes).

What I have found, is that it's best if you can get a PNG of the Atari 256 palette and import it into the GIMP's palette dialog ...

Here's a sample palette:

Run GIMP, then take this picture above, load it into GIMP. Then do Windows/Dockable DIalogs/Palettes, and then when the Palette window. Right click inside the palette window and select Import Palette.

From there, look for the radio button that says "Import from image" and select it. The do "Import". The new palette (called Untitled) is now available in GIMP. You might want to rename it to "Atari 7800 palette". The palette should read as 256 colors.

Next, to reduce an image to, say, 12 colors (the number of colors available in 7800's 160B mode) you want to do this with your image:

Image/Mode/Indexed ... and select a 13 color index. You want 13, because the 7800 in 160B mode uses 12 plus the background.

Repeat this step (Image/Mode/Indexed) only this time, select "use Custom Palette". Click on the colored palette button, and select the 7800 palette you just created.

Also, when you do your indexing, make sure you don't do any dithering on the image.

The image should now be reduced to 12 colors which match the 7800 palette. From here, you can cut, paste, and put together an image which should import perfectly into 7800basic. The only issue is, it seems that 7800Basic operates on the PAL palette instead of the NTSC palette, which means that all chromas (except for grey) get shifted one value to the right.

Edited by Synthpopalooza
##### Share on other sites

Is there a table of available 7800 colors?

Atari 7800 palette table showcasing a 26.7 degrees phase shift:

Alternative in presentation and value here is a 26.2 degrees phase shift:

More details here if interested.

Both values are well suited for the documented and actual palette color order.

##### Share on other sites

That post of Trebor's referenced above (showing all the palette shifts) should really be moved into this forum, and maybe pinned so everyone can have access to it! An excellent resource!

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.