what is mask in the mappers infos

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
nixjoe
Posts: 7
Joined: Thu Oct 10, 2019 12:56 am

what is mask in the mappers infos

Post by nixjoe » Wed Jul 01, 2020 10:54 pm

could you guys send me some links talking about register mask ? lots mapper have mask info, but i dont understand them.

nixjoe
Posts: 7
Joined: Thu Oct 10, 2019 12:56 am

Re: what is mask in the mappers infos

Post by nixjoe » Thu Jul 02, 2020 7:14 pm

for example: 0xe003 in mapper 134
http://wiki.nesdev.com/w/index.php/INES_Mapper_134

Image

lidnariq
Posts: 9388
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: what is mask in the mappers infos

Post by lidnariq » Thu Jul 02, 2020 7:19 pm

IF (cpu-address BITWISE-AND mask) EQUAL register-address

User avatar
tokumaru
Posts: 11696
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: what is mask in the mappers infos

Post by tokumaru » Thu Jul 02, 2020 7:37 pm

In order to save money, memory mapped devices (such as mappers, the PPU, etc.) usually only watch the minimum amount of address lines necessary to make them visible without interfering with other memory mapped devices. The "mask" value you see in some mapper documents indicates which bits of the address the mapper is effectively taking into consideration when decoding addresses. Bits that are not set in this mask do not matter.

$E003 in binary is 1110000000000011, meaning that this mapper "monitors" the top 3 and the lower 2 bits of all memory accesses that the CPU makes. It needs to look at the top bit (bit 15) in order to tell whether the address is above (inclusive) or below $8000, since the MMC3 compatible registers are located in the top half of the memory map ($8000-$FFFF). The next two bits (bits 14 and 13) are necessary so that the mapper can ignore accesses to addresses below $6000 (0110000000000000), since that space is used by the built-in RAM, the PPU and the APU. The lower 2 bits (bits 1 and 0) are necessary to select one of the 4 $6000 registers ($6000, $6001, $6002 or $6003).

The fact that some bits are ignored during address decoding is what causes registers to be mirrored across the memory map in specific ways.

nixjoe
Posts: 7
Joined: Thu Oct 10, 2019 12:56 am

Re: what is mask in the mappers infos

Post by nixjoe » Thu Jul 02, 2020 11:33 pm

thanks alot! both of you !! appreiciated !!!
So it's listed in the mappers infos so that the programmer can write emulation(or verilog) conveniently.

Post Reply