diff --git a/macros.js b/macros.js index 8639682..110ec62 100644 --- a/macros.js +++ b/macros.js @@ -328,9 +328,9 @@ function busToString(busname){ if(busname=='State') return listActiveTCStates(); if(busname=='Execute') - return dis6502[readBits('ir',8)].replace(/ /,' '); + return dis6502toHTML(readBits('ir',8)); if(busname=='Fetch') - return isNodeHigh(nodenames['sync'])?dis6502[readDataBus()].replace(/ /,' '):''; + return isNodeHigh(nodenames['sync'])?dis6502toHTML(readDataBus()):""; if(busname=='plaOutputs') // PLA outputs are mostly ^op- but some have a prefix too // - we'll allow the x and xx prefix but ignore the # @@ -622,6 +622,14 @@ function adler32(x){ return (0x100000000+(b<<16)+a).toString(16).slice(-8); } +// sanitised opcode for HTML output +function dis6502toHTML(byte){ + var opcode=dis6502[byte]; + if(typeof opcode == "undefined") + return "unknown" + return opcode.replace(/ /,' '); +} + // opcode lookup for 6502 - not quite a disassembly // javascript derived from Debugger.java by Achim Breidenbach var dis6502={