diff --git a/chip-z80/support.js b/chip-z80/support.js index f8859dd..14c9869 100644 --- a/chip-z80/support.js +++ b/chip-z80/support.js @@ -110,22 +110,20 @@ var state = 0; var last_rd_done = 1; function handleBusRead(){ - if(!isNodeHigh(nodenames['_m1']) && !isNodeHigh(nodenames['_iorq'])) { - // Interrupt acknownledge cycle, force 0xFF onto the bus - // In IM0 this is seen as RST 0x38 - // In IM1 this is ignored - // In IM2 this is used as the low byte of the vector - // TODO: ideally this "vector" would be a configurable parameter - writeDataBus(0xff); - } else if(!isNodeHigh(nodenames['_rd'])){ + if(!isNodeHigh(nodenames['_rd']) && !isNodeHigh(nodenames['_mreq'])) { + // Memory read var a = readAddressBus(); var d = eval(readTriggers[a]); if(d == undefined) d = mRead(readAddressBus()); - if(!isNodeHigh(nodenames['_m1']) && !isNodeHigh(nodenames['_mreq'])) { + if(!isNodeHigh(nodenames['_m1'])) { eval(fetchTriggers[d]); } writeDataBus(d); + } else { + // In all other cases we set the data bus to FF + // as a crude indicateion that it's not being driven + writeDataBus(0xff); } // Prefix / displacement / opcode state machine, deals with: