X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=mappers%2F228.c;h=d08485aab66eb5f3c527327f3be6e5da7d85828c;hb=5bd16b94320afa9dfba4985f5d69c2d84bae4c33;hp=bfae3a63db3319eba82668f0eafb214dbe39f095;hpb=d97315ac0bca825d2d50a44453bc5652946e2c67;p=fceu.git diff --git a/mappers/228.c b/mappers/228.c index bfae3a6..d08485a 100644 --- a/mappers/228.c +++ b/mappers/228.c @@ -20,14 +20,28 @@ #include "mapinc.h" +//16 bits of ram in total +//only use bottom 4 bits as ram though +static uint8 mapper228_ram[4]; + +static DECLFR(Mapper228_read) +{ + return mapper228_ram[A & 3] & 0xF; +} + static DECLFW(Mapper228_write) { uint32 page,pagel,pageh; + //write to ram + if (A < 0x6000) + { + mapper228_ram[A & 3] = V; + return; + } MIRROR_SET((A>>13)&1); - page=(A>>7)&0x3F; - //printf("%04x\n",A); + if((page&0x30)==0x30) page-=0x10; @@ -41,13 +55,16 @@ static DECLFW(Mapper228_write) static void A52Reset(void) { - Mapper228_write(0,0); + Mapper228_write(0x8000, 0); } void Mapper228_init(void) { MapperReset=A52Reset; A52Reset(); - SetWriteHandler(0x8000,0xffff,Mapper228_write); + SetWriteHandler(0x8000, 0xFFFF, Mapper228_write); + SetWriteHandler(0x4020, 0x5FFF, Mapper228_write); + SetReadHandler (0x4020, 0x5FFF, Mapper228_read); + AddExState(mapper228_ram, 4, 0, "MRAM"); }