Jump to content
IGNORED

Can't get F8 Bankswitching Working


Heroes & Shadows

Recommended Posts

Hello,

 

Trying to get F8 Bankswitching working after my cloud instance crashed. At the moment all I get is a black screen. If I remember correctly Bb with the 8k ROM option stores the code in Bank 0, and graphics and data in Bank 1 according to something i read. I am trying to accomplish the same effect. If anyone can help me it would be greatly appreciated.

 

Source: https://www.dropbox.com/s/3cnn483zog0bkra/Source_11-19-18.zip?dl=1

 

Regards,

 

Heroes & Shadows

Edited by Heroes & Shadows
Link to comment
Share on other sites

I know nothing of bB. One problem I can spot immediately is that "Nope" does not lead into "Reset":

 

If the console powers up in the second bank, the vector points it to $F000...where a bankswitch instruction exists to flip to the first bank. The instruction is 3 bytes long, so now you are at $F003 in the first bank. This is the ".divideby15" subroutine. The subsequent RTS will bounce you to parts unknown (since Ram had never been initialized at this point).

 

So you should use something like this at the top of the first bank:

 

 

   org $E000 ; start first bank exactly at (2nd bank minus $1000)
   rorg $F000 ; Tell the assembler that the bank's address is actually $F000
;i.e. because only odd-numbered blocks are ROM to the 2600.
 
   NOP
   NOP
   NOP ;waste those 3 bytes taken by the bankswitch in the other bank
   JMP Reset ; go and do your prep.
Link to comment
Share on other sites

BTW there's another trick you can use:

 

Since any access to $FFF8 causes a flip to the first bank in this scheme, you can ORG a JMP Reset instruction at $FFF6 in the second bank.

 

 

  ORG $FFF6
Nope:
   JMP Reset

 

JMP is a 3-byte instruction, so the hotspot is automatically triggered as it reads the destination address ;)

Link to comment
Share on other sites

  • 2 months later...

For the F8 scheme, the display routine (or at least the portion that reads the gfx data) must reside in the same bank as the data it's trying to read. You can see the problem quite clearly in Stella's debugger. Be aware that as far as the hardware "knows", only 4k of Rom exists...it's the most that the 2600 can see at any time.

 

I'd suggest placing the whole display kernel in the second bank (for simplicity), and leave the first bank just for startup and overscan/support routines. It's probably the easiest approach until you become accustomed to how banking works.

Link to comment
Share on other sites

I wrote "for simplicity". Once you get used to banking, you can shoot the game kernel through multiple bankswitches (to take advantage of every spare byte in the Rom). At this point, it's just easier to manage. Timing, as well...since each bankswitch instruction will cost you at least 4 cycles of display time. That is all avoided if the data is present along with all the rest.

 

Then, you can experiment with more-complex schemes (banking just portions of the 4k instead of an entire flop).

Edited by Nukey Shay
Link to comment
Share on other sites

I'd suggest placing the whole display kernel in the second bank (for simplicity), and leave the first bank just for startup and overscan/support routines. It's probably the easiest approach until you become accustomed to how banking works.

Unless i'm misunderstanding you, it tried what you said and now the Atari 2600 is bleeping at me. :P

 

Source

Link to comment
Share on other sites

Not quite. Remember the problem with startup you originally had, the bankswitch instructions need to line up in memory. They just swap the bank, so the next program instructions absolutely have to be next in Rom memory.

 

In addition...you can reference labels from either bank, but you can't actually jump to them unless they are in the same bank the program is currently in.

 

Fixed version below: I put the bankswitches up top so they line up, and pasted just the wait loop and visual display kernel in the second bank.

Untested since I'm not at my PC at the moment, but you should be getting the idea.

source.asm

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