Add lock bit, necessary for NT-234's Road Fighter

This commit is contained in:
NewRisingSun
2021-04-14 21:03:59 +02:00
parent 86356c24c2
commit 825cdb8788

View File

@@ -108,6 +108,12 @@ static DECLFR(BMCD1038Read) {
return CartBR(A);
}
static DECLFW(BMCD1038Write) {
/* Only recognize the latch write if the lock bit has not been set. Needed for NT-234 "Road Fighter" */
if (~latche & 0x200)
LatchWrite(A, V);
}
static void BMCD1038Reset(void) {
dipswitch++;
dipswitch &= 3;
@@ -117,9 +123,17 @@ static void BMCD1038Reset(void) {
BMCD1038Sync();
}
static void BMCD1038Power(void) {
LatchPower();
/* Trap latch writes to enforce the "Lock" bit */
SetWriteHandler(0x8000, 0xFFFF, BMCD1038Write);
}
void BMCD1038_Init(CartInfo *info) {
Latch_Init(info, BMCD1038Sync, BMCD1038Read, 0x0000, 0x8000, 0xFFFF, 0);
info->Reset = BMCD1038Reset;
info->Power = BMCD1038Power;
AddExState(&dipswitch, 1, 0, "DIPSW");
}