MCPcopy Create free account
hub / github.com/TASEmulators/fceux / Mapper218_Init

Function Mapper218_Init

src/boards/datalatch.cpp:486–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484}
485
486void Mapper218_Init(CartInfo *info)
487{
488 info->Power = &Mapper218_Power;
489
490 //fixed PRG mapping
491 setprg32(0x8000, 0);
492
493 //this mapper is supposed to interpret the iNES header bits specially
494 static const uint8 mirrorings[] = {MI_V,MI_H,MI_0,MI_1};
495 SetupCartMirroring(mirrorings[info->mirrorAs2Bits],1,nullptr);
496
497 //cryptic logic to effect the CHR RAM mappings by mapping 1k blocks to NTARAM according to how the pins are wired
498 //this could be done by bit logic, but this is self-documenting
499 static const uint8 mapping[] = {
500 0,1,0,1,0,1,0,1, //mirrorAs2Bits==0
501 0,0,1,1,0,0,1,1, //mirrorAs2Bits==1
502 0,0,0,0,1,1,1,1, //mirrorAs2Bits==2
503 0,0,0,0,0,0,0,0 //mirrorAs2Bits==3
504 };
505 for(int i=0;i<8;i++)
506 VPageR[i] = &NTARAM[mapping[info->mirrorAs2Bits*8+i]];
507
508 PPUCHRRAM = 0xFF;
509}
510
511//------------------ Map 240 ---------------------------
512

Callers

nothing calls this directly

Calls 2

setprg32Function · 0.85
SetupCartMirroringFunction · 0.85

Tested by

no test coverage detected