mirror of https://github.com/mgba-emu/mgba.git
DS Slot-1: Implement chip ID
This commit is contained in:
parent
495ca50dc0
commit
bdf8f73ba5
|
@ -20,6 +20,7 @@ CXX_GUARD_START
|
|||
|
||||
extern const uint32_t DS_ARM946ES_FREQUENCY;
|
||||
extern const uint32_t DS_ARM7TDMI_FREQUENCY;
|
||||
extern const uint8_t DS_CHIP_ID[4];
|
||||
|
||||
enum DSIRQ {
|
||||
DS_IRQ_VBLANK = 0x0,
|
||||
|
|
|
@ -23,6 +23,7 @@ mLOG_DEFINE_CATEGORY(DS, "DS");
|
|||
const uint32_t DS_ARM946ES_FREQUENCY = 0x1FF61FE;
|
||||
const uint32_t DS_ARM7TDMI_FREQUENCY = 0xFFB0FF;
|
||||
const uint32_t DS_COMPONENT_MAGIC = 0x1FF61FE;
|
||||
const uint8_t DS_CHIP_ID[4] = { 0xC2, 0x0F, 0x00, 0x00 };
|
||||
|
||||
static const size_t DS_ROM_MAGIC_OFFSET = 0x15C;
|
||||
static const uint8_t DS_ROM_MAGIC[] = { 0x56, 0xCF };
|
||||
|
@ -278,6 +279,10 @@ void DS7Reset(struct ARMCore* cpu) {
|
|||
|
||||
struct DSCartridge* header = ds->romVf->map(ds->romVf, sizeof(*header), MAP_READ);
|
||||
if (header) {
|
||||
memcpy(&ds->memory.ram[0x3FF800 >> 2], DS_CHIP_ID, 4);
|
||||
memcpy(&ds->memory.ram[0x3FF804 >> 2], DS_CHIP_ID, 4);
|
||||
memcpy(&ds->memory.ram[0x3FFC00 >> 2], DS_CHIP_ID, 4);
|
||||
memcpy(&ds->memory.ram[0x3FFC04 >> 2], DS_CHIP_ID, 4);
|
||||
memcpy(&ds->memory.ram[0x3FFE00 >> 2], header, 0x170);
|
||||
DS7IOWrite32(ds, DS_REG_ROMCNT_LO, header->busTiming | 0x2700000);
|
||||
// TODO: Error check
|
||||
|
|
|
@ -50,6 +50,10 @@ static void DSSlot1StartTransfer(struct DS* ds) {
|
|||
ds->memory.slot1.transferRemaining = ds->memory.slot1.transferSize;
|
||||
DSSlot1StepTransfer(ds);
|
||||
break;
|
||||
case 0xB8:
|
||||
memcpy(ds->memory.slot1.readBuffer, DS_CHIP_ID, 4);
|
||||
ds->memory.slot1.transferRemaining = 0;
|
||||
break;
|
||||
default:
|
||||
mLOG(DS_SLOT1, STUB, "Unimplemented card command: %02X%02X%02X%02X%02X%02X%02X%02X",
|
||||
ds->memory.slot1.command[0], ds->memory.slot1.command[1],
|
||||
|
|
Loading…
Reference in New Issue