Jump to content
TwentySixHundred

Bankswitching and ROM sizes

Recommended Posts

Posted (edited)

Hi guys some novice questions about bankswitching and ROM sizes. Was having a dig around for more information however haven't found what im after as of yet (i think anyway).

 

ROM sizes: So from what im understanding 128k was the limit until needing extra hardware and 48k was the limit without bankswitching. Also what is the advantages other then extra ROM for 144k over 128k? Is it just a better idea to go for the extra ROM at 144k?

 

Bankswitching: Why is the limit of each bank reduced to 16k rather then 48k or 32k as that's the largest ROM size that doesn't need bankswitching? Also when it comes to bankswitching i read you don't need the incgraphic in the current bank to plot the sprite or maptiles? For some reason when i try this it displays a blank screen yet if i duplicate the incgraphic everything works fine.

Edited by TwentySixHundred

Share this post


Link to post
Share on other sites

128k is just a common supergame size. The same bankswitch hardware can support larger eproms, so 256k, 512k, ..., are all doable.

 

The 16k chunks are so that one part of the ROM (the last bank) remains persistent and non-switched, while the other banks are switched. Having a persistent bank means you can stick graphics or code there, and not have it disappear when you bank-switch. (and as you've discovered, graphics do disappear when you include them in a non-persistent bank and bank-switch.)

 

144k has 2 persistent banks instead of the 1 persistent bank in 128k. The disadvantage for 144k is you can't use RAM or anything else mapped at $4000, since the ROM is there.

  • Like 3

Share this post


Link to post
Share on other sites

Everything below is based on my limited understanding so take it with a pinch of salt, and I will welcome any corrections.

 

48k is the most the 7800 can address through the cartridge port so anything more than that requires something on the cartridge to handle bankswitching. As 48k is 3 x 16k it makes sense for a lot of cartridges to be designed to use multiple 16k chips and then swap out one for the switching.

 

Some of the bankswitching schemes do use 48k at a time, just not in the way you'd expect. When you take into account the last bank is always available that's 32k available at all times, then if you have the extra RAM that's 48k. With the 144k size you have 2 banks fixed and one switching so again that's 48k at a time.

If you're not interested in using extra RAM with the 128k size then there's no reason to not go 144k. At the time there were cost reasons, now the price difference isn't so great.

 

 

As for drawing, when you plot a graphic you're telling the system to look for the graphics at a given address and draw those. If you're using a bank where those graphics don't exist it will still draw what's at that location. The thing is you don't have to be using a bank where those graphics exist to tell it to draw what would be at that location.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks guys that summed it up, makes alot more sense now. Great to know i could use 512k if really wanting too or opt out for 144k with two persistent banks for the sacrifice of extra RAM. That means i can use the 1,535 of extra RAM at the $2200 - $2735 address locations without any dramas when using 144k ROM size? Im assuming it only effects the additional cart RAM.

Share this post


Link to post
Share on other sites

The area of RAM at $2200-$27FF is on the console so you'll always have that regardless of the cartridge type. When I was referring to extra RAM before I meant the types that include some on the cartridge which would be in addition to that.

  • Like 2

Share this post


Link to post
Share on other sites

Brilliant, had a feeling that was the case, yeah just making sure i have a full understanding of all the possible options. Exactly what i was thinking and im sure that extra RAM would come in handy with certain applications, however for the moment im happy to play around with console RAM 👍

Share this post


Link to post
Share on other sites

Ok so a follow up i have changed one my programs over to bankswitching and everything works fine except for my large sprites. They seem to be cut in half when using bankswitching. They were fine before but now they only show the top half of the 32x32 sprites. Wondering if you guys might know why this is the case? I have read that sprites are limited to 32x16 so in order to make 32x32 you need to use two sprites. What im not understanding is why the program will display 32x32 when not bankswitching.

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks muddy, yeah no i wasn't using tallsprite previously and just gave it a whirl with no success on or off :(

Edited by TwentySixHundred

Share this post


Link to post
Share on other sites

"set tallsprite on" is the default, so previously you were using it, albeit implicitly.

 

My guess here is that your "incgraphic" (where the the tall sprite info gets generated) is happening in some bank after the plotsprite call generation, so the plotsprite code doesn't actually know it's a tallsprite. This is a limitation of tallsprite right now, and a bit tricky for me to work around, due to the linear nature of the underlying assembly generation. So for now either the incgraphic needs to happen first, or you need to manually plotsprite both parts. (which is basically what tallsprite does, just on your behalf)

 

Share this post


Link to post
Share on other sites

Thanks Mike, your assumption is correct the 'incgraphic' sprites are all in the last bank (persistent). Changing the ROM size made no change either so im yet to try including before ploting the sprite. All the other sprites work fine it's just the tallsprites, im guessing tallsprite has this limitation when bankswitching (unless included within the bank). I will see how things go later today by throwing them in the same bank where plotspspite is called, cheers 👍

Share this post


Link to post
Share on other sites
Posted (edited)

That done the trick and i could still keep includes 16x16 or less in the last bank. Only downside is the loss of ROM space, it's really chewed out a chunk of space leaving very little remaining. All good though atleast i know what's going on now, cheers for the help guys 👍

 

Edit: Also i have noticed pokeysupport is not setting with bankswitching, there could be something im missing though

Edited by TwentySixHundred
  • Like 1

Share this post


Link to post
Share on other sites
42 minutes ago, TwentySixHundred said:

Edit: Also i have noticed pokeysupport is not setting with bankswitching, there could be something im missing though

Not sure what's going on here. We have some WIP games that are presently using bankswitching and pokey. (Millie&Molly, Arkanoid)

 

When you say "pokeysupport is not setting" how exactly do mean that? do you mean there's a compile output error, or a particular emulator isn't finding pokey, or?

Share this post


Link to post
Share on other sites

It's probably something im doing wrong however it works without bank switching.

 

so i have been setting the kernel "set pokeysupport on" at the start of the program where i set the region and doublewidth ect. Then use psound 0,rpm,10,10 within the main loop and the variable rpm is what controls the frequency.

 

I have tried moving the "set pokeysupport on" to the current bank in use that hasn't worked either. I have also made sure when initializing the kernel settings at the start of ROM that the ROM size is first to be declared.

 

As for compiling there is no errors and does show pokeysound in the output log. See spoiler

Spoiler
Starting build of testdrive_bankswitched.bas...
7800basic v0.10 Jun 15 2020 23:49:10
 
*** (): INFO, bank #2, GFX Block #0 starts @ $A000
        playercar playercar_tallsprite_00 cityskyline
        cityskyline_tallsprite_00 cityskyline2
        cityskyline2_tallsprite_00 cityskyline3
        cityskyline3_tallsprite_00 traffic1large
        traffic1large_tallsprite_00 traffic2large
        traffic2large_tallsprite_00
*** (): INFO, bank #2, GFX block #0 has 2560 bytes left (160 x 16 bytes)
 
*** (): INFO, bank #2, DMA hole #0 starts @ $B000
        no code defined for DMA hole
 
*** (): INFO, bank #8, GFX Block #0 starts @ $E000
        tileset_blanks tileset_track roadline1 roadline2 cloud1 cloud2
        cloud3 traffic1small traffic1med traffic2small traffic2med tree1
        gearN gear1 gear2 gear3 gear4 gear5
*** (): INFO, bank #8, GFX block #0 has 2432 bytes left (152 x 16 bytes)
 
7800basic compilation complete.
 
User-defined 7800.asm found in current directory
 
   15966 bytes of ROM space left in the main area of bank 1.
   4566 bytes of ROM space left in the main area of bank 2.
   16383 bytes of ROM space left in the main area of bank 3.
   16383 bytes of ROM space left in the main area of bank 4.
   16383 bytes of ROM space left in the main area of bank 5.
   16383 bytes of ROM space left in the main area of bank 6.
   16383 bytes of ROM space left in the main area of bank 7.
   8192 bytes of ROM space left in the main area of bank 8.
   pokeysound assembly:  326  bytes
     $1880 to $1fff used as zone memory, allowing 31 display objects per zone.
     2093 bytes left in the 7800basic reserved area.
 
Complete.
 
Read $C000 bytes of cartridge data.
Car
tridge hash area is from $F000 to $FFFF.
Cartridge signature for 'c:\Anthony\Batari Basic Homebrew\Visual Studio\7800 Homebrew\Games\Testdrive Bankswitched\testdrive_bankswitched.bas.bin' appears to be empty.
Encrypting... 00
 01
 02
 03
 success!
 
A valid cartridge signature is:
04 ca e0 6d 0e 30 
11 8f  47 71 2c 83 da e2 1e 9f
12 b2 d9 35 d0 d1 91 a8  2b 40 fe 8b 44 30 97 93
cc 09 66 06 68 7a 06 bf  c4 b8 4b 21 41 0e 0c f4
8d 68 48 fd 10 68 18 ef  8e 3d cf 8c ed e0 39 08
36 eb b9 4c 9e 94 2b 4c  1b 80 47 8a c3 7e b6 a5
35 be 4b 50 b8 d9 9e fd  1c 26 82 6b 9a 44 28 29
44 b5 c5 22 e4 6e 06 67  4d 6d cd 57 52 e4 dc 0f
91 79 b7 35 e5 0a 07 38
 
Wrote back 120 bytes to 'c:\Anthony\Batari Basic Homebrew\Visual Studio\7800 Homebrew\Game
s\Testdrive Bankswitched\testdrive_bankswitched.bas.bin'.
 
7800header 0.10 Jun 15 2020 23:49:14
  opened parameter file a78info.cfg
 
'7800makecc2' is not recognized as an internal or external command,
operable program or batch file.
 
Verifying compiled file(s)...
Cleaning up files generated during compilation...
Moving compiled file(s) to 'bin' folder...
Moving debugger file(s) to 'bin' folder...
 
Launching A7800 emulator...
Average speed: 100.06% (2 seconds)

 

It all looks good for pokey as far as i know which leads me to think there is something going on in my code. The variable "rpm" seems to be working fine as it also controls other conditions that are working fine. I will keep plugging away and probably have a eureka moment lol

Share this post


Link to post
Share on other sites

Ok, if you want a hand working it out, feel free to shoot me a PM with a zip.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
25 minutes ago, RevEng said:

Ok, if you want a hand working it out, feel free to shoot me a PM with a zip.

Thanks, i may very well end up taking that offer. I will give myself a day or so as it's good learning practice 👍

Edited by TwentySixHundred
  • Like 2

Share this post


Link to post
Share on other sites

Ok so an update, pokey whilst bankswitching still has me stumped. I have even created a program that's stripped of everything other then sounds alone to see what's going on. Still no dice, yet works fine when not bankswitching, anyway if the offer to have a look is still on the table that would be great 👍

Sounds.7z

Share this post


Link to post
Share on other sites

The offer is always open. :)  I'll have a look this evening and let you know.

  • Like 2

Share this post


Link to post
Share on other sites

You're not going to like this... the a78 file you provided does play the sounds as intended.

 

a7800 isn't great when dealing with both [email protected] and supergame. It's an issue inherited prior to being forked from Mame.

 

If you launch with an "XM" plugged in, it will work. e.g. "a7800 a7800 -cart1 xm -cart2 sounds.bas.a78"

  • Like 2

Share this post


Link to post
Share on other sites

Thanks Mike yeah you're correct i wasn't expecting to hear it's actually working. Very strange that it works with a7800 when not bankswitching yet doesn't when using bankswitching. Hopefully this issue gets rectified on a later update of a7800 down the line. I will try the XM pluggin and see how things go or just drop pokey all together for that project. Im guessing MAME never supported pokey with bankswitching (supergames). Cheers for having a look, much appreciated 👍

Share this post


Link to post
Share on other sites

You're welcome. For sure it's on the list of things to fix.

 

Glad you're back on track now!

Share this post


Link to post
Share on other sites

So when trying to launch using XM expansion im getting an error message saying "the selected software is missing one or two files" (a7800 v4.0). Im guessing i would need to download the XM puggin software but can't find any links. Then when changing the extension to "a7800 a7800 -cart1 xm -cart2 sounds.bas.a78" the ROM boots fine from ADS however still no pokey sound. There is probably something im doing wrong as it's not the first time i have had missing files issues with MAME in this case (a7800).

Share this post


Link to post
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.

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