mirror of https://github.com/mgba-emu/mgba.git
8-bit write to IO
This commit is contained in:
parent
8215afcee6
commit
6a1afbda50
|
@ -109,7 +109,16 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
|
||||||
case REG_IME:
|
case REG_IME:
|
||||||
GBAWriteIME(gba, value);
|
GBAWriteIME(gba, value);
|
||||||
break;
|
break;
|
||||||
case REG_HALTCNT:
|
default:
|
||||||
|
GBALog(GBA_LOG_STUB, "Stub I/O register write: %03x", address);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gba->memory.io[address >> 1] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GBAIOWrite8(struct GBA* gba, uint32_t address, uint8_t value) {
|
||||||
|
if (address == REG_HALTCNT) {
|
||||||
value &= 0x80;
|
value &= 0x80;
|
||||||
if (!value) {
|
if (!value) {
|
||||||
GBAHalt(gba);
|
GBAHalt(gba);
|
||||||
|
@ -117,12 +126,10 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
|
||||||
GBALog(GBA_LOG_STUB, "Stop unimplemented");
|
GBALog(GBA_LOG_STUB, "Stop unimplemented");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
|
||||||
GBALog(GBA_LOG_STUB, "Stub I/O register write: %03x", address);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
value <<= 8 * (address & 1);
|
||||||
gba->memory.io[address >> 1] = value;
|
value |= (gba->memory.io[(address & (SIZE_IO - 1)) >> 1]) & ~(0xFF << (8 * (address & 1)));
|
||||||
|
GBAIOWrite(gba, address, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value) {
|
void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value) {
|
||||||
|
|
|
@ -143,6 +143,7 @@ enum GBAIORegisters {
|
||||||
|
|
||||||
void GBAIOInit(struct GBA* gba);
|
void GBAIOInit(struct GBA* gba);
|
||||||
void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value);
|
void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value);
|
||||||
|
void GBAIOWrite8(struct GBA* gba, uint32_t address, uint8_t value);
|
||||||
void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value);
|
void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value);
|
||||||
uint16_t GBAIORead(struct GBA* gba, uint32_t address);
|
uint16_t GBAIORead(struct GBA* gba, uint32_t address);
|
||||||
|
|
||||||
|
|
|
@ -385,6 +385,7 @@ void GBAStore8(struct ARMMemory* memory, uint32_t address, int8_t value, int* cy
|
||||||
((int8_t*) gbaMemory->iwram)[address & (SIZE_WORKING_IRAM - 1)] = value;
|
((int8_t*) gbaMemory->iwram)[address & (SIZE_WORKING_IRAM - 1)] = value;
|
||||||
break;
|
break;
|
||||||
case BASE_IO:
|
case BASE_IO:
|
||||||
|
GBAIOWrite8(gbaMemory->p, address & (SIZE_IO - 1), value);
|
||||||
break;
|
break;
|
||||||
case BASE_PALETTE_RAM:
|
case BASE_PALETTE_RAM:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue