INES Mapper 178: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(→‎Infrared: add link to thread)
(Add other banking modes, errata)
Line 1: Line 1:
[[Category:iNES Mappers|178]][[Category:Mappers using $4020-$5FFF|178]]
[[Category:iNES Mappers|178]][[Category:Mappers using $4020-$5FFF|178]]iNES Mapper 178 is used by some games from Waixing and Henge Dianzi as well as some educational computers. It always uses CHR-RAM and can use up to 32 KiB of PRG-RAM, banked in 8 KiB amounts.
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.
=Registers=
==Mode Register ($4800)==
7654 3210
---------
.... .PPM
      ||+- Select nametable mirroring type
      ||    0: Vertical
      ||    1: Horizontal
      ++-- Select PRG banking mode
            0: 32 KiB PRG-ROM bank at CPU $8000-$FFFF, low bank bit 0 ignored
            1: 16 KiB PRG-ROM bank at CPU $8000-$BFFF comprised of selectable high and low banks
                16 KiB PRG-ROM bank at CPU $C000-$FFFF comprised of selectable high and fixed low bank 7
            2: 16 KiB PRG-ROM bank at CPU $8000-$BFFF comprised of selectable high and low banks
                16 KiB PRG-ROM bank at CPU $C000-$FFFF being a mirror of $8000-$BFFF
            3: 16 KiB PRG-ROM bank at CPU $8000-$BFFF comprised of selectable high and low banks
                16 KiB PRG-ROM bank at CPU $C000-$FFFF comprised of selectable high, fixed low bank bits 1-2
                and selectable low bank bit 0 (i.e. low bank register content OR 6)


  $4800:  [.... ...M]
Banking modes 2 and 3 are rarely used. One multicart that uses them is ''4-in-1 (SO1)''.
      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.
==Low PRG Bank Register ($4801)==
7654 3210
---------
.... .LLL
      +++- 16 KiB bank number bits 0-2.


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.
Bit 0 is ignored in 32 KiB PRG banking mode.


The new PRG bank is only committed when $4801 is written. Therefore, you should write $4802 first and then $4801 to complete the remapping.
==High PRG Bank Register ($4802)==
7654 3210
---------
HHHH HHHH
++++-++++ 16 KiB bank number bits 3-10.
 
The final 16 KiB PRG-ROM bank number thus is $4801 OR ($4802 SHL 3).
 
==WRAM Bank Register ($4803) ==
7654 3210
---------
.... ..BB
        ++ Select 8 KiB WRAM bank at CPU $6000-$7FFF


==Infrared==
==Infrared==
Apparently some cartridge having infrared. Infrared receiving is working by having two registers:
Apparently some cartridge have an infrared sensor. Infrared receiving is working by having two registers:
   $5000-$5FFF:  [.... ...V]  (read only)
   $5000-$5FFF:  [.... ...V]  (read only)
     V = read current bit from IR sensor
     V = read current bit from IR sensor
   $6000-$7FFF:  [I... ....]  (write only)
   $6000-$7FFF:  [I... ....]  (write only)
     I = set to activate interrupts by infrared signal
     I = set to activate interrupts by infrared signal
=Errata=
* The commonly-available ROM images of
** ''宠物: 小精灵 IV (Chǒngwù: Xiǎo Jīnglíng IV)'', headerless CRC32 0xB0B13DBD
** ''Education Computer 32-in-1 (Game Star) [!]'', headerless CRC32 0xF834F634
: will not work when emulated using the above description. The meaning of registers $4801 and $4802 is swapped, and an emulator must shift the value of $4802 one bit to the left before ORing with $4801. While it cannot be ruled out that these games use an alternative version of the hardware, the more likely explanation is that these are simply bad dumps (notwithstanding GoodNES 3.23b's [!] tag) where the dumper confused the two bank registers.
* Supposedly, the new PRG bank is only committed when $4801 is written. Emulating this supposed behavior however will break ''Ping Pong'', while commiting the PRG bank after any $480x write does not seem to break anything else.
* Most of the educational computers using this mapper require Dendy video timing and will freeze at various points when run with NTSC timing.
==See also==
==See also==
* https://forums.nesdev.org/viewtopic.php?t=16657
* https://forums.nesdev.org/viewtopic.php?t=16657

Revision as of 16:56, 7 March 2018

iNES Mapper 178 is used by some games from Waixing and Henge Dianzi as well as some educational computers. It always uses CHR-RAM and can use up to 32 KiB of PRG-RAM, banked in 8 KiB amounts.

Registers

Mode Register ($4800)

7654 3210
---------
.... .PPM
      ||+- Select nametable mirroring type
      ||    0: Vertical
      ||    1: Horizontal
      ++-- Select PRG banking mode
            0: 32 KiB PRG-ROM bank at CPU $8000-$FFFF, low bank bit 0 ignored
            1: 16 KiB PRG-ROM bank at CPU $8000-$BFFF comprised of selectable high and low banks
               16 KiB PRG-ROM bank at CPU $C000-$FFFF comprised of selectable high and fixed low bank 7
            2: 16 KiB PRG-ROM bank at CPU $8000-$BFFF comprised of selectable high and low banks
               16 KiB PRG-ROM bank at CPU $C000-$FFFF being a mirror of $8000-$BFFF
            3: 16 KiB PRG-ROM bank at CPU $8000-$BFFF comprised of selectable high and low banks
               16 KiB PRG-ROM bank at CPU $C000-$FFFF comprised of selectable high, fixed low bank bits 1-2
               and selectable low bank bit 0 (i.e. low bank register content OR 6)

Banking modes 2 and 3 are rarely used. One multicart that uses them is 4-in-1 (SO1).

Low PRG Bank Register ($4801)

7654 3210
---------
.... .LLL
      +++- 16 KiB bank number bits 0-2.

Bit 0 is ignored in 32 KiB PRG banking mode.

High PRG Bank Register ($4802)

7654 3210
---------
HHHH HHHH
++++-++++ 16 KiB bank number bits 3-10.

The final 16 KiB PRG-ROM bank number thus is $4801 OR ($4802 SHL 3).

WRAM Bank Register ($4803)

7654 3210
---------
.... ..BB
       ++ Select 8 KiB WRAM bank at CPU $6000-$7FFF

Infrared

Apparently some cartridge have an infrared sensor. Infrared receiving is working by having two registers:

 $5000-$5FFF:  [.... ...V]  (read only)
    V = read current bit from IR sensor
 $6000-$7FFF:  [I... ....]  (write only)
    I = set to activate interrupts by infrared signal

Errata

  • The commonly-available ROM images of
    • 宠物: 小精灵 IV (Chǒngwù: Xiǎo Jīnglíng IV), headerless CRC32 0xB0B13DBD
    • Education Computer 32-in-1 (Game Star) [!], headerless CRC32 0xF834F634
will not work when emulated using the above description. The meaning of registers $4801 and $4802 is swapped, and an emulator must shift the value of $4802 one bit to the left before ORing with $4801. While it cannot be ruled out that these games use an alternative version of the hardware, the more likely explanation is that these are simply bad dumps (notwithstanding GoodNES 3.23b's [!] tag) where the dumper confused the two bank registers.
  • Supposedly, the new PRG bank is only committed when $4801 is written. Emulating this supposed behavior however will break Ping Pong, while commiting the PRG bank after any $480x write does not seem to break anything else.
  • Most of the educational computers using this mapper require Dendy video timing and will freeze at various points when run with NTSC timing.

See also