Jump to content
IGNORED

Games over 4K


Just Jeff

Recommended Posts

 

So of those EF could be made to work with my example. As Thomas mentions, if you do it this way the overhead increases (as more of each 4K bank is dedicated to bank switching code) so finding a better way to do it would be in your best interesting.

 

One side affect of my switching to ARM support for my games is they only use 1 bank of 6507 code, and the ARM sees everything without needing to bankswitch, so I've not looked into better ways to do it.

 

Thinking about this some more, I thought of a way to greatly reduce the overhead. I'm curious to know if this will work. If I were to expand to 16 banks of 4K, 12 of these banks would be kernels and therefore, would always return to "Overscan" in the jump table. Couldn't I move "Overscan to the top of JUMP_TABLE, then delete the remainder the jump table that follows "Overscan" in those 12 banks? Further, couldn't I get rid of all but the last SelectBank in BANKS_AND_VECTORS in those 12 banks, always jumping to the last bank? (Which doesn't get me to "Overscan" right now but I suppose I could move Overscan to the last bank.) These changes would probably also apply to the voice banks as well, leaving only one bank requiring the full JUMP_TABLE and BANKS_AND_VECTORS macros. Does that work?

	MAC JUMP_TABLE ; start of every bank
	RORG $F000
SystemStart				; inititialize system
	nop SelectBank1
	jmp SystemStartCode
MCP						; game logic
	nop SelectBank1
	jmp MCPCode
Overscan
	nop SelectBank1
	jmp OverscanCode
IntroKernels				; kernels
	nop SelectBank2
	jmp IntroKernelsCode
Kernels3				; kernels
	nop SelectBank3
	jmp Kernels3Code
Kernels4			    ; kernels
	nop SelectBank4
	jmp Kernels4Code
Voice1    				; voice bank 1
	nop SelectBank5
	jmp Voice1Code
Voice2	    			; voice bank 2
	nop SelectBank6
	jmp Voice2Code
Voice3             		; voice bank 3
	nop SelectBank7
	jmp Voice3Code
Voice4 					; voice bank 4
	nop SelectBank8
	jmp Voice4Code
	ENDM
	
	MAC BANKS_AND_VECTORS ; end of every bank
	RORG $FFF4
	
SelectBank1 .byte $00 
SelectBank2 .byte $00 
SelectBank3 .byte $00 
SelectBank4 .byte $00
SelectBank5 .byte $00 
SelectBank6 .byte $00 
SelectBank7 .byte $00 
SelectBank8 .byte $00

Link to comment
Share on other sites

BANKS_AND_VECTORS would need to be in every bank, so that wouldn't change.

 

An easy way to split the jump table would be to have Overscan and Vertical Blank in different banks. Vertical Blank needs to call the kernels, so have Overscan handle the voice routines.

 

	MAC JUMP_TABLE_OS_V ; start of Overscan and Voice banks
	RORG $F000
SystemStart				; inititialize system
	nop SelectBank1
	jmp SystemStartCode
VerticalBlank				; game logic (Vertical Blank)
	nop SelectBank5
	jmp VBCode
Overscan
	nop SelectBank1
	jmp OverscanCode
Voice1    				; voice bank 1
	nop SelectBank2
	jmp Voice1Code
Voice2	    			        ; voice bank 2
	nop SelectBank3
	jmp Voice2Code
Voice3             		        ; voice bank 3
	nop SelectBank4
	jmp Voice3Code
	ENDM





	MAC JUMP_TABLE_VB_K ; start of Vertical Blank and Kernel banks
	RORG $F000
SystemStart				; inititialize system
	nop SelectBank1
	jmp SystemStartCode
VerticalBlank				; game logic (Vertical Blank)
	nop SelectBank5
	jmp VBCode
Overscan
	nop SelectBank1
	jmp OverscanCode
IntroKernels				; kernels
	nop SelectBank6
	jmp IntroKernelsCode
Kernels3				; kernels
	nop SelectBank7
	jmp Kernels3Code
Kernels4			        ; kernels
	nop SelectBank8
	jmp Kernels4Code
	ENDM

  • Like 1
Link to comment
Share on other sites

Hmm.. That would certainly help. Thanks!

 

I went on a nice long run and thought this over again and partially reversed my conclusion. It seems to me that BANKS_AND_VECTORS is unchangeable- so I get that. But, with JUMP_TABLE for example, if Bank 3 didn't use the JUMP_TABLE macro, and only had:

SystemStart				; inititialize system
	nop SelectBank1
	jmp SystemStartCode
MCP						; game logic
	nop SelectBank1
	jmp MCPCode
Overscan
	nop SelectBank1
	jmp OverscanCode
IntroKernels				; kernels
	nop SelectBank2
	jmp IntroKernelsCode
Kernels3				; kernels
	nop SelectBank3
	jmp Kernels3Code

and I left the rest of the banks off, then you could always jump to it. And if that bank only needed to jump to bank one, its covered there too- right?

 

Additionally, if I had 16 banks, then bank 16, for example, could have something like

     ORG $F000 ;?????
SUBROUTINE:
     ; insert any subroutine here
     rts ; 

     ORG $F0??  ; Wherever the macro has it
Bank16
     nop SelectBank16
     jmp SelectBank16Code

     ; a larger subroutine could jump to here then rts

I'm still a little weak on ORGs and RORGs nor do I know exactly what address Bank 16 is in the macro.

 

Does this work?

Link to comment
Share on other sites

  • 6 months later...
On ‎12‎/‎10‎/‎2018 at 10:21 AM, SpiceWare said:

EF - has sixteen 4K banks. Uses $1FE0 - $1FEF to select bank, so would need to adjust the BANKS_AND_VECTORS.

I'm having trouble getting this one to work.  Would it look like this? Also, it looks like it wastes 12 bytes between the last hot spot and the reset vector (So I added a RORG):

 

	
	MAC BANKS_AND_VECTORS ; end of every bank
	RORG $1FE0 ;WAS RORG $FFF4
	
SelectBank0 .byte $00 
SelectBank1 .byte $00 
SelectBank2 .byte $00 
SelectBank3 .byte $00
SelectBank4 .byte $00 
SelectBank5 .byte $00 
SelectBank6 .byte $00 
SelectBank7 .byte $00
SelectBank8 .byte $00 
SelectBank9 .byte $00 
SelectBank10 .byte $00 
SelectBank11 .byte $00
SelectBank12 .byte $00 
SelectBank13 .byte $00 
SelectBank14 .byte $00 
SelectBank15 .byte $00
;	.word SystemStart ; NMI used for banks 7 and 8
	RORG $1FFC ;Added because there is blank space.
	.word SystemStart ; RESET
	.word SystemStart ; IRQ
	ENDM
	

 

Edited by BNE Jeff
Link to comment
Share on other sites

14 hours ago, SpiceWare said:

Provided your cartridge ROM starts with RORG $1000, then that looks like it should work.

The jump table- right?  

	MAC JUMP_TABLE ; start of every bank
	RORG $1000

And my 16 banks will ORG $0000, $1000, $2000, … F000- right?  Does the bank with ORG $1000 need to be the one that contains my SystemStart (@ the reset vector)?

Link to comment
Share on other sites

The bank that the SystemStart exists in is ALL of them.  The important thing is whether all banks can reach the "cold start routine" that SystemStart banks to when the 2600 is powered up (bank status is unknown at powerup).  Make sure that the address specified by the reset vector ($xFFC and $xFFD) in every bank is indicating the SystemStart address (using the above method, the code that the macro generates needs to exist at the same location in every bank).

 

Have you tried letting Dasm generate a list when you assemble?  Use the L switch -l followed by a text file name.  You can check that to see if the macro code and system vectors are being placed correctly.  If you are unsure, post one.

  • Like 1
Link to comment
Share on other sites

Yes, the jump table.  

 

Looking at the comments:

  Cartridge class used for Homestar Runner by Paul Slocum.
  There are 16 4K banks (total of 64K ROM).

it looks like there's only the one game that used it, so auto-detect might not recognize your ROM.  Hit ALT-L or COMMAND-L developer key in Stella to see what it IDed the bankswitch type as, for Asteroids it detects F8. The * means autodetected.

1850430070_ScreenShot2019-07-08at9_06_30AM.thumb.png.32dabe410a13e6e44a3700b01b04f37c.png

 

 

If you need to override it then load your game in Stella and:

  1. hit TAB
  2. click on Game Properties...
    176777289_ScreenShot2019-07-08at9_10_48AM.thumb.png.713ee6a99a707f010ab30263688bf55e.png
     
  3. click the Type dropdown
    1950110623_ScreenShot2019-07-08at9_11_47AM.thumb.png.90a1acfa6b921ba159d51bdf76ffe895.png
     
  4. select EF
    486267097_ScreenShot2019-07-08at9_11_55AM.thumb.png.348e73fbd872d9304b6b760c4e62e0f4.png
     
  5. click OK
  6. click Close
  7. reload your game
  • Like 1
Link to comment
Share on other sites

Looking at function isProbablyEF in CartDetector I see:

 

  // Newer EF carts store strings 'EFEF' and 'EFSC' starting at address $FFF8
  // This signature is attributed to "RevEng" of AtariAge

 

I did a quick search but didn't find where @RevEng has done that, maybe this ping will cause him to chime in with a link to his post about this.

Link to comment
Share on other sites

Not sure what the ask is here, but the EFEF/EFSC footer detection was added to stella when I added 64k support to bB.

 

This is the relevant bits from the bB footer...

   if bankswitch == 64
     ORG  $10FF0
     RORG $1FFF0
     lda $ffe0 ; we use wasted space to assist stella with EF format auto-detection
     ORG  $10FF8
     RORG $1FFF8
     ifconst superchip
       .byte "E","F","S","C"
     else
       .byte "E","F","E","F"
     endif

 

  • Like 1
Link to comment
Share on other sites

10 hours ago, Nukey Shay said:

The bank that the SystemStart exists in is ALL of them.  The important thing is whether all banks can reach the "cold start routine" that SystemStart banks to when the 2600 is powered up (bank status is unknown at powerup).  Make sure that the address specified by the reset vector ($xFFC and $xFFD) in every bank is indicating the SystemStart address (using the above method, the code that the macro generates needs to exist at the same location in every bank).

 

Have you tried letting Dasm generate a list when you assemble?  Use the L switch -l followed by a text file name.  You can check that to see if the macro code and system vectors are being placed correctly.  If you are unsure, post one.

Thanks.. I see a problem in the list file..  As noted before, the bankswitch addresses end 16 bytes before the end of the ROM space (why? I don't know).  To place the reset and IRQ vectors in the right place, I added a second RORG to the macro.  Its being ignored.  ORG $FFFC is not being generated by RORG $1FFC.  This is the case on all of the banks.

 

    177  ffe0					      ORG	$FFE0
      0  ffe0					      BANKS_AND_VECTORS
      1  ffe0					      RORG	$1FE0
      2  ffe0
      3  ffe0		       00	   SelectBank0 .byte.b	$00
      4  ffe1		       00	   SelectBank1 .byte.b	$00
      5  ffe2		       00	   SelectBank2 .byte.b	$00
      6  ffe3		       00	   SelectBank3 .byte.b	$00
      7  ffe4		       00	   SelectBank4 .byte.b	$00
      8  ffe5		       00	   SelectBank5 .byte.b	$00
      9  ffe6		       00	   SelectBank6 .byte.b	$00
     10  ffe7		       00	   SelectBank7 .byte.b	$00
     11  ffe8		       00	   SelectBank8 .byte.b	$00
     12  ffe9		       00	   SelectBank9 .byte.b	$00
     13  ffea		       00	   SelectBank10 .byte.b	$00
     14  ffeb		       00	   SelectBank11 .byte.b	$00
     15  ffec		       00	   SelectBank12 .byte.b	$00
     16  ffed		       00	   SelectBank13 .byte.b	$00
     17  ffee		       00	   SelectBank14 .byte.b	$00
     18  ffef		       00	   SelectBank15 .byte.b	$00
     19  fff0
     20  fff0					      RORG	$1FFC
     21  fff0		       00 10		      .word.w	SystemStart
     22  fff2		       00 10		      .word.w	SystemStart
    179  fff4

The macro code:

	
	MAC BANKS_AND_VECTORS ; end of every bank
	RORG $1FE0 ;WAS RORG $FFF4
	
SelectBank0 .byte $00 
SelectBank1 .byte $00 
SelectBank2 .byte $00 
SelectBank3 .byte $00
SelectBank4 .byte $00 
SelectBank5 .byte $00 
SelectBank6 .byte $00 
SelectBank7 .byte $00
SelectBank8 .byte $00 
SelectBank9 .byte $00 
SelectBank10 .byte $00 
SelectBank11 .byte $00
SelectBank12 .byte $00 
SelectBank13 .byte $00 
SelectBank14 .byte $00 
SelectBank15 .byte $00

	RORG $1FFC ;Added because there is blank space.
	.word SystemStart ; RESET
	.word SystemStart ; IRQ
	ENDM

What am I doing wrong there?  I do see that my old RORG reflected a 64K ROM space with $FFF4 (even though it was a 32K game), I'm only reflecting 4K here with $1FFC- does that matter?

Link to comment
Share on other sites

3 minutes ago, BNE Jeff said:

 ORG $FFFC is not being generated by RORG $1FFC

 

RORG won't generate an ORG statement on it's own. Dasm has no idea about the 2600 memory space. You need to pair the ORG with an appropriate RORG yourself.

Link to comment
Share on other sites

8 hours ago, SpiceWare said:

Yes, the jump table.  

 

Looking at the comments:


  Cartridge class used for Homestar Runner by Paul Slocum.
  There are 16 4K banks (total of 64K ROM).

it looks like there's only the one game that used it, so auto-detect might not recognize your ROM.  Hit ALT-L or COMMAND-L developer key in Stella to see what it IDed the bankswitch type as, for Asteroids it detects F8. The * means autodetected.

 

 

 

If you need to override it then load your game in Stella and:

  1. hit TAB
  2. click on Game Properties...
  3. click the Type dropdown
  4. select EF
  5. click OK
  6. click Close
  7. reload your game

Thanks..  I was able to switch using this.  It was generally identifying the ROM as 4K although for some of my attempts, it thought it was a 64K Megaboy.

Link to comment
Share on other sites

11 minutes ago, BNE Jeff said:

Thanks..  I was able to switch using this.  It was generally identifying the ROM as 4K although for some of my attempts, it thought it was a 64K Megaboy.

 

Did that fix the problem?  If so change this:

	RORG $1FFC	;Added because there is blank space.
	.word SystemStart ; RESET
	.word SystemStart ; IRQ

 

to this: 

	RORG $1FF8
	.byte "E","F","E","F"
	.word SystemStart ; RESET
	.word SystemStart ; IRQ

 

and Stella should autodetect EF bankswitching.

Link to comment
Share on other sites

30 minutes ago, RevEng said:

RORG won't generate an ORG statement on it's own. Dasm has no idea about the 2600 memory space. You need to pair the ORG with an appropriate RORG yourself.

Dang it!  Thanks for the help everybody.  I stuck 12 bytes in the macro as a spacer.  64K EF autodetected:

 

 

2019-07-08 (1).png

Edited by BNE Jeff
  • Like 1
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...