mirror of https://github.com/mgba-emu/mgba.git
8-bit write to IO
This commit is contained in:
parent
8215afcee6
commit
6a1afbda50
|
@ -109,14 +109,6 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
|
|||
case REG_IME:
|
||||
GBAWriteIME(gba, value);
|
||||
break;
|
||||
case REG_HALTCNT:
|
||||
value &= 0x80;
|
||||
if (!value) {
|
||||
GBAHalt(gba);
|
||||
} else {
|
||||
GBALog(GBA_LOG_STUB, "Stop unimplemented");
|
||||
}
|
||||
return;
|
||||
default:
|
||||
GBALog(GBA_LOG_STUB, "Stub I/O register write: %03x", address);
|
||||
break;
|
||||
|
@ -125,6 +117,21 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
|
|||
gba->memory.io[address >> 1] = value;
|
||||
}
|
||||
|
||||
void GBAIOWrite8(struct GBA* gba, uint32_t address, uint8_t value) {
|
||||
if (address == REG_HALTCNT) {
|
||||
value &= 0x80;
|
||||
if (!value) {
|
||||
GBAHalt(gba);
|
||||
} else {
|
||||
GBALog(GBA_LOG_STUB, "Stop unimplemented");
|
||||
}
|
||||
return;
|
||||
}
|
||||
value <<= 8 * (address & 1);
|
||||
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) {
|
||||
switch (address) {
|
||||
case REG_DMA0SAD_LO:
|
||||
|
|
|
@ -143,6 +143,7 @@ enum GBAIORegisters {
|
|||
|
||||
void GBAIOInit(struct GBA* gba);
|
||||
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);
|
||||
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;
|
||||
break;
|
||||
case BASE_IO:
|
||||
GBAIOWrite8(gbaMemory->p, address & (SIZE_IO - 1), value);
|
||||
break;
|
||||
case BASE_PALETTE_RAM:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue