Debugger (eg, "eb" or "ew") can now patch ROMs if a physical (%%) address is used

This commit is contained in:
Jeff Parsons 2015-11-07 09:52:54 -08:00
commit ec16cf78be
4 changed files with 19 additions and 4 deletions

View file

@ -13906,7 +13906,7 @@ xffb3: pop ds ; 0000FFB3 1F '.'
db 0x0000 ; 0000FFB8 0000
dw 0x0000 ; 0000FFBA 0000
dw 0x0000 ; 0000FFBC 0000
dw 0x0003 ; 0000FFBE 0300 (replaced during ROM relocation with 0x03nn where nn is the CPU revision identifier)
dw 0x0003 ; 0000FFBE 0300 (replaced during ROM relocation with 0x03nn, where nn is the CPU revision identifier)
times 29 db 0xFF ; 0000FFC0 - 0000FFDC

View file

@ -131,6 +131,7 @@ function Computer(parmsComputer, parmsMachine, fSuspended) {
this.nBusWidth = parmsComputer['busWidth'] || parmsComputer['buswidth'];
this.resume = Computer.RESUME_NONE;
this.sStateData = null;
this.fStateData = false; // remembers if sStateData was loaded
this.fServerState = false;
this.url = parmsMachine? parmsMachine['url'] : null;
@ -331,6 +332,7 @@ Computer.prototype.onLoadSetReady = function(sStateFile, sStateData, nErrorCode)
{
if (!nErrorCode) {
this.sStateData = sStateData;
this.fStateData = true;
if (DEBUG && this.messageEnabled()) {
this.printMessage("loaded state file " + sStateFile.replace(this.sUserID || "xxx", "xxx"));
}
@ -609,7 +611,7 @@ Computer.prototype.powerRestore = function(component, stateComputer, fRepower, f
* TODO: Considering doing this in ALL cases, not just in situations where a
* 'state' exists but we're not actually resuming from it.
*/
if (this.sStatePath && !this.sStateData) {
if (this.sStatePath && !this.fStateData) {
stateComputer.clear();
this.resume = Computer.RESUME_NONE;
web.reloadPage();

View file

@ -2104,6 +2104,8 @@ if (DEBUGGER) {
/**
* setByte(dbgAddr, b, inc)
*
* NOTE: If you need to patch a ROM, you MUST use the ROM location's physical address.
*
* WARNING: Be careful with the editing commands that use function, because we don't have a safe
* counterpart to cpu.probeAddr().
*
@ -2116,7 +2118,11 @@ if (DEBUGGER) {
{
var addr = this.getAddr(dbgAddr, true, 1);
if (addr !== X86.ADDR_INVALID) {
this.cpu.setByte(addr, b);
if (dbgAddr.type != Debugger.ADDRTYPE.PHYSICAL) {
this.cpu.setByte(addr, b);
} else {
this.bus.setByteDirect(addr, b);
}
if (inc) this.incAddr(dbgAddr, inc);
this.cpu.updateCPU(true); // we set fForce to true in case video memory was the target
}
@ -2125,6 +2131,8 @@ if (DEBUGGER) {
/**
* setShort(dbgAddr, w, inc)
*
* NOTE: If you need to patch a ROM, you MUST use the ROM location's physical address.
*
* WARNING: Be careful with the editing commands that use function, because we don't have a safe
* counterpart to cpu.probeAddr().
*
@ -2137,7 +2145,11 @@ if (DEBUGGER) {
{
var addr = this.getAddr(dbgAddr, true, 2);
if (addr !== X86.ADDR_INVALID) {
this.cpu.setShort(addr, w);
if (dbgAddr.type != Debugger.ADDRTYPE.PHYSICAL) {
this.cpu.setShort(addr, w);
} else {
this.bus.setShortDirect(addr, w);
}
if (inc) this.incAddr(dbgAddr, inc);
this.cpu.updateCPU(true); // we set fForce to true in case video memory was the target
}

View file

@ -35,6 +35,7 @@
var fs = require("fs");
var path = require("path");
var mkdirp = require("mkdirp");
var defines = require("../../shared/lib/defines");
var net = require("../../shared/lib/netlib");
var proc = require("../../shared/lib/proclib");
var str = require("../../shared/lib/strlib");