INES Mapper 178

From Nesdev wiki
Jump to: navigation, search

VirtuaNesEX sources call this mapper "Education / WaiXing / HengGe". However, virtuanes is among most other emulators in not supporting it fully; a game "Pet Family ES-1081" has a larger PRG than this mapper was originally supposed to handle, and only Nestopia 1.40u4 has been supporting it. The rest of the emulators will manifest a bug in the nametables when the main game engine starts. With r2536, FCEUX supports it; bizhawk does as well.

This is a simple mapper.

  $4800:  [.... ...M]
     M = Mirror mode
         %0 = Vertical
         %1 = Horizontal
  $4801:  [...P PPP.]
     P = Some bits of the selected 32K PRG bank
  $4802:  [pppp pppp]
     p = Some more bits of the selected 32K PRG bank

The selected 32K PRG bank (mapped to $8000) is P + (p<<2). The older emulators are masking this result by & 0xF which is what breaks the larger PRG games. It is unclear whether this mask is necessary for some games to work.

This addition is unusual but would be expected from a multicart if $4802 originally meant "start of program" and $4801 "address within program". Pet Family seems to boot up and get past the nametable bug using an OR instead of a + which strikes me as much more likely.

The new PRG bank is only committed when $4801 is written. Therefore, you should write $4802 first and then $4801 to complete the remapping.