Fix bankswitching: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The following info is based off MAME's source and was not yet verified against real hardware. It can therefore be inaccurate/incomplete.
In some late games, the [[S ROM]] 128KiB size limit was expanded with the use of {{Chipname|NEO-CMC}} chips.


The {{Chipname|NEO-CMC}} chips exploit the fact that the [[GPU]] continues to render the [[fix layer]] outside of the visible screen area. This allows them to use the normally unused $7500~$75FF [[VRAM]] region.
This was devised as some sort of hack, taking advantage that the [[VDC]] continues rendering the [[fix layer]] outside of the visible screen area. This allows the chips to use the normally unused $7500~$75FF [[VRAM]] region to add bits to the tile numbers.


Probably a hack found when someone complained the [[S ROM]] max. size was too small :)
The chips use latches to store the additional bits at the beginning of a line, and "distributes" them during render. Synchronization might just be free running, started by /RESET and clocked with 6MB ?


== NEO-CMC 42 ==
Games marked [*] do hold 512KB fix data, however they ultimately only use a 128KB section, making the banking mechanism pointless.


The 042 version of [[NEO-CMC]] is able to change the tile bank (4 maximum) for each line of [[fix layer|fix]] tiles (8 pixels), allowing to use more than 4096 tiles. For this, the $7500~$75BF area of VRAM is used.
NEO-CMC 042 has been observed using type 1 only. NEO-CMC 050 has been observed using both type 1 and type 2.


*The $7500~$753F area even words contains a flag to indicate if the bank has to be changed for the corresponding tile line.
==Type 1 (per line banking)==
*The $7580~$75BF area even words contains bank numbers for each of the tile lines.


If for a given line, the flag is set to $0200, the bank is read and changed and will remain the same until it's changed again (doesn't return to 0 if the next line hasn't the flag set).
Infos from Mr K (MAME).


Bank number:
Used by:
{{16BitRegister|Has to be $FF? ($0F works?)|8|Unused ?|6|Bank number|2}}
* [[Garou - Mark of the Wolves]] (NEO-CMC 042)
* [[Metal Slug 3]] (NEO-CMC 042) [*]
* [[Metal Slug 4]] (NEO-CMC 050) [*] (parental advisory screen glitched due to wrong banking)


Bank bits are inverted (00 = bank 3, 11 = bank 0).
Type 1 allows fix data up to 512KiB (16384 tiles instead of 4096), by changing the bank (4 maximum) for groups of 2 line of tiles (or more ?). For this, the $7500~$75BF area in VRAM is used.


* The $7500~$753F area even words (32 total) contain a flag to indicate if the bank has to be changed for the corresponding tile line.
* The $7580~$75BF area even words (32 total) contain bank numbers for each of the tile lines.


MAME video/neogeo.c CMC42 handling:
If for a given line, the flag is set to $0200 (group size ?), the bank is read, changed, and will remain the same until it's changed again (it doesn't go back to 0 if the next line doesn't have the flag set).
<syntaxhighlight lang="c">
if (banked && state->m_fixed_layer_bank_type == 1)
{
int garoubank = 0;
int k = 0;
int y = 0;
while (y < 32)
{
if (state->m_videoram[0x7500 + k] == 0x0200 && (state->m_videoram[0x7580 + k] & 0xff00) == 0xff00)
{
garoubank = state->m_videoram[0x7580 + k] & 3;
garouoffsets[y++] = garoubank;
}
garouoffsets[y++] = garoubank;
k += 2;
}
}
</syntaxhighlight>


Mame driver increments fix line twice when a bank change is requested, which implies:
Bank number:
{{16BitRegister|Has to be $FF ($0F works?)|8|Unused ?|6|Bank number|2}}


- It is only possible to bank lines 2 by 2.
Bank bits are inverted (00 = bank 3, 11 = bank 0).


- Actual vram offset position for each line varies with banking configurations
'''This needs further research, see MAME video/neogeo.c'''


==Type 2 (per tile banking)==


== NEO-CMC 50 ==
[[File:Cmc50bs.png|400px|right]]


[[File:Cmc50bs.png|400px|right]]
Used by:
* [[The King of Fighters 2000]] (NEO-CMC 050)
* [[Matrimelee]] (NEO-CMC 050) [*]
* [[SNK vs. Capcom - SVC Chaos]] (NEO-CMC 050)
* [[The King of Fighters 2003]] (NEO-CMC 050)


The 050 version of NEO-CMC is able to add 2 bits to the [[fix layer|fix]] tile numbers, allowing to use 16384 tiles at most (512KiB [[S ROM]]) at any time. For this, the $7500~$75DF area of VRAM is used.
Type 2 allows to add 2 bits to all the fix tile indexes individually, also allowing to use 16384 tiles at most but in a simpler manner and with no restrictions. For this, the $7500~$75DF area of VRAM is used.


Each word in this area gives the bank numbers for 6 horizontally consecutive fix tiles:
Each word in this area gives the bank number for 6 horizontally consecutive fix tiles corresponding to the line:
{{16BitRegister|Unused ?|4|a|2|b|2|c|2|d|2|e|2|f|2}}
{{16BitRegister|Unused ?|4|a|2|b|2|c|2|d|2|e|2|f|2}}



Latest revision as of 02:39, 24 February 2019

In some late games, the S ROM 128KiB size limit was expanded with the use of NEO-CMC chips.

This was devised as some sort of hack, taking advantage that the VDC continues rendering the fix layer outside of the visible screen area. This allows the chips to use the normally unused $7500~$75FF VRAM region to add bits to the tile numbers.

The chips use latches to store the additional bits at the beginning of a line, and "distributes" them during render. Synchronization might just be free running, started by /RESET and clocked with 6MB ?

Games marked [*] do hold 512KB fix data, however they ultimately only use a 128KB section, making the banking mechanism pointless.

NEO-CMC 042 has been observed using type 1 only. NEO-CMC 050 has been observed using both type 1 and type 2.

Type 1 (per line banking)

Infos from Mr K (MAME).

Used by:

Type 1 allows fix data up to 512KiB (16384 tiles instead of 4096), by changing the bank (4 maximum) for groups of 2 line of tiles (or more ?). For this, the $7500~$75BF area in VRAM is used.

  • The $7500~$753F area even words (32 total) contain a flag to indicate if the bank has to be changed for the corresponding tile line.
  • The $7580~$75BF area even words (32 total) contain bank numbers for each of the tile lines.

If for a given line, the flag is set to $0200 (group size ?), the bank is read, changed, and will remain the same until it's changed again (it doesn't go back to 0 if the next line doesn't have the flag set).

Bank number:

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Has to be $FF ($0F works?) Unused ?Bank number

Bank bits are inverted (00 = bank 3, 11 = bank 0).

This needs further research, see MAME video/neogeo.c

Type 2 (per tile banking)

Used by:

Type 2 allows to add 2 bits to all the fix tile indexes individually, also allowing to use 16384 tiles at most but in a simpler manner and with no restrictions. For this, the $7500~$75DF area of VRAM is used.

Each word in this area gives the bank number for 6 horizontally consecutive fix tiles corresponding to the line:

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Unused ? abcdef

Those bank bits are inverted (00 = bank 3, 11 = bank 0).

The words are organized as in the fix map for a PAL screen (first and last lines aren't used): from top to bottom and left to right. The "e" and "f" group of bits are unused in the last column ($75C0+).

Examples:

  • Tile at X=0, Y=1 has its bank number in bits a of $7500
  • Tile at X=0, Y=5 has its bank number in bits a of $7504
  • Tile at X=3, Y=2 has its bank number in bits d of $7501
  • Tile at X=7, Y=9 has its bank number in bits b of $7528