diff --git a/expert-allinone.js b/expert-allinone.js index 5449bbd..9ef08d0 100644 --- a/expert-allinone.js +++ b/expert-allinone.js @@ -14023,6 +14023,66 @@ function listActiveTCStates() { return s.join("+"); } + // Show all time code node states (active and inactive) in fixed format, + // with T1/T6 indication in square brackets. ".." for a node indicates + // inactive state, "T"* for a node indicates active state. + // For discussion of this reconstruction, see: + // http://visual6502.org/wiki/index.php?title=6502_Timing_States +function allTCStates( useHTML ) +{ + var s = ""; + var _spc; + useHTML = (typeof useHTML === 'undefined') ? false : useHTML; + // Use Non-Breaking Space for presentation in an HTML (browser) + // context, else use ASCII space for logging context + _spc = useHTML ? ' ' : ' '; + var allHigh, thisHigh; + thisHigh = isNodeHigh( nodenames[ 'clock1' ] ); + allHigh = thisHigh; + if ( !thisHigh ) s += "T0"; else s += ".."; + s += _spc; + // T+ in visual6502 is called T1x in + // http://www.weihenstephan.org/~michaste/pagetable/6502/6502.jpg + // Notated as T+ for compatibility with PLA node names + thisHigh = isNodeHigh( nodenames[ 'clock2' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T+"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't2' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T2"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't3' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T3"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't4' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T4"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't5' ] ) + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T5"; else s += ".."; + s += _spc + "["; + // If all of the time code bits are high (inactive)... + if ( allHigh ) { + // ...distinguish T1 from T6 + // If bits T2 through T5 are actively being cleared... + if ( isNodeHigh( 1357 ) ) { + // ...then this is T1 + s += "T1"; + } else { + // ...else T2 through T5 are clear because the bits ran off the end + // of the T2 through T5 complex: this is T6 + s += "T6"; + } + } else { + s += ".."; + } + s += "]"; + return s; +} + function readBit(name){ return isNodeHigh(nodenames[name])?1:0; } @@ -14049,6 +14109,13 @@ function busToString(busname){ return ['clock1','clock2','t2','t3','t4','t5'].map(busToHex).join(""); if(busname=='State') return listActiveTCStates(); + if(busname=='TState') + return allTCStates( true ); + if(busname=='Phi') + // Pretty-printed phase indication based on the state of cp1, + // the internal Phase 1 node + return 'Φ' + + (isNodeHigh( nodenames[ 'cp1' ] ) ? '1' : '2'); if(busname=='Execute') return dis6502toHTML(readBits('ir',8)); if(busname=='Fetch') diff --git a/macros.js b/macros.js index e71b8cb..3aa26de 100644 --- a/macros.js +++ b/macros.js @@ -304,6 +304,66 @@ function listActiveTCStates() { return s.join("+"); } + // Show all time code node states (active and inactive) in fixed format, + // with T1/T6 indication in square brackets. ".." for a node indicates + // inactive state, "T"* for a node indicates active state. + // For discussion of this reconstruction, see: + // http://visual6502.org/wiki/index.php?title=6502_Timing_States +function allTCStates( useHTML ) +{ + var s = ""; + var _spc; + useHTML = (typeof useHTML === 'undefined') ? false : useHTML; + // Use Non-Breaking Space for presentation in an HTML (browser) + // context, else use ASCII space for logging context + _spc = useHTML ? ' ' : ' '; + var allHigh, thisHigh; + thisHigh = isNodeHigh( nodenames[ 'clock1' ] ); + allHigh = thisHigh; + if ( !thisHigh ) s += "T0"; else s += ".."; + s += _spc; + // T+ in visual6502 is called T1x in + // http://www.weihenstephan.org/~michaste/pagetable/6502/6502.jpg + // Notated as T+ for compatibility with PLA node names + thisHigh = isNodeHigh( nodenames[ 'clock2' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T+"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't2' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T2"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't3' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T3"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't4' ] ); + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T4"; else s += ".."; + s += _spc; + thisHigh = isNodeHigh( nodenames[ 't5' ] ) + allHigh = allHigh && thisHigh; + if ( !thisHigh ) s += "T5"; else s += ".."; + s += _spc + "["; + // If all of the time code bits are high (inactive)... + if ( allHigh ) { + // ...distinguish T1 from T6 + // If bits T2 through T5 are actively being cleared... + if ( isNodeHigh( 1357 ) ) { + // ...then this is T1 + s += "T1"; + } else { + // ...else T2 through T5 are clear because the bits ran off the end + // of the T2 through T5 complex: this is T6 + s += "T6"; + } + } else { + s += ".."; + } + s += "]"; + return s; +} + function readBit(name){ return isNodeHigh(nodenames[name])?1:0; } @@ -330,6 +390,13 @@ function busToString(busname){ return ['clock1','clock2','t2','t3','t4','t5'].map(busToHex).join(""); if(busname=='State') return listActiveTCStates(); + if(busname=='TState') + return allTCStates( true ); + if(busname=='Phi') + // Pretty-printed phase indication based on the state of cp1, + // the internal Phase 1 node + return 'Φ' + + (isNodeHigh( nodenames[ 'cp1' ] ) ? '1' : '2'); if(busname=='Execute') return disassemblytoHTML(readBits('ir',8)); if(busname=='Fetch')