IGNORED

# 7800basic beta, the release thread

## Recommended Posts

I've got a question about comparing using score0 as a 'points' counter and using IF...THEN statements. I have set up a shop where the player buys something and if he has enough points, the item should disappear, score0 should reduce by 25 and score1 should increase.

So I reduced score0 to four digits meaning that if something is 100, it's actually 1. So what about using two digit numbers like 25? For instance...

```if score0=0025 && boxcollision(xpos,ypos,16,16,orange_x,orange_y,16,16) then orange_x=200:orange_y=200:  score0=score0-0025: score1=score1+0015:store_response=1
```
So far, the code above doesn't work. I'm wondering if I need to use BCD for something like this?

Because the score variables are 24-bit variables, using them in an if...then comparison doesn't work correctly. To use them in comparisons, you actually need to look at the constituent bytes like this...

``` dim sc00=score0   : rem ##0000
dim sc01=score0+1 : rem 00##00
dim sc02=score0+2 : rem 0000##

if sc02=\$25 && boxcollision(xpos,ypos,16,16,orange_x,orange_y,16,16) then orange_x=200:orange_y=200:  score0=score0-0025: score1=score1+0015:store_response=1
```
Let me know how that works out for you.

Alright this may be a dumb question, but I've finally got around to sitting down with this, currently just going through the sample code, one thing I don't understand is why in the adventure demo, and multisprite demo is tileset_blanks loaded and referred to as the tilemap rather than tileset_rocks? What role does tileset_blanks play?

Not at all a dumb question!

When you have a bunch of character images consecutive in memory, you can access them all in the map. Think of them as one big image set, even though you used separate incgraphic statements to bring them all in. tileset_blanks isn't special, except for the fact that it's the first tileset brought in with incgraphic.

For the 7800 colors, check out this thread

##### Share on other sites

For the 7800 colors, check out this thread

I humbly suggest, the better/updated final work, complete with chart (hex value) references here.

##### Share on other sites

Because the score variables are 24-bit variables, using them in an if...then comparison doesn't work correctly. To use them in comparisons, you actually need to look at the constituent bytes like this...

``` dim sc00=score0   : rem ##0000
dim sc01=score0+1 : rem 00##00
dim sc02=score0+2 : rem 0000##

if sc02=\$25 && boxcollision(xpos,ypos,16,16,orange_x,orange_y,16,16) then orange_x=200:orange_y=200:  score0=score0-0025: score1=score1+0015:store_response=1
```
Let me know how that works out for you.

Not at all a dumb question!

When you have a bunch of character images consecutive in memory, you can access them all in the map. Think of them as one big image set, even though you used separate incgraphic statements to bring them all in. tileset_blanks isn't special, except for the fact that it's the first tileset brought in with incgraphic.

For the 7800 colors, check out this thread

Ahh that makes total sense, that explains why abc were solid colors thanks!

I humbly suggest, the better/updated final work, complete with chart (hex value) references here.

Awesome thanks!

##### Share on other sites

Because the score variables are 24-bit variables, using them in an if...then comparison doesn't work correctly. To use them in comparisons, you actually need to look at the constituent bytes like this...

``` dim sc00=score0   : rem ##0000
dim sc01=score0+1 : rem 00##00
dim sc02=score0+2 : rem 0000##

if sc02=\$25 && boxcollision(xpos,ypos,16,16,orange_x,orange_y,16,16) then orange_x=200:orange_y=200:  score0=score0-0025: score1=score1+0015:store_response=1
```
Let me know how that works out for you.

I had to tweak the code but it does work:

```if sc01=\$025 && boxcollision(xpos,ypos,16,16,orange_x,orange_y,16,16) then orange_x=200:orange_y=200:  score0=score0-2500: score1=score1+15:store_bought=1
```

I changed the points counter back to three digits, but had to use 2500 instead of 25, otherwise it only takes 2 off the points score.

##### Share on other sites

are there any example codes out there to help get one started?

##### Share on other sites

Check out the samples directory, which has a few different code examples.

##### Share on other sites

It looks like I'll have to expand to 128k. I tried that bankswitch example but I think I still need some help with it.

##### Share on other sites

I suppose what you want is really 144K, so you can have this scenario:

\$4000-\$7FFF (16K code/gfx)

\$8000-\$BFFF (8 banks)

\$C000-\$FFFF (16K code/gfx)

##### Share on other sites

I haven't gotten around to adding in 144k yet. Its easy enough in principle, but it's lower on the list.

##### Share on other sites

So graphics/playfield data is limited to only certain banks, like in batariBasic?

I would have thought that graphics, maps, and music would comprise the bulk of a game's data.

On an unrelated note, how difficult would it be to do a compilation cart with 7800basic? Is it just a matter of building a number of games and just keeping their data separated but otherwise programming as normal, or are there some necessarily tricks to get around things like palette data being set that can't be changed in a ROM?

On another unrelated note, what's the compression like for graphics/map/music/etc. data in 7800basic? Does it provide some built-in compression, or does that have to be done yourself? I know that you're just discussing 144k, but will higher values like the 512k+ that batariBasic can handle eventually come to 7800basic?

Edited by Cybearg
##### Share on other sites

The graphics can go in any bank. You just need to call "drawscreen" in the bank with graphics you want to display.

The easiest way to do a compilation cart would be to code the games to coexist. Otherwise you'd need custom bankswitch hardware and support added to 7800basic. Also, palette colors can be changed on the fly.

There's no built-in compression, since that would require RAM to decompress to, and our limited RAM would put a boundary on the amount of active graphics.

7800basic already supports sizes up to 512k. See "set romsize" in the manual. It just doesn't support formats with an extra perma-bank at \$4000, like 144k.

##### Share on other sites

Ah, that's a relief. Thanks, Rev!

Are there any parts set by 7800basic that can't be changed on the fly when developing multiple games on the same cart? In batariBasic, there are quite a few things that can only be set once that significantly affect the games' design, like your kernel.

##### Share on other sites

No problem.

The hardcoded stuff is in the guide under Program Configuration.

##### Share on other sites

Do dim arrays also need to be put into other banks? I get label mismatch errors when compiling in 128K.

##### Share on other sites

As a small feature request, could 7800basic support inlining .bas files? IntyBasic recently added support for including one .bas file in another, which has allowed me to break sound, music, map, and table data out into separate .bas files for individual editing. It has done wonders for reducing clutter in my main .bas file and it would be great to have that same feature in 7800basic, especially since 7800 games can conceivably be so huge.

Also consider this a feature request for batariBasic to add the same functionality. I'd think it would be as simple as checking to see whether an include is a .bas or an .asm file, then including .bas files before compilation and .asm files after compilation but before assembly.

##### Share on other sites

So now I have two banks: one for the world map and the other for the dungeon map. I get an "graphics overrun error" in bank #1 which tells me I have to declare another (a 3rd?) bank?

##### Share on other sites

Pretty much. The error message means you have too many graphics with "incraphic" in bank1. You'll have to shift some of those to another bank.

Just bear in mind when you issue "drawscreen" you can only use graphics in the last bank or the same bank with the "drawscreen" command.

##### Share on other sites

I am curious about why it is not a 10-15 minute thing, to add a fixed bank at \$4000.

##### Share on other sites

The various banking routines need exceptions to not bank when trying to accessing the second last bank, and to curse at the user when he tries to switch to them. It may be 10 or 15 minutes of coding, and then another 10 or 15 for testing. Then I'd spend twice as long updating the documentation on how to use it, and how you can't use Pokey@4000 or RAM@4000 at the same time.

These days 10 minutes of hobby coding is a luxury I don't have, and probably won't for weeks. After that there are some more important things to add/work on, but eventually...

##### Share on other sites

There are presently a few features that assembly language programmers have over us right now, the main ones being fine-scrolling and zone-based changes.

Out of curiosity, have any of those tough nuts been cracked?

##### Share on other sites

No nuts cracked, tough or otherwise.

When I get a chance to get back to it, I'll be looking to tune performance before launching into new features.

##### Share on other sites

Somehow I was able to get rid of the "label mismatch" and memory errors by moving banks around. So what do I do when half of the graphics are stored in bank 1, the other half of graphics along with other code in bank 2? Do I need a goto function? So far, I'm getting either getting a scrambled screen or a blank screen. And with 'drawscreen" is that needed for both source and target? In other words, where the incgraphics are, along with where I put the "plotsprites"?

##### Share on other sites

AFAICT, you can't do that, unless they are not displayed at the same time (read: same frame). Banking in the middle of the display, would probably result in some pretty strange looking stuff. It is completely unpredictable for the processing units, even if the same speed logic for the bank switching is used.

##### Share on other sites

Just to elaborate on what CPUWIZ is saying, all of the banks (except the last) share the same address space. So graphics in bank 1 can't be displayed at the same time as graphics in bank 2.

If you're only wanting to display bank 1 graphics, you'd stick the incgraphic in that bank, along with a drawscreen somewhere in the code there. The plotsprite can happen in any bank, even one without the graphics in question. Plotsprite just sets up MARIA's instructions to display that object, but you don't need to be in the bank with the graphics until the "drawscreen"

Your 7800basic program also runs during the visible screen, so its important not to switch away from the bank with the graphics until the visible screen has been drawn. To accomplish that, either have a bunch of program code running there, or wait for the visible screen to complete with the "drawwait" command"

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