From cbc52707461c15a12a03d0dd71bf519084bea64b Mon Sep 17 00:00:00 2001 From: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com> Date: Fri, 25 Apr 2025 01:01:56 +0200 Subject: [PATCH] Add mapper 256 submapper 12. --- src/boards/onebus.c | 10 ++++++---- src/x6502.c | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/boards/onebus.c b/src/boards/onebus.c index e70f013..c4698bf 100644 --- a/src/boards/onebus.c +++ b/src/boards/onebus.c @@ -119,7 +119,9 @@ static void CSync(int AND, int OR) { static void Sync256(void) { PSync(0x0FFF, 0x000); CSync(0x7FFF, 0x000); - encryptOpcodes =submapper ==14 && cpu410x[0x1C] &0x40? 67: 0; + encryptOpcodes =0; + if (submapper ==12 && cpu410x[0x1C] &0x40) encryptOpcodes =12; + if (submapper ==14 && cpu410x[0x1C] &0x40) encryptOpcodes =14; } static const uint8 cpuMangles[16][4] = { @@ -135,7 +137,7 @@ static const uint8 cpuMangles[16][4] = { { 0, 1, 2, 3 }, /* Submapper 9: unused so far */ { 0, 1, 2, 3 }, /* Submapper A: unused so far */ { 0, 1, 2, 3 }, /* Submapper B: unused so far */ - { 0, 1, 2, 3 }, /* Submapper C: unused so far */ + { 0, 1, 2, 3 }, /* Submapper C: Cheertone (CPU opcode encryption only) */ { 0, 1, 2, 3 }, /* Submapper D: Cube Tech (CPU opcode encryption only) */ { 0, 1, 2, 3 }, /* Submapper E: Karaoto (CPU opcode encryption only) */ { 0, 1, 2, 3 } /* Submapper F: Jungletac (CPU opcode encryption only) */ @@ -324,7 +326,7 @@ static void UNLOneBusPower(void) { memset(ppu201x, 0x00, sizeof(ppu201x)); memset(apu40xx, 0x00, sizeof(apu40xx)); cpu410x[0x0F] =0xFF; - cpu410x[0x1C] =submapper ==14? 0x40: 0x00; + cpu410x[0x1C] =submapper ==12 || submapper ==14? 0x40: 0x00; SetupCartCHRMapping(0, PRGptr[0], PRGsize[0], 0); @@ -356,7 +358,7 @@ static void UNLOneBusReset(void) { memset(ppu201x, 0x00, sizeof(ppu201x)); memset(apu40xx, 0x00, sizeof(apu40xx)); cpu410x[0x0F] =0xFF; - cpu410x[0x1C] =submapper ==14? 0x40: 0x00; + cpu410x[0x1C] =submapper ==12 || submapper ==14? 0x40: 0x00; reg4242 =0; dipswitch ^=8; diff --git a/src/x6502.c b/src/x6502.c index e975414..6c820cd 100644 --- a/src/x6502.c +++ b/src/x6502.c @@ -492,7 +492,8 @@ static void X6502_RunDebug(int32 cycles) { X.preexec = 1; b1 = RdMem(_PC); _PC++; - if (encryptOpcodes ==67) b1 =b1 &0x3F | b1 >>1 &0x40 | b1 <<1 &0x80; + if (encryptOpcodes ==12) b1 =b1 &0x39 | b1 >>1 &0x42 | b1 <<1 &0x84; + if (encryptOpcodes ==14) b1 =b1 &0x3F | b1 >>1 &0x40 | b1 <<1 &0x80; switch (b1) { #include "ops.h" } @@ -522,7 +523,8 @@ static void X6502_RunDebug(int32 cycles) { FCEU_SoundCPUHook(temp); _PC++; - if (encryptOpcodes ==67) b1 =b1 &0x3F | b1 >>1 &0x40 | b1 <<1 &0x80; + if (encryptOpcodes ==12) b1 =b1 &0x39 | b1 >>1 &0x42 | b1 <<1 &0x84; + if (encryptOpcodes ==14) b1 =b1 &0x3F | b1 >>1 &0x40 | b1 <<1 &0x80; switch (b1) { #include "ops.h" } @@ -620,7 +622,8 @@ void X6502_Run(int32 cycles) FCEU_SoundCPUHook(temp); X.PC = pbackus; _PC++; - if (encryptOpcodes ==67) b1 =b1 &0x3F | b1 >>1 &0x40 | b1 <<1 &0x80; + if (encryptOpcodes ==12) b1 =b1 &0x39 | b1 >>1 &0x42 | b1 <<1 &0x84; + if (encryptOpcodes ==14) b1 =b1 &0x3F | b1 >>1 &0x40 | b1 <<1 &0x80; switch (b1) { #include "ops.h" }