2015-11-21 07:36:48 +00:00
|
|
|
auto HG51B::reg_read(uint8 addr) const -> uint24 {
|
Update to v087r08 release.
byuu says:
Added some more ARM opcodes, hooked up MMIO. Bind it with mmio[(addr
000-3ff)] = this; inside CPU/PPU/APU, goes to read(), write().
Also moved the Hitachi HG51B core to processor/, and split it apart from
the snes/chip/hitachidsp implementation.
This one actually worked really well. Very clean split between MMIO/DMA
and the processor core. I may move a more generic DMA function inside
the core, not sure yet.
I still believe the HG51B169 to be a variant of the HG51BS family, but
given they're meant to be incredibly flexible microcontrollers, it's
possible that each variant gets its own instruction set.
So, who knows. We'll worry about it if we ever find another HG51B DSP,
I guess.
GBA BIOS is constantly reading from 04000300, but it never writes. If
I return prng()&1, I can get it to proceed until it hits a bad opcode
(stc opcode, which the GBA lacks a coprocessor so ... bad codepath.)
Without it, it just reads that register forever and keeps resetting the
system, or something ...
I guess we're going to have to try and get ARMwrestler working, because
the BIOS seems to need too much emulation code to do anything at all.
2012-03-24 07:52:36 +00:00
|
|
|
switch(addr) {
|
Update to v079r04 release.
byuu says:
Back from vacation. We were successful in emulating the Cx4 using LLE
during my vacation. We finished on June 15th. And now that I'm back,
I've rewritten the code and merged it into bsnes official. With that,
the very last HLE emulation code in bsnes has now been purged.
[...]
The emulation is as minimal as possible. If I don't see an opcode or
feature actually used, I don't implement it. The one exception being
that I do support the vector override functionality. And there are also
dummy handlers for ld ?,$2e + loop, so that the chip won't stall out.
But things like "byte 4" on rdram/wrram, the two-bit destination
selections for all but ld, etc are treated as invalid opcodes, since we
aren't 100% sure if they are there and work as we hypothesize. I also
only map in known registers into the 256-entry register list. This
leaves 90% of the map empty.
The chip runs at 20MHz, and it will disable the ROM while running. DMA
does transfer one byte at a time against the clock and also locks out
the ROM. rdbus won't fetch from IRAM, only from ROM. DMA transfer only
reads from ROM, and only writes to RAM. Unless someone verifies that
they can do more, I'll leave it that way. I don't yet actually buffer
the program ROM into the internal program RAM just yet, but that is on
the to-do list. We aren't entirely sure how that works either, but my
plan is to just lock the Cx4 CPU and load in 512-bytes.
There's still a few unknown registers in $7f40-5f that I don't do
anything with yet. The secondary chip disable is going to be the
weirdest one, since MMX3 only has one chip. I'd really rather not have
to specify the ROM mapping as two separate chips on MMX2 and as one on
MMX3 just to support this, so I don't know yet.
Save state support is of course there already.
Speed hit is 118fps HLE -> 109fps LLE in most scenes. Not bad, honestly.
2011-06-22 13:27:55 +00:00
|
|
|
case 0x00: return regs.a;
|
|
|
|
case 0x01: return regs.acch;
|
|
|
|
case 0x02: return regs.accl;
|
|
|
|
case 0x03: return regs.busdata;
|
|
|
|
case 0x08: return regs.romdata;
|
|
|
|
case 0x0c: return regs.ramdata;
|
|
|
|
case 0x13: return regs.busaddr;
|
|
|
|
case 0x1c: return regs.ramaddr;
|
|
|
|
case 0x50: return 0x000000;
|
|
|
|
case 0x51: return 0xffffff;
|
|
|
|
case 0x52: return 0x00ff00;
|
|
|
|
case 0x53: return 0xff0000;
|
|
|
|
case 0x54: return 0x00ffff;
|
|
|
|
case 0x55: return 0xffff00;
|
|
|
|
case 0x56: return 0x800000;
|
|
|
|
case 0x57: return 0x7fffff;
|
|
|
|
case 0x58: return 0x008000;
|
|
|
|
case 0x59: return 0x007fff;
|
|
|
|
case 0x5a: return 0xff7fff;
|
|
|
|
case 0x5b: return 0xffff7f;
|
|
|
|
case 0x5c: return 0x010000;
|
|
|
|
case 0x5d: return 0xfeffff;
|
|
|
|
case 0x5e: return 0x000100;
|
|
|
|
case 0x5f: return 0x00feff;
|
|
|
|
case 0x60: return regs.gpr[ 0];
|
|
|
|
case 0x61: return regs.gpr[ 1];
|
|
|
|
case 0x62: return regs.gpr[ 2];
|
|
|
|
case 0x63: return regs.gpr[ 3];
|
|
|
|
case 0x64: return regs.gpr[ 4];
|
|
|
|
case 0x65: return regs.gpr[ 5];
|
|
|
|
case 0x66: return regs.gpr[ 6];
|
|
|
|
case 0x67: return regs.gpr[ 7];
|
|
|
|
case 0x68: return regs.gpr[ 8];
|
|
|
|
case 0x69: return regs.gpr[ 9];
|
|
|
|
case 0x6a: return regs.gpr[10];
|
|
|
|
case 0x6b: return regs.gpr[11];
|
|
|
|
case 0x6c: return regs.gpr[12];
|
|
|
|
case 0x6d: return regs.gpr[13];
|
|
|
|
case 0x6e: return regs.gpr[14];
|
|
|
|
case 0x6f: return regs.gpr[15];
|
|
|
|
}
|
|
|
|
return 0x000000;
|
|
|
|
}
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
auto HG51B::reg_write(uint8 addr, uint24 data) -> void {
|
Update to v087r08 release.
byuu says:
Added some more ARM opcodes, hooked up MMIO. Bind it with mmio[(addr
000-3ff)] = this; inside CPU/PPU/APU, goes to read(), write().
Also moved the Hitachi HG51B core to processor/, and split it apart from
the snes/chip/hitachidsp implementation.
This one actually worked really well. Very clean split between MMIO/DMA
and the processor core. I may move a more generic DMA function inside
the core, not sure yet.
I still believe the HG51B169 to be a variant of the HG51BS family, but
given they're meant to be incredibly flexible microcontrollers, it's
possible that each variant gets its own instruction set.
So, who knows. We'll worry about it if we ever find another HG51B DSP,
I guess.
GBA BIOS is constantly reading from 04000300, but it never writes. If
I return prng()&1, I can get it to proceed until it hits a bad opcode
(stc opcode, which the GBA lacks a coprocessor so ... bad codepath.)
Without it, it just reads that register forever and keeps resetting the
system, or something ...
I guess we're going to have to try and get ARMwrestler working, because
the BIOS seems to need too much emulation code to do anything at all.
2012-03-24 07:52:36 +00:00
|
|
|
switch(addr) {
|
Update to v079r04 release.
byuu says:
Back from vacation. We were successful in emulating the Cx4 using LLE
during my vacation. We finished on June 15th. And now that I'm back,
I've rewritten the code and merged it into bsnes official. With that,
the very last HLE emulation code in bsnes has now been purged.
[...]
The emulation is as minimal as possible. If I don't see an opcode or
feature actually used, I don't implement it. The one exception being
that I do support the vector override functionality. And there are also
dummy handlers for ld ?,$2e + loop, so that the chip won't stall out.
But things like "byte 4" on rdram/wrram, the two-bit destination
selections for all but ld, etc are treated as invalid opcodes, since we
aren't 100% sure if they are there and work as we hypothesize. I also
only map in known registers into the 256-entry register list. This
leaves 90% of the map empty.
The chip runs at 20MHz, and it will disable the ROM while running. DMA
does transfer one byte at a time against the clock and also locks out
the ROM. rdbus won't fetch from IRAM, only from ROM. DMA transfer only
reads from ROM, and only writes to RAM. Unless someone verifies that
they can do more, I'll leave it that way. I don't yet actually buffer
the program ROM into the internal program RAM just yet, but that is on
the to-do list. We aren't entirely sure how that works either, but my
plan is to just lock the Cx4 CPU and load in 512-bytes.
There's still a few unknown registers in $7f40-5f that I don't do
anything with yet. The secondary chip disable is going to be the
weirdest one, since MMX3 only has one chip. I'd really rather not have
to specify the ROM mapping as two separate chips on MMX2 and as one on
MMX3 just to support this, so I don't know yet.
Save state support is of course there already.
Speed hit is 118fps HLE -> 109fps LLE in most scenes. Not bad, honestly.
2011-06-22 13:27:55 +00:00
|
|
|
case 0x00: regs.a = data; return;
|
|
|
|
case 0x01: regs.acch = data; return;
|
|
|
|
case 0x02: regs.accl = data; return;
|
|
|
|
case 0x03: regs.busdata = data; return;
|
|
|
|
case 0x08: regs.romdata = data; return;
|
|
|
|
case 0x0c: regs.ramdata = data; return;
|
|
|
|
case 0x13: regs.busaddr = data; return;
|
|
|
|
case 0x1c: regs.ramaddr = data; return;
|
|
|
|
case 0x60: regs.gpr[ 0] = data; return;
|
|
|
|
case 0x61: regs.gpr[ 1] = data; return;
|
|
|
|
case 0x62: regs.gpr[ 2] = data; return;
|
|
|
|
case 0x63: regs.gpr[ 3] = data; return;
|
|
|
|
case 0x64: regs.gpr[ 4] = data; return;
|
|
|
|
case 0x65: regs.gpr[ 5] = data; return;
|
|
|
|
case 0x66: regs.gpr[ 6] = data; return;
|
|
|
|
case 0x67: regs.gpr[ 7] = data; return;
|
|
|
|
case 0x68: regs.gpr[ 8] = data; return;
|
|
|
|
case 0x69: regs.gpr[ 9] = data; return;
|
|
|
|
case 0x6a: regs.gpr[10] = data; return;
|
|
|
|
case 0x6b: regs.gpr[11] = data; return;
|
|
|
|
case 0x6c: regs.gpr[12] = data; return;
|
|
|
|
case 0x6d: regs.gpr[13] = data; return;
|
|
|
|
case 0x6e: regs.gpr[14] = data; return;
|
|
|
|
case 0x6f: regs.gpr[15] = data; return;
|
|
|
|
}
|
|
|
|
}
|