32X BIOS on MD side

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Post Reply
notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

32X BIOS on MD side

Post by notaz » Sun Sep 13, 2009 7:16 pm

Besides some exception vectors it has these 2 strange routines:

Code: Select all

...
ROM:000000B8                 dc.l $88030E
ROM:000000BC                 dc.l $880314
ROM:000000C0 ; ---------------------------------------------------------------------------
ROM:000000C0                 bset    #0,($A15107).l
ROM:000000C8                 move.b  d0,(a1)
ROM:000000CA                 bclr    #0,($A15107).l
ROM:000000D2                 rts
ROM:000000D4 ; ---------------------------------------------------------------------------
ROM:000000D4                 movem.l d7/a1,-(sp)
ROM:000000D8                 bset    #0,($A15107).l
ROM:000000E0                 lea     ($A130F1).l,a1
ROM:000000E6                 moveq   #7,d7
ROM:000000E8
ROM:000000E8 loc_E8:                                 ; CODE XREF: ROM:000000EEj
ROM:000000E8                 move.b  (a0)+,(a1)
ROM:000000EA                 adda.w  #2,a1
ROM:000000EE                 dbf     d7,loc_E8
ROM:000000F2                 bclr    #0,($A15107).l
ROM:000000FA                 movem.l (sp)+,d7/a1
ROM:000000FE                 rts
ROM:000000FE ; end of 'ROM'
Both of them set the RV bit when they start and clear it on exit, which makes sense, as that can't be done when running from 88xxxx or subsequent ROM bank as those mappings disappear when RV bit is set.

But look at second function, it transfers 8 bytes to $A130F1, what could that be for? Chaotix seems to be using first function with a1 set to $A130F1 and d0 to 0. I assume it's not for accessing the SRAM register?
Does anyone know?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Sep 14, 2009 3:09 am

The first is for enabling/disabling the SRAM for SSF2 type SRAM, and the second is for setting SSF2 bank registers.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Sep 14, 2009 9:11 am

I guess SEGA expected some 32X games to be larger than the usual 4 MB rom space so they included the bank switch code (used by super SF2 game on genesis) as an interrupt function :)

notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

Post by notaz » Mon Sep 14, 2009 9:52 am

Chilly Willy wrote:the second is for setting SSF2 bank registers.
Really? By writing some 8 values to $A130F1?

I thought SSF2 banking works like this:
write to $A130F3 sets a bank at $080000-$0fffff
write to $A130F5 sets a bank at $100000-$17ffff
...

Graz
Very interested
Posts: 81
Joined: Thu Aug 23, 2007 12:36 am
Location: Orlando, FL

Post by Graz » Mon Sep 14, 2009 11:32 am

notaz wrote:Really? By writing some 8 values to $A130F1?
That's not what this code does:

Code: Select all

ROM:000000E8 loc_E8:                                 ; CODE XREF: ROM:000000EEj
ROM:000000E8                 move.b  (a0)+,(a1)
ROM:000000EA                 adda.w  #2,a1
ROM:000000EE                 dbf     d7,loc_E8 
It writes 8 values to 8 addresses, each two bytes apart - $A130F1, $A130F13, $A130F5, etc. There's an increment of two on the destination address at $EA. This code sets all banks from an array of bank indices.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Sep 14, 2009 3:52 pm

Yeah, you missed that add 2 to a1. :D

notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

Post by notaz » Mon Sep 14, 2009 6:30 pm

Chilly Willy wrote:Yeah, you missed that add 2 to a1. :D
damn! It's sometimes so easy to miss the obvious.

Post Reply