Jump to content
IGNORED

Bankswitching Demos/Templates


Recommended Posts

In the orginal Wickeycolumbus code, execution depends on what the emulator treats $FF as. As far as I'm aware its an illegal opcode and nearly 1K's worth will be executed when the slice0 subroutine's rts instruction pops a return address off the stack (which is invalid because it hasn't swapped the banks back). I don't know what happens when code execution continues beyond the 1K slice thats been mapped in. Its probably emulator dependent.

Link to comment
Share on other sites

I don't think the E0 example is correct. From what I can see you are mapping a slice into $F000. Thats where you are currently executing code from! When the rts in the newly mapped in slice is executed the return address is in the new slice and not the old one. Try changing the "rorg $F000" to "rorg $FC00" just before the label Slice7 and see what happens.

 

You are correct, how did I miss that :P It works in Stella now.

Bankswitching_6.zip

Link to comment
Share on other sites

  • 1 month later...
@stephena

 

Could you add support for binaries smaller than 2K? (ex. 1K, 512B, 256B, ect...) Here is a package with some test ROMs if you decide to do so.

This is probably quite easy to do, and has been suggested before. My only question is, how does a real system treat these ROMs? Even 2K ROMs are doubled internally in Stella so they act as 4K ones. Would something similar be done for smaller ROMs? And if this is the case, I assume they can only have power-of-two sizes??

Link to comment
Share on other sites

My only question is, how does a real system treat these ROMs?

You can mirror the memory until 4K are full, but that should not matter because these mirror locations should never be accessed. If they are, then it is most likely a bug and the reaction depends on how the hardware is designed....

 

If the hardware only uses the amount of address lines it really requires, then the memory is mirrored on that device. A realistic emulation of the device needs to mirror the memory. But if the ROM is burned on a standard 4K EPROM and board, the game would crash if the invalid locations are accessed (and the rom does not also contain mirrors of the relevant memory)

 

If the target is not to be as realistic as possible but to make as many roms as possible run without problems, all ROMs that are smaller than 4K should be mirrored.

Link to comment
Share on other sites

My only question is, how does a real system treat these ROMs?

You can mirror the memory until 4K are full, but that should not matter because these mirror locations should never be accessed. If they are, then it is most likely a bug and the reaction depends on how the hardware is designed....

 

If the hardware only uses the amount of address lines it really requires, then the memory is mirrored on that device. A realistic emulation of the device needs to mirror the memory. But if the ROM is burned on a standard 4K EPROM and board, the game would crash if the invalid locations are accessed (and the rom does not also contain mirrors of the relevant memory)

 

If the target is not to be as realistic as possible but to make as many roms as possible run without problems, all ROMs that are smaller than 4K should be mirrored.

I'll probably just go with the latter. It's how Stella currently handles 2K ROMs, so I guess there's no point in changing it. But what about the file sizes? Should they always be power-of-two? And if they aren't, are they mirrored to power-of-two boundaries? For example, if we have a 1000 byte ROM, should it have 24 bytes of padding, and then mirror the entire 1024 part??

Link to comment
Share on other sites

Does anyone have any info on the x07 scheme? I found this in the stella source:

 

  Bankswitching method as defined/created by John Payson (aka Supercat)
 and Fred Quimby (aka batari).

 This bankswitching method has 16 4K banks that can be accessed at
 addresses $1000 to $1FFF. The bankswitching hotspots are all below
 $1000. X07 uses two types of hotspots:
 
 0 1xxx nnnn 1101 -- Switch to bank nnnn
 0 0xxx 0nxx xxxx -- If in bank 111x, switch to bank 111n.
				  In any other bank, do not switch.

 Note that the latter will hit on almost any TIA access.

 

But how exactly do I switch banks?

Link to comment
Share on other sites

Does anyone have any info on the x07 scheme? I found this in the stella source:

 

  Bankswitching method as defined/created by John Payson (aka Supercat)
 and Fred Quimby (aka batari).

 This bankswitching method has 16 4K banks that can be accessed at
 addresses $1000 to $1FFF. The bankswitching hotspots are all below
 $1000. X07 uses two types of hotspots:
 
 0 1xxx nnnn 1101 -- Switch to bank nnnn
 0 0xxx 0nxx xxxx -- If in bank 111x, switch to bank 111n.
				  In any other bank, do not switch.

 Note that the latter will hit on almost any TIA access.

 

But how exactly do I switch banks?

Yep, sorry I couldn't provide more info in the header file, but I didn't actually write the X07 support for Stella, and I never actually received a test ROM. Now, it was written by someone infinitely more knowledgeable about bankswitching that I probably ever will be (Eckhard Stolberg), so I have no doubt it works, but I can't document it properly if I've never tested it myself ...

Link to comment
Share on other sites

But what about the file sizes? Should they always be power-of-two? And if they aren't, are they mirrored to power-of-two boundaries? For example, if we have a 1000 byte ROM, should it have 24 bytes of padding, and then mirror the entire 1024 part??

Yes, this is how I would do it. The mirror is because of unused address lines and that always leads to a power of 2 for the mirrored memory.

Link to comment
Share on other sites

Does anyone have any info on the x07 scheme? I found this in the stella source:

 

  Bankswitching method as defined/created by John Payson (aka Supercat)
 and Fred Quimby (aka batari).

 This bankswitching method has 16 4K banks that can be accessed at
 addresses $1000 to $1FFF. The bankswitching hotspots are all below
 $1000. X07 uses two types of hotspots:
 
 0 1xxx nnnn 1101 -- Switch to bank nnnn
 0 0xxx 0nxx xxxx -- If in bank 111x, switch to bank 111n.
				  In any other bank, do not switch.

 Note that the latter will hit on almost any TIA access.

 

But how exactly do I switch banks?

Yep, sorry I couldn't provide more info in the header file, but I didn't actually write the X07 support for Stella, and I never actually received a test ROM. Now, it was written by someone infinitely more knowledgeable about bankswitching that I probably ever will be (Eckhard Stolberg), so I have no doubt it works, but I can't document it properly if I've never tested it myself ...

Ok, the description probably is a bit sparse, but there really isn't anything else to this bankswitching scheme. The hotspot addresses above are given as binary numbers. A '0' or a '1' means that this address bit has to be in this state for the bankswitching to trigger. A 'x' means that this bit isn't checked by the bankswitching logic and therefore can be in either state. A 'n' means this bit is part of the new bank number to switch to. There are 16 banks each 4KB large for a total ROM size of 64KB.

 

So for the first type of bankswitching hotspots address $081d would switch to bank 1 as would address $091d, $0a1d ... $0f1d. Address $085d ($095d etc.) would switch to bank 5 instead for example.

 

For the second type of hotspots address $0000 would switch to bank 14 ($0e), if the cartridge currently was in bank 15 , while $0040 would switch to bank 15 ($0f), if the cartridge currently was in bank 14. The same goes for $0001 / $ 0041 or $073f / 077f for example. No bankswitch would happen if the cartridge was in banks 0 to 13 when these hotspots get accessed. This is important, as it allows you to switch between the last two banks in the ROM while reading from or writing to the TIA. It was used to create more room for the sound driver in the Stella's Stocking game select menu.

 

This bankswitching type was only used for Stella's Stocking, the 2007 Christmas cart (hence the name of the bankswitching scheme: X07). I don't think the binary for Stella's Stocking has been released yet, which is why there isn't a binary to test the emulator support for X07 with.

Link to comment
Share on other sites

Does anyone have any info on the x07 scheme? I found this in the stella source:

 

  Bankswitching method as defined/created by John Payson (aka Supercat)
 and Fred Quimby (aka batari).

 This bankswitching method has 16 4K banks that can be accessed at
 addresses $1000 to $1FFF. The bankswitching hotspots are all below
 $1000. X07 uses two types of hotspots:
 
 0 1xxx nnnn 1101 -- Switch to bank nnnn
 0 0xxx 0nxx xxxx -- If in bank 111x, switch to bank 111n.
				  In any other bank, do not switch.

 Note that the latter will hit on almost any TIA access.

 

But how exactly do I switch banks?

Yep, sorry I couldn't provide more info in the header file, but I didn't actually write the X07 support for Stella, and I never actually received a test ROM. Now, it was written by someone infinitely more knowledgeable about bankswitching that I probably ever will be (Eckhard Stolberg), so I have no doubt it works, but I can't document it properly if I've never tested it myself ...

Ok, the description probably is a bit sparse, but there really isn't anything else to this bankswitching scheme. The hotspot addresses above are given as binary numbers. A '0' or a '1' means that this address bit has to be in this state for the bankswitching to trigger. A 'x' means that this bit isn't checked by the bankswitching logic and therefore can be in either state. A 'n' means this bit is part of the new bank number to switch to. There are 16 banks each 4KB large for a total ROM size of 64KB.

 

So for the first type of bankswitching hotspots address $081d would switch to bank 1 as would address $091d, $0a1d ... $0f1d. Address $085d ($095d etc.) would switch to bank 5 instead for example.

 

For the second type of hotspots address $0000 would switch to bank 14 ($0e), if the cartridge currently was in bank 15 , while $0040 would switch to bank 15 ($0f), if the cartridge currently was in bank 14. The same goes for $0001 / $ 0041 or $073f / 077f for example. No bankswitch would happen if the cartridge was in banks 0 to 13 when these hotspots get accessed. This is important, as it allows you to switch between the last two banks in the ROM while reading from or writing to the TIA. It was used to create more room for the sound driver in the Stella's Stocking game select menu.

 

This bankswitching type was only used for Stella's Stocking, the 2007 Christmas cart (hence the name of the bankswitching scheme: X07). I don't think the binary for Stella's Stocking has been released yet, which is why there isn't a binary to test the emulator support for X07 with.

 

Thank you Eckhard! Package now includes an x07 ROM.

Bankswitching_7.zip

Link to comment
Share on other sites

Thank you Eckhard! Package now includes an x07 ROM.

And Stella now supports autodetection for X07!

 

As well, ROMs smaller than 2K are now supported as mentioned above. And since we're on a bankswitch 'kick', I also implemented proper support for the 32-in-1 cart as requested in another thread. That means you can access each 2K ROM in the 64K cart as if each were a separate ROM. And now I'm taking the weekend off :)

Edited by stephena
Link to comment
Share on other sites

Thank you Eckhard! Package now includes an x07 ROM.

And Stella now supports autodetection for X07!

 

As well, ROMs smaller than 2K are now supported as mentioned above. And since we're on a bankswitch 'kick', I also implemented proper support for the 32-in-1 cart as requested in another thread. That means you can access each 2K ROM in the 64K cart as if each were a separate ROM. And now I'm taking the weekend off :)

 

Nice work! Have a good weekend :)

Link to comment
Share on other sites

I am having trouble with the Megacart scheme. All the attached binary/source should do is display a white screen.

What bankswitch scheme is this supposed to be? Do you have any documentation on it?? When I start it in Stella, it's autodetected as 3F, with a file size of 128K. And it does show a white background.

 

EDIT: Sorry, I didn't read the whole comment. I guess you're referring to Chris Wilksons MegaCart, denoted as 'MC' in Stella. If so, you're right, the white background isn't showing up.

Edited by stephena
Link to comment
Share on other sites

I am having trouble with the Megacart scheme. All the attached binary/source should do is display a white screen.

What bankswitch scheme is this supposed to be? Do you have any documentation on it?? When I start it in Stella, it's autodetected as 3F, with a file size of 128K. And it does show a white background.

 

EDIT: Sorry, I didn't read the whole comment. I guess you're referring to Chris Wilksons MegaCart, denoted as 'MC' in Stella. If so, you're right, the white background isn't showing up.

 

This one is really strange, when I go to the debugger screen, the slices are loaded correctly and the program counter is where I want it, but I can't seem to make it do anything :?

Edited by Wickeycolumbus
Link to comment
Share on other sites

I am having trouble with the Megacart scheme. All the attached binary/source should do is display a white screen.

What bankswitch scheme is this supposed to be? Do you have any documentation on it?? When I start it in Stella, it's autodetected as 3F, with a file size of 128K. And it does show a white background.

 

EDIT: Sorry, I didn't read the whole comment. I guess you're referring to Chris Wilksons MegaCart, denoted as 'MC' in Stella. If so, you're right, the white background isn't showing up.

 

This one is really strange, when I go to the debugger screen, the slices are loaded correctly and the program counter is where I want it, but I can't seem to make it do anything :?

MC isn't really supported in the debugger at all. The information it returns for number of banks, current bank, etc cannot be trusted, and patching the ROM isn't possible either. I don't think I've ever tested MC support, since I don't have a test ROM. There are several of the more esoteric schemes that aren't fully supported in the debugger; this is one of them. I probably should update the documentation to indicate that it isn't supported.

Link to comment
Share on other sites

I am having trouble with the Megacart scheme. All the attached binary/source should do is display a white screen.

What bankswitch scheme is this supposed to be? Do you have any documentation on it?? When I start it in Stella, it's autodetected as 3F, with a file size of 128K. And it does show a white background.

 

EDIT: Sorry, I didn't read the whole comment. I guess you're referring to Chris Wilksons MegaCart, denoted as 'MC' in Stella. If so, you're right, the white background isn't showing up.

 

This one is really strange, when I go to the debugger screen, the slices are loaded correctly and the program counter is where I want it, but I can't seem to make it do anything :?

MC isn't really supported in the debugger at all. The information it returns for number of banks, current bank, etc cannot be trusted, and patching the ROM isn't possible either. I don't think I've ever tested MC support, since I don't have a test ROM. There are several of the more esoteric schemes that aren't fully supported in the debugger; this is one of them. I probably should update the documentation to indicate that it isn't supported.

 

Assuming the problem is not on my end (I will look at my code again), is there any chance MC support can be fixed? It looks really promising with it's 128K ROM and 32K RAM.

Link to comment
Share on other sites

I am having trouble with the Megacart scheme. All the attached binary/source should do is display a white screen.

What bankswitch scheme is this supposed to be? Do you have any documentation on it?? When I start it in Stella, it's autodetected as 3F, with a file size of 128K. And it does show a white background.

 

EDIT: Sorry, I didn't read the whole comment. I guess you're referring to Chris Wilksons MegaCart, denoted as 'MC' in Stella. If so, you're right, the white background isn't showing up.

 

This one is really strange, when I go to the debugger screen, the slices are loaded correctly and the program counter is where I want it, but I can't seem to make it do anything :?

MC isn't really supported in the debugger at all. The information it returns for number of banks, current bank, etc cannot be trusted, and patching the ROM isn't possible either. I don't think I've ever tested MC support, since I don't have a test ROM. There are several of the more esoteric schemes that aren't fully supported in the debugger; this is one of them. I probably should update the documentation to indicate that it isn't supported.

 

Assuming the problem is not on my end (I will look at my code again), is there any chance MC support can be fixed? It looks really promising with it's 128K ROM and 32K RAM.

I can't really say what the chances are, or how hard it's going to be, as I've never tested it before. This is going to be a problem, since I can't work on it without a verified test ROM, and you can't be absolutely sure the ROM is working without being able to run it ...

Link to comment
Share on other sites

I am having trouble with the Megacart scheme. All the attached binary/source should do is display a white screen.

What bankswitch scheme is this supposed to be? Do you have any documentation on it?? When I start it in Stella, it's autodetected as 3F, with a file size of 128K. And it does show a white background.

 

EDIT: Sorry, I didn't read the whole comment. I guess you're referring to Chris Wilksons MegaCart, denoted as 'MC' in Stella. If so, you're right, the white background isn't showing up.

 

This one is really strange, when I go to the debugger screen, the slices are loaded correctly and the program counter is where I want it, but I can't seem to make it do anything :?

MC isn't really supported in the debugger at all. The information it returns for number of banks, current bank, etc cannot be trusted, and patching the ROM isn't possible either. I don't think I've ever tested MC support, since I don't have a test ROM. There are several of the more esoteric schemes that aren't fully supported in the debugger; this is one of them. I probably should update the documentation to indicate that it isn't supported.

 

Assuming the problem is not on my end (I will look at my code again), is there any chance MC support can be fixed? It looks really promising with it's 128K ROM and 32K RAM.

I can't really say what the chances are, or how hard it's going to be, as I've never tested it before. This is going to be a problem, since I can't work on it without a verified test ROM, and you can't be absolutely sure the ROM is working without being able to run it ...

 

Perhaps Chris Wilkson has one. I vaguely remember him saying that he had a working prototype of the cart.

Edited by Wickeycolumbus
Link to comment
Share on other sites

  • 1 month later...
Now included are demos for 4A50 and my own 3E3F scheme (which is not yet supported by emulators).

Do you intend to release the 3E3F specs to the public? I can easily add proper support for this to Stella if you foresee it being used by other people.

Link to comment
Share on other sites

Now included are demos for 4A50 and my own 3E3F scheme (which is not yet supported by emulators).

Do you intend to release the 3E3F specs to the public? I can easily add proper support for this to Stella if you foresee it being used by other people.

 

I have no problem releasing info about it, although I can't imagine anyone using it. Perhaps it can be used as a means of copy protection for ROM releases :ponder:

 

If anyone is reading this and is interested, PM me.

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