// chip-specific support functions // // may override function definitions made previously chipname='z80'; grChipSize=5000; grCanvasSize=2500; grMaxZoom=24; ngnd = nodenames['vss']; npwr = nodenames['vcc']; nodenamereset = '_reset'; presetLogLists=[ ['cycle',], ['ab','db','_m1','_rd','_wr','_mreq','_iorq','pc'], ['af', 'bc', 'de', 'hl', 'ix', 'iy', 'sp', 'wz', 'ir'], ['af2', 'bc2', 'de2', 'hl2', 'State'], ['_int','_nmi',nodenamereset], ]; // Override drawSeg so we can use a different offset function drawSeg(ctx, seg){ var dx = 150; ctx.beginPath(); ctx.moveTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1])); for(var i=2;i>1; if(busname=='af') return busToHexInv('reg_a') + busToHexInv('reg_f'); if(busname=='bc') return busToHexInv('reg_b') + busToHexInv('reg_c'); if(busname=='de') return busToHexInv('reg_d') + busToHexInv('reg_e'); if(busname=='hl') return busToHexInv('reg_h') + busToHexInv('reg_l'); if(busname=='af2') return busToHexInv('reg_aa') + busToHexInv('reg_ff'); if(busname=='bc2') return busToHexInv('reg_bb') + busToHexInv('reg_cc'); if(busname=='de2') return busToHexInv('reg_dd') + busToHexInv('reg_ee'); if(busname=='hl2') return busToHexInv('reg_hh') + busToHexInv('reg_ll'); if(busname=='ir') return busToHexInv('reg_i') + busToHexInv('reg_r'); if(busname=='wz') return busToHexInv('reg_w') + busToHexInv('reg_z'); if(busname=='pc') return busToHexInv('reg_pch') + busToHexInv('reg_pcl'); if(busname=='sp') return busToHexInv('reg_sph') + busToHexInv('reg_spl'); if(busname=='ix') return busToHexInv('reg_ixh') + busToHexInv('reg_ixl'); if(busname=='iy') return busToHexInv('reg_iyh') + busToHexInv('reg_iyl'); if(busname=='State') return listActiveTCStates(); // DMB: TODO // if(busname=='Execute') // return disassemblytoHTML(readBits('ir',8)); // if(busname=='Fetch') // return !isNodeHigh(nodenames['_m1'])?disassemblytoHTML(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 # // return listActiveSignals('^([x]?x-)?op-'); // if(busname=='DPControl') // return listActiveSignals('^dpc[0-9]+_'); if(busname[0]=="-"){ // invert the value of the bus for display var value=busToHex(busname.slice(1)) if(typeof value != "undefined") return value.replace(/./g,function(x){return (15-parseInt(x,16)).toString(16)}); else return undefined;; } else { return busToHex(busname); } } function chipStatus(){ var ab = readAddressBus(); var machine1 = ' halfcyc:' + cycle + ' clk:' + readBit('clk') + ' AB:' + hexWord(ab) + ' D:' + hexByte(readDataBus()) + ' M1:' + readBit('_m1') + ' RD:' + readBit('_rd') + ' WR:' + readBit('_wr') + ' MREQ:' + readBit('_mreq') + ' IORQ:' + readBit('_iorq'); var machine2 = ' PC:' + hexWord(readPC()) + ' A:' + hexByte(readA()) + ' F:' + hexByte(readF()) + ' B:' + hexByte(readB()) + ' C:' + hexByte(readC()) + ' D:' + hexByte(readD()) + ' E:' + hexByte(readE()) + ' H:' + hexByte(readH()) + ' L:' + hexByte(readL()) + ' I:' + hexByte(readI()) + ' R:' + hexByte(readR()) + ' W:' + hexByte(readW()) + ' Z:' + hexByte(readZ()) + ' IX:' + hexWord(readIX()) + ' IY:' + hexWord(readIY()) + ' SP:' + hexWord(readSP()); var machine3 = 'State: ' + busToString('State') + 'Hz: ' + estimatedHz().toFixed(1); if(typeof expertMode != "undefined") { machine3 += ' Exec: ' + busToString('Execute'); // no T-state info for 6800 yet if(!isNodeHigh(nodenames['_m1'])) machine3 += ' (Fetch: ' + busToString('Fetch') + ')'; if(goldenChecksum != undefined) machine3 += " Chk:" + traceChecksum + ((traceChecksum==goldenChecksum)?" OK":" no match"); } setStatus(machine1, machine2, machine3); if (logThese.length>1) { updateLogbox(logThese); } selectCell(ab); } // DMB: TODO var disassembly={ 0x00: "nop", };