Jump to content

Photo

Bankswitching Demos/Templates


82 replies to this topic

#51 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,813 posts
  • Busy bee!
  • Location:North, England

Posted Mon May 4, 2009 8:00 PM

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.

#52 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Tue May 5, 2009 7:10 AM

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.

Attached Files



#53 grafixbmp OFFLINE  

grafixbmp

    Dragonstomper

  • 679 posts
  • Location:South Central US

Posted Thu May 7, 2009 5:01 PM

I asume with these templates, one could just start droping their code into each bank and then assemble and bingo! right?

#54 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Thu May 7, 2009 5:21 PM

I asume with these templates, one could just start droping their code into each bank and then assemble and bingo! right?


Yes, but you might want to change the bankswitching code around a little bit so it will jump to more than one subroutine ;)

#55 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Thu Jun 11, 2009 2:38 PM

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

Attached Files



#56 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Thu Jun 11, 2009 2:42 PM

@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??

#57 Kroko OFFLINE  

Kroko

    Moonsweeper

  • 408 posts
  • Location:Germany

Posted Thu Jun 11, 2009 3:07 PM

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.

#58 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Thu Jun 11, 2009 4:56 PM

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

#59 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Fri Jun 12, 2009 12:05 AM

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?

#60 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Fri Jun 12, 2009 5:14 AM

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

#61 Kroko OFFLINE  

Kroko

    Moonsweeper

  • 408 posts
  • Location:Germany

Posted Fri Jun 12, 2009 8:41 AM

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.

#62 Eckhard Stolberg OFFLINE  

Eckhard Stolberg

    Dragonstomper

  • 957 posts
  • Location:Germany

Posted Fri Jun 12, 2009 10:59 AM

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.

#63 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Fri Jun 12, 2009 2:24 PM

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.

Attached Files



#64 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Fri Jun 12, 2009 3:03 PM

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, Fri Jun 12, 2009 3:04 PM.


#65 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Fri Jun 12, 2009 3:07 PM

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 :)

#66 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Mon Jun 15, 2009 12:31 PM

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

Attached Files



#67 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Mon Jun 15, 2009 1:02 PM

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, Mon Jun 15, 2009 1:04 PM.


#68 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Mon Jun 15, 2009 1:07 PM

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, Mon Jun 15, 2009 1:08 PM.


#69 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Mon Jun 15, 2009 1:14 PM

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.

#70 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Mon Jun 15, 2009 1:23 PM

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.

#71 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Mon Jun 15, 2009 3:25 PM

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

#72 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Mon Jun 15, 2009 3:32 PM

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, Mon Jun 15, 2009 3:40 PM.


#73 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Thu Aug 13, 2009 5:54 PM

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

Attached Files



#74 stephena OFFLINE  

stephena

    River Patroller

  • 3,139 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Fri Aug 14, 2009 5:21 AM

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.

#75 Wickeycolumbus OFFLINE  

Wickeycolumbus

    Red Sea Crosser

  • Topic Starter
  • 5,151 posts
  • Location:Michigan

Posted Fri Aug 14, 2009 11:46 AM

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.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users