Compare commits

...

157 Commits
V0.6 ... master

Author SHA1 Message Date
BigEd d8ecc129b3
fixup link to visual6502 wiki 2022-03-06 15:59:24 +00:00
BigEd d14ade8be8
fixup link to visual6502 wiki 2022-03-06 15:59:20 +00:00
BigEd bc5da26ea2
fixup easy6502 link 2022-03-06 15:56:20 +00:00
BigEd 15911b02b4
fixup easy6502 link 2022-03-06 15:54:31 +00:00
BigEd badcf8e40b
Merge pull request #60 from gdevic/dev
Added zoom using the mouse wheel
2020-03-31 13:08:33 +01:00
Goran Devic 8097137323 Added zoom using the mouse wheel 2020-03-12 15:09:55 -05:00
BigEd 5b86a57c2c
fixup sticky mouse
closes #57 thanks
2019-03-07 12:00:52 +00:00
BigEd 0d4cb75658
Merge pull request #58 from hoglet67/Z80
Z80: Visualization improvements: panelization, holes, diagonals
2019-03-07 11:48:34 +00:00
David Banks cb7815e1ad Z80: Visualization improvements concerning: panelization, holes, diagnonals
(3 commits squashed together to reduce the size, as they each affect seggefs.js)

- updated segdefs.js to fix some panelization artefacts

- override drawSeg() to deal with holes in shapes; updated segdefs.js

- updated segdefs.js with adjacent diagonals just touching
2019-03-04 08:50:39 +00:00
BigEd 7ee143a906
Merge pull request #56 from lagomorph/typo
typo in README
2019-01-03 14:14:58 +00:00
John Scarfone 52540e3c12 typo 2018-12-28 14:51:27 -05:00
BigEd f33937cc92
Merge pull request #55 from hoglet67/Z80
Further work on Z80
2018-10-26 18:12:30 +01:00
David Banks deb6833f8a Z80: updated segdefs.js based on new boundary tracing algorithm 2018-10-26 16:40:14 +01:00
David Banks 296cd01f84 All: fix zoomToBox to scale selection to fill 80% of the window 2018-10-14 13:34:52 +01:00
David Banks 8e799d6922 All: fix zoomToBox to make use of grChipOffsetX/Y (tested on all chips) 2018-10-14 13:07:25 +01:00
David Banks a4ed7a9178 Z80: updated transdefs to have accurate bounding box for transistors 2018-10-14 12:28:25 +01:00
David Banks 9795b463ac Z80: Updated nodenames.js to include warning about manual editing 2018-10-12 13:51:06 +01:00
David Banks b384fb552f Z80: Update netlist to fix the IM2 vector issue (missing pass transistor) 2018-10-12 13:08:57 +01:00
David Banks bf63c33552 All: subtract grChipOffsetX/Y from coordiates given to user so the match the PNGs 2018-10-12 13:08:29 +01:00
David Banks 9760663cc1 Z80: avoid the need to invert the register values in Javascript 2018-10-12 12:40:59 +01:00
David Banks 3ae93282ba Z80: switch to machine generates nodenames.js (please don't edit\!) 2018-10-12 12:30:03 +01:00
David Banks ab53a12b2e Z80: added pla signals to nodenames.js 2018-10-11 12:52:57 +01:00
David Banks a92f443ac1 Z80: fix stepBack(), drive IntAck value of 0xe9, add lots more internal busses (with Ed) 2018-10-09 22:01:28 +01:00
David Banks 86e6e116d7 All: Fix a hard-coded nodes array length in stateString() 2018-10-09 21:59:27 +01:00
David Banks f360557572 Z80: override chipsim getNodeValue() to better model charge sharing 2018-10-08 10:33:44 +01:00
David Banks 5005774b1b Z80: updated handleBusRead() to leave the databus at 0xFF between reads 2018-10-08 10:27:36 +01:00
David Banks 924074e305 Z80: Updated netlist using data that include burried contact at 488,2761 (Ken, 2014) 2018-10-07 13:30:52 +01:00
Ed Spittles b0c40b9e7b add URL control of some Z80 inputs 2018-10-06 13:58:37 +01:00
BigEd 74762264c1
Merge pull request #54 from hoglet67/Z80
Visual Z80: work towards interrupt support
2018-09-30 16:44:22 +01:00
David Banks 6fcb3077eb Z80: In INTACK cycle, force 0xFF onto the databus 2018-09-30 15:14:40 +01:00
David Banks cbebb0e11d Z80: Added additional nodenames for int/nmi 2018-09-30 15:14:40 +01:00
BigEd 2612132999
Merge pull request #53 from TReed0803/master
[6502] Adding expert wire toggles for SO pin
2018-09-30 14:43:33 +01:00
Trent Reed 8327a36826 Adding expert wire toggles for SO pin 2018-09-29 19:58:25 -07:00
BigEd 886efe1d5a
Merge pull request #52 from hoglet67/Z80
Work so far on Visual Z80
2018-09-29 18:49:09 +01:00
David Banks d9c92ebdc3 Z80: corrected typo in flag name 2018-09-22 16:29:19 +01:00
David Banks 651a1753b7 Z80: update test program 2018-09-22 15:27:27 +01:00
David Banks f5cada53f7 Z80: Updated transdefs.js with a version that replaces trap transistor with a hard short it's drain to ground (just connecting trap gate to VCC was not sufficient) 2018-09-22 14:34:53 +01:00
David Banks 7d579fa4aa Z80: whitespace only 2018-09-22 11:02:18 +01:00
David Banks e33f40e60c Z80: Corrected fetch state machine to cover all cases correctly 2018-09-22 10:58:48 +01:00
David Banks 379d2d1ea1 Z80: Seperate A/F and format flags individually 2018-09-22 09:45:51 +01:00
David Banks 59792d75fc All: added variables for grChipOffsetX/gfChipOffsetY (previously hardcoded to 400/0) 2018-09-22 09:30:47 +01:00
David Banks 225b49a6d8 Z80: Correct bounding box for transistor in transdefs.js 2018-09-21 22:00:51 +01:00
David Banks 3de51801ea Z80: Updated test program to include call 2018-09-21 18:04:18 +01:00
David Banks 2f882d7d34 Z80: Start with clock high 2018-09-21 18:03:50 +01:00
David Banks b9e235fac2 Z80: display remapped registers (so INC D always increments D) 2018-09-21 17:48:51 +01:00
David Banks 0e4c3e0ab0 Z80: Added disassembly 2018-09-21 16:51:58 +01:00
David Banks 767e2492be Z80: Set grCanvasSize to 5000, so mistakes are clearer 2018-09-21 10:32:20 +01:00
David Banks 95f9d52306 Z80: Adjusted chip/canvas size and max zoom 2018-09-21 10:32:20 +01:00
David Banks 646f22b79e Z80: segdefs.js now contains polygon information 2018-09-21 10:32:20 +01:00
David Banks 2ff43fafb3 Z80: Expose alterate register state and register set selection flipflops 2018-09-19 18:52:43 +01:00
David Banks 8a9fe6f57e Extended test program to test simple memory writes 2018-09-19 15:07:27 +01:00
David Banks 3315f309a7 Added EXX to test program, as we seem to start off with alternative BC/DE/HL active 2018-09-19 14:45:41 +01:00
David Banks 85058171b2 Z80: Added ir and wr registers 2018-09-19 13:50:31 +01:00
David Banks 7a0cb72539 Initial checking of chip-z80 2018-09-19 13:27:39 +01:00
Ed Spittles 0a6866f10c Add two signals to DPControl fixing #50 2018-05-29 10:51:02 +01:00
BigEd 5b15e2d6c9
Merge pull request #48 from mmfoerster/master
Corrected and expanded the time state readout (the "TState" pseudobus).
2018-05-06 11:24:14 +01:00
BigEd e6e446a256
Merge pull request #49 from trebonian/BigEd-patch-1
Updating links, e-tradition is now masswerk
2018-05-06 10:20:26 +01:00
BigEd bd0356f2a0
Update index.html 2018-05-06 10:20:00 +01:00
BigEd 096f6bbcf8
Updating links, e-tradition is now masswerk 2018-05-06 10:18:22 +01:00
mmfoerster 698312b98e Corrected and expanded the time state readout (the "TState" pseudobus).
The occurrences of T6 and T1 have been corrected. T6 now only occurs when a BRK
instruction is executing, it is a synonym for when the VEC1 node is logic high.
T1 now occurs when node 862 is logic high, which drives the SYNC pin, among
other control effects.

Formerly, T1 and T6 were displayed only when all the nodes that affect the PLA
were inactive. Node 1357's state was used in that case to choose between
displaying T1 (1357 high) or T6 (1357 low). That turned out to be incorrect
pair of inferences. The result was that T1 was absent when it should have been
present (when T+ was present without T0), and T6 was present when it should
have been absent (for instructions other than BRK). Among the corrective
changes, node 1357 is no longer consulted.

Expansion of state display adds V0, SD1, and SD2 indications. The last two are
in their own field (an eighth field). V0 is in the seventh field (square
bracketed, the same field occupied by T1 and T6). It is a two-character
representation of node VEC0 being at logic high. VEC0 high causes VEC1 to be
high one cycle later, which is T6. V0 is, like T6, activated only by execution
of a BRK instruction.

SD1 and SD2 are nodes 440 and 1258 respectively, which lie in the RCL block
outside of the timing generation (clock) block. They serve the needs of the
RMW (Read-Modify-Write) instructions for their addressing modes that use
external memory instead of the accumulator.

All of the corrected and new features has increased the total number of
displayed states to 24 from 10. Hopefully, this is the ultimate, final,
most fully comprehensive clock display possible, but we'll see.
2017-12-15 13:47:24 -05:00
BigEd bd45334147
Merge pull request #47 from mmfoerster/master
Added 6502 time code display as "TState" pseudo-bus - see wiki
2017-10-30 18:35:22 +00:00
mmfoerster 7efe4fb8c7 Added comments to allTCStates() referring to the 6502_Timing_States wiki page.
The state labeling is not completely correct or complete regarding T5 and T6
(especially the latter). More investment will be forthcoming.
2017-10-30 14:08:57 -04:00
mmfoerster ef0a714a29 busToString() and allTCStates() changes agreed to online: TState and Phi.
The parameter to allTCStates() has had a name change from useNBSP to useHTML.

busToString() has had the TStateF pseudobus removed, and a pseudobus called
Phi added.

Phi pretty-prints the state of the cp1 node (the internal phase 1 node) as
Φ1 when high and as Φ2 when low. This is nicer than plain 0 or 1.

Logging the TState pseudobus followed by the Phi pseudobus creates the effect
intended by the removed TStateF pseudobus, keeping our collection of
operations orthogonal (no proliferation of trivially different operations
that duplicate each other diagonally).
2017-10-30 00:49:17 -04:00
BigEd e0547e6c35
merge clock phase display into TState pseudobus 2017-10-28 13:49:46 +01:00
mmfoerster 76edc1186a Deleted 6502timecodes.txt: content moved to the visual6502 wiki.
Documentation is more appropriately stored there instead of the repository.
It is also further developed there:
http://visual6502.org/wiki/index.php?title=6502_Timing_States
2017-10-25 11:39:23 -04:00
mmfoerster c1409b78cb busToString( 'TState' ) and busToString( 'TStateF' ) now call allTCStates().
'TState' returns the string returned by allTCStates().

'TStateF' returns the string returned by allTCStates() with phase indication
appended: "F1" or "F2" for phase1 or phase2 respectively. 'F' is chosen since
that's all that Phi really is: an "eff".

Perhaps another enhancement could call out an actual phi glyph for the HTML
(browser) context.

allTCStates() is also enhanced by an optional boolean parameter to control the
spacing of non-blank text within the string it returns.
    * A true parameter puts HTML non-breaking spaces between non-blank text,
      suitable for display on a browser page.
      This is always used by busToString().
    * A false or absent parameter puts ASCII spaces between non-blank text,
      suitable for text logging.
2017-10-09 17:49:53 -04:00
mmfoerster d39bab7302 Clarified causation statement about T0 T+ time code in 6502 time codes documentation 2017-09-19 23:56:43 -04:00
mmfoerster 587fa47d8a Tamed a long line in the new 6502 time codes documentation 2017-09-19 21:50:42 -04:00
mmfoerster 27d0eb8fb2 Created plain-text documentation for the 6502 clock time codes. Added function
that creates the text expression of the time codes seen in the documentation
to macros.js and expert-allinone.js.

Added documentation file: 6502timecodes.txt
Added function: allTCStates()
2017-09-19 21:22:34 -04:00
BigEd 90f57631c0 Merge pull request #46 from mmfoerster/master
Added missing '#' and '~' to both copies of the BRtaken node name.
2017-05-08 18:25:56 +01:00
mmfoerster cba0c7a6b5 Added ~BRtaken definition to the expert version to parallel nodenames.js. 2017-05-08 10:33:40 -04:00
mmfoerster c2348c5f63 Added missing '#' and '~' to both copies of the BRtaken node name.
The comments with them indicate that the semantics of the node (high when branch
not taken) was already recognized.

pipeBRtaken in the expert version is left untouched, as it is opposite-valued
from #BRtaken, although its meaning is multiplexed by additional influences
(nodenames.js has it named pipeIPCrelated).
2017-05-06 16:39:58 -04:00
BigEd 4bb43bfd0e Merge pull request #45 from mmfoerster/master
Corrected node numbers for p6 (V bit) and p7 (N bit) of the status re…
2017-04-27 18:14:40 +01:00
mmfoerster 8d50388828 Corrected node numbers for p6 (V bit) and p7 (N bit) of the status register.
p6 and p7 were duplicates of their respective Pout-named nodes instead of
the phase 1 updated nodes of their storage complexes, as all the other
processor status register bits are (except for the B bit, of course).

    Comment typo correction for cclk.
2017-04-13 04:34:02 -04:00
Ed S 1f78e25b3a Tweak README - add 6800 sim 2017-03-13 16:16:06 +00:00
Ed S 4364604b96 Whitespace fixups 2017-03-13 16:13:03 +00:00
BigEd 2147762ee4 Merge pull request #38 from BigEd/patch-1
Fix typo in comment
2017-03-11 22:45:51 +00:00
BigEd 651d8a44c5 Merge pull request #39 from mmfoerster/master
Patch allNodes() to generate list of numbers for the node indexes instead of numeric strings, fix JMP indirect mnemonic
2017-03-11 22:43:36 +00:00
mmfoerster 51d6bb216b Patch allNodes() to generate list of numbers for node indexes instead of numeric strings, fix JMP indirect mnemonic
Patches for the general chipsim code and the 6502 emulation.

    For the general chipsim code, allNodes() was constructing a list of
numeric strings for the node indexes instead of a list of numbers for them.
During the first iteration inside recalcNodeList(), the numeric string node
indexes would end up being the first elements of their respective node group
lists. This in turn would allow instances of a duplicate node index to be added
to the node group list. The duplicate in each case would be the numeric
equivalent of the initial numeric string index: indexOf() would not recognize
the string element as being the equivalent of the numeric node index, so the
numeric version would be added also.

For an example (from real log data), a node group list of: [ "49", 483 ] has a
node index of 49 tested against it. indexOf() says "49" is not an occurrence
of 49, so it allows 49 to be
2017-03-10 23:09:20 -05:00
BigEd 3b7fbe4385 Fix typo in comment 2016-11-08 16:37:20 +00:00
trebonian f3cffeeed6 Merge pull request #36 from BigEd/patch-2
Add I/O to 6800
2015-04-26 13:48:07 -04:00
BigEd a2a4bc65c5 Add I/O to 6800 2015-04-26 18:30:53 +01:00
trebonian 815e972d14 Merge pull request #30 from PeterMortensen/master
Spelling/case.
2015-04-26 11:29:56 -04:00
trebonian 9f4f922e16 Merge pull request #34 from shersom/master
Add labels to layout controls
2015-04-26 11:29:21 -04:00
trebonian 27bec1bfe5 Merge pull request #35 from BigEd/patch-1
Fixup link to 6800 programming card
2015-04-25 20:59:53 -04:00
BigEd 976fe7e430 Fixup link to 6800 programming card 2015-04-25 14:17:15 +01:00
shersom 72ac2caf74 Add labels to layout controls 2014-05-05 23:54:54 -07:00
trebonian 741e035eb4 Merge branch 'patch-1' of http://github.com/BigEd/visual6502 into ed 2013-06-26 17:23:14 -04:00
BigEd dd2241d3de bugfix - macros.js - pre-apply clock triggers for corrected display 2013-06-25 22:31:53 +02:00
BigEd c0809ba34e typo fixup in README 2013-06-24 18:53:07 +02:00
Peter Mortensen df33b88c56 Update README 2013-06-18 16:06:06 +03:00
trebonian 7d90b33187 Merge pull request #28 from BigEd/patch-1
Correcting a comment in nodenames.js
2013-02-04 06:02:05 -08:00
BigEd 34244661cb Correcting a comment in nodenames.js
Thanks to 'cerebrum' on forum.6502.org
2013-02-03 10:19:22 +00:00
BigEd ce74c3f5d3 Swap easy6502 tutorial in for 6502asm emulator/assembler 2012-08-16 07:52:17 +01:00
BigEd cb03b9741a html fixups by Quietust 2011-08-27 03:34:25 +02:00
BigEd 7b95b5e345 html tidyup by Quietust 2011-08-27 03:29:23 +02:00
BigEd de265ecdb8 6502: add nodename aliases to allow more use of the URL interface 2011-05-12 08:54:52 +00:00
BigEd e81c9fbe0f update 6800 tracing to include alu and incrementer 2011-04-16 13:03:43 +00:00
BigEd c300e6ad01 update 6800 nodenames: ordering, comments, minor corrections 2011-04-16 13:02:46 +00:00
BigEd 79d0c4c445 import remainder of Segher's 6800 nodename updates and begin process of ordering and commenting 2011-04-16 11:29:53 +00:00
BigEd a2d35d54ca 6800 nodename changes from Segher 2011-04-16 10:58:16 +00:00
BigEd e20eb08b91 updated 6800 transistor bounding boxes and geometries from Ijor 2011-04-12 18:08:51 +00:00
BigEd 8487a7a9e1 6800: tweak nodenames and add the Tf state name/node 2011-04-11 18:22:26 +00:00
BigEd 6c138a4f6b add 6800 timing state to tabulation 2011-04-11 14:07:51 +00:00
BigEd 658d40646c add 6800 timing state signals 2011-04-11 13:51:37 +00:00
BigEd 67e15e68c1 fixup comment in transdefs about geometry 2011-04-09 10:33:18 +00:00
BigEd a316831100 update comments at head of transdefs 2011-04-09 10:12:53 +00:00
ijor acd7b0310e Edited chip-6800/transdefs.js via GitHub 2011-04-09 17:57:45 +08:00
BigEd 9331be20fe allow tabulations with loglevel 0 (with only additional signals) 2011-04-06 18:13:04 +00:00
BigEd e6d42eb1aa 6800 declutter - remove clock phases from tabulated signals 2011-04-05 19:45:33 +00:00
BigEd 8ae5c087f6 fixup missing assignments causing errors 2011-04-05 18:29:49 +00:00
BigEd c6dd03ba17 fixup 6800 test program 2011-04-05 18:09:53 +00:00
BigEd fca2eb5cb6 fixup 6800 pre-reset delay 2011-04-05 18:09:38 +00:00
BigEd b5c1759f32 improve 6800 machine state display 2011-04-02 08:01:09 +00:00
BigEd 6ceae74e4a 6800 fixup single stepping 2011-04-02 07:57:15 +00:00
BigEd 94b306bace update 6800 machine state readout 2011-04-01 20:57:42 +00:00
BigEd 9308b26c42 update 6800 loglevel definitions 2011-04-01 20:12:22 +00:00
BigEd 335cb06832 update 6800 segdefs to add missing pullups 2011-04-01 20:11:51 +00:00
BigEd d9440fa160 6800: fixup bus reads, add annotation for unassigned opcodes 2011-04-01 18:44:12 +00:00
BigEd 10ba01cf12 fixup 6800 disassembly 2011-04-01 17:55:49 +00:00
BigEd e8b964a24f fixup 6800 IR nodenames 2011-04-01 17:55:30 +00:00
BigEd bbfcf77134 update 6800 nodenames and trace signals 2011-04-01 17:32:01 +00:00
BigEd 73f21ffc47 update 6800 test program 2011-04-01 17:31:30 +00:00
BigEd 4e2c84dabc update 6800 test program and add opcode map 2011-04-01 16:05:41 +00:00
BigEd ca7124b176 6800: treat dbe as phi2 clock in 2011-04-01 14:40:56 +00:00
BigEd b0710a4cda trying to clean up gh-pages 2011-04-01 11:59:22 +00:00
BigEd baac06bdc3 Merge branch 'gh-pages' of git@github.com:BigEd/visual6502 into gh-pages 2011-04-01 11:57:47 +00:00
BigEd 9bb8caa025 update README 2011-04-01 11:50:04 +00:00
BigEd b98010206e trying to clean up gh-pages 2011-04-01 11:40:21 +00:00
BigEd 7049cef9b7 update README 2011-04-01 11:38:37 +00:00
BigEd 9d23382644 trying to clean up gh-pages 2011-04-01 11:34:02 +00:00
BigEd 8f5f50d197 first cut of ijor's 6800 2011-04-01 11:19:42 +00:00
BigEd 1d21f5ae8b few small changes to prepare for multi-chip capability 2011-04-01 11:17:34 +00:00
BigEd 15b25491b9 nodename adjustments and additions 2011-02-20 20:06:29 +00:00
BigEd 6033109dc6 adjust pclp and pchp to pickup non inverted state 2011-02-15 20:04:08 +00:00
BigEd 0e41f0a9a9 [bug]fixup misnumbered node abl7 2011-02-15 19:54:06 +00:00
BigEd cb29fb4fad readjust timing of URL-scheduled events to match published version 2011-01-10 10:45:52 +00:00
BigEd c02d181d5c add more nodenames from Segher 2011-01-09 20:32:51 +00:00
BigEd 51d0e99389 add ability to override the databus by URL 2011-01-09 16:18:01 +00:00
BigEd d11cf44ae9 add ability to sequence RDY pin from the URL 2011-01-09 13:10:13 +00:00
BigEd 2e69d3a7c3 fix: allow coincident pin events 2011-01-09 13:09:25 +00:00
Barry Silverman f098566335 Hilited nodes toggle state when stepped or run 2011-01-03 15:17:27 -05:00
BigEd e25ac6243c fixup merge conflict markers 2010-12-23 19:15:30 +00:00
BigEd 94e22becb4 fixup expert.html consolidation 2010-12-23 19:00:05 +00:00
BigEd a56ee40bd8 attempt to get gh-pages into shape 2010-12-23 18:59:02 +00:00
BigEd 2ace0e8bad try consolidating into just 2 files for efficient loading 2010-12-23 18:14:58 +00:00
BigEd 8f2e296ef6 update git project pages with placeholder/redirect empty content 2010-11-22 13:42:46 +00:00
BigEd ee2fa1befd removing gh-pages project preview 2010-11-22 13:41:40 +00:00
BigEd 7c50999c9e Merge branch 'gh-pages' of git@github.com:BigEd/visual6502 into gh-pages 2010-11-22 13:40:15 +00:00
BigEd abf6daef7d Merge branch 'master' into gh-pages 2010-11-19 22:42:58 +00:00
BigEd 3bf9ae1fac Merge branch 'master' into gh-pages 2010-11-09 21:26:10 +00:00
BigEd c4af64f5e8 Merge branch 'master' into gh-pages 2010-11-09 20:32:27 +00:00
BigEd 82daddcfe4 Merge branch 'master' into gh-pages 2010-11-08 22:29:26 +00:00
BigEd 50ecadaa00 Merge branch 'master' into gh-pages 2010-11-08 22:18:24 +00:00
BigEd 8a2342d83c Merge branch 'master' into gh-pages 2010-11-08 22:04:12 +00:00
BigEd 60b4ecab22 Merge branch 'master' into gh-pages 2010-11-08 09:17:38 +00:00
BigEd 9ff6ae027e note nature of this temporary export branch in the HTML 2010-11-06 17:59:40 +00:00
25 changed files with 59421 additions and 3695 deletions

View File

@ -1,92 +1,92 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? '; path=' + options.path : '';
var domain = options.domain ? '; domain=' + options.domain : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? '; path=' + options.path : '';
var domain = options.domain ? '; domain=' + options.domain : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

4
README
View File

@ -1,9 +1,11 @@
This is the javascript simulator from the visual5602.org project:
This is the JavaScript simulator from the visual6502.org project:
www.visual6502.org/JSSim
It includes a general purpose transistor-level simulator, layout browser,
and the data from a 6502 revD chip.
It also includes a similar simulator for the 6800 chip.
Note the various licenses and Copyright associated with each file.
Enjoy!

1222
chip-6800/nodenames.js Normal file

File diff suppressed because it is too large Load Diff

9818
chip-6800/segdefs.js Normal file

File diff suppressed because one or more lines are too long

488
chip-6800/support.js Normal file
View File

@ -0,0 +1,488 @@
// chip-specific support functions
//
// may override function definitions made previously
chipname='6800';
grChipSize=6600;
grChipOffsetX=25
grChipOffsetY=-200;
ngnd = nodenames['gnd'];
npwr = nodenames['vcc'];
nodenamereset = 'reset';
presetLogLists=[
['cycle',],
['ab','db','rw','vma','Fetch','pc','acca','accb','ix','sp','p'],
['ir','sync','Execute','State'], // instruction fetch and execution control
['dbi','dbo','tmp','sum','inc'], // internal register-sized state
['idb','abh','abl','ablx'], // internal datapath busses
['irq','nmi',nodenamereset,'tsc','dbe','halt','ba'], // other pins
];
function setupTransistors(){
for(i in transdefs){
var tdef = transdefs[i];
var name = tdef[0];
var gate = tdef[1];
var c1 = tdef[2];
var c2 = tdef[3];
var bb = tdef[4];
if(tdef[6])
// just ignore all the 'weak' transistors for now
continue;
if(c1==ngnd) {c1=c2;c2=ngnd;}
if(c1==npwr) {c1=c2;c2=npwr;}
var trans = {name: name, on: false, gate: gate, c1: c1, c2: c2, bb: bb};
nodes[gate].gates.push(trans);
nodes[c1].c1c2s.push(trans);
nodes[c2].c1c2s.push(trans);
transistors[name] = trans;
}
}
// simulate a single clock phase with no update to graphics or trace
function halfStep(){
var clk = isNodeHigh(nodenames['phi2']);
eval(clockTriggers[cycle]);
if (clk) {setLow('phi2'); setLow('dbe'); setHigh('phi1'); handleBusRead(); }
else {setHigh('phi1'); setLow('phi1'); setHigh('phi2'); setHigh('dbe'); handleBusWrite();}
}
function goUntilSyncOrWrite(){
halfStep();
cycle++;
while(
!isNodeHigh(nodenames['phi2']) ||
( !isNodeHigh(nodenames['sync']) && isNodeHigh(nodenames['rw']) )
) {
halfStep();
cycle++;
}
chipStatus();
}
function initChip(){
var start = now();
for(var nn in nodes) {
nodes[nn].state = false;
nodes[nn].float = true;
}
nodes[ngnd].state = false;
nodes[ngnd].float = false;
nodes[npwr].state = true;
nodes[npwr].float = false;
for(var tn in transistors) transistors[tn].on = false;
setLow(nodenamereset);
setHigh('phi1'); setLow('phi2'); setLow('dbe');
setHigh('dbe'); setLow('tsc'); setHigh('halt');
setHigh('irq'); setHigh('nmi');
recalcNodeList(allNodes());
for(var i=0;i<8;i++){
setLow('phi1');
setHigh('phi2'); setHigh('dbe');
setLow('phi2'); setLow('dbe');
setHigh('phi1');
}
setHigh(nodenamereset);
for(var i=0;i<6;i++){halfStep();} // avoid updating graphics and trace buffer before user code
refresh();
cycle = 0;
trace = Array();
if(typeof expertMode != "undefined")
updateLogList();
chipStatus();
if(ctrace)console.log('initChip done after', now()-start);
}
function handleBusRead(){
if(isNodeHigh(nodenames['rw'])){
var a = readAddressBus();
var d = eval(readTriggers[a]);
if(d == undefined)
d = mRead(readAddressBus());
if(isNodeHigh(nodenames['sync']))
eval(fetchTriggers[d]);
writeDataBus(d);
}
}
function readAccA(){return readBits('acca', 8);}
function readAccB(){return readBits('accb', 8);}
function readIX(){return (readBits('ixh', 8)<<8) + readBits('ixl', 8);}
function readSP(){return (readBits('sph', 8)<<8) + readBits('spl', 8);}
function readPstring(){
var result;
result = '&#8209' + // non-breaking hyphen
'&#8209' + // non-breaking hyphen
(isNodeHigh(nodenames['flagh'])?'H':'h') +
(isNodeHigh(nodenames['flagi'])?'I':'i') +
(isNodeHigh(nodenames['flagn'])?'N':'n') +
(isNodeHigh(nodenames['flagz'])?'Z':'z') +
(isNodeHigh(nodenames['flagv'])?'V':'v') +
(isNodeHigh(nodenames['flagc'])?'C':'c');
return result;
}
// The 6800 state control is something like a branching shift register
// ... but not quite like that
TCStates=[
"Ts", "Tf",
"Tx0", "Tx1", "Tx2",
"Ta0", "Ta1", "Ta2",
"Td0_0",
"#Te0", "Te1_0",
"Tg0", "Tg1", "Tg2", "Tg3", "Tg4", "Tg5", "Tg6", "Tg7", "Tg8",
"Tr3", "Tr4", "Tr5", "Tr6", "Tr7", "Tr8",
];
function listActiveTCStates() {
var s=[];
for(var i=0;i<TCStates.length;i++){
var t=TCStates[i];
// remove a leading hash, but invert the signal
// in any case, remove any trailing suffix
if(t[0]=="#"){
if(!isNodeHigh(nodenames[t])) s.push(t.slice(1,4));
} else {
if(isNodeHigh(nodenames[t])) s.push(t.slice(0,3));
}
}
return s.join("+");
}
function busToString(busname){
// takes a signal name or prefix
// returns an appropriate string representation
// some 'signal names' are CPU-specific aliases to user-friendly string output
if(busname=='cycle')
return cycle>>1;
if(busname=='pc')
return busToHex('pch') + busToHex('pcl');
if(busname=='sp')
return busToHex('sph') + busToHex('spl');
if(busname=='ix')
return busToHex('ixh') + busToHex('ixl');
if(busname=='inc')
return busToHex('inch') + busToHex('incl');
if(busname=='p')
return readPstring();
if(busname=='State')
return listActiveTCStates();
if(busname=='Execute')
return disassemblytoHTML(readBits('ir',8));
if(busname=='Fetch')
return isNodeHigh(nodenames['sync'])?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 +
' phi0:' + readBit('phi2') +
' AB:' + hexWord(ab) +
' D:' + hexByte(readDataBus()) +
' RnW:' + readBit('rw') +
' VMA:' + readBit('vma');
var machine2 =
' PC:' + hexWord(readPC()) +
' A:' + hexByte(readAccA()) +
' B:' + hexByte(readAccB()) +
' IX:' + hexWord(readIX()) +
' SP:' + hexWord(readSP()) +
' ' + readPstring();
var machine3 =
'Hz: ' + estimatedHz().toFixed(1);
if(typeof expertMode != "undefined") {
machine3 += ' Exec: ' + busToString('Execute'); // no T-state info for 6800 yet
if(isNodeHigh(nodenames['sync']))
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);
}
// javascript derived from http://segher.ircgeeks.net/6800/OPS
var disassembly={
0x00: "!",
0x01: "nop",
0x02: "!",
0x03: "!",
0x04: "!",
0x05: "!",
0x06: "tap",
0x07: "tpa",
0x10: "sba",
0x11: "cba",
0x12: "!",
0x13: "!",
0x14: "!nba",
0x15: "!",
0x16: "tab",
0x17: "tba",
0x20: "bra N",
0x21: "!",
0x22: "bhi N",
0x23: "bls N",
0x24: "bcc N",
0x25: "bcs N",
0x26: "bne N",
0x27: "beq N",
0x30: "tsx",
0x31: "ins",
0x32: "pul a",
0x33: "pul b",
0x34: "des",
0x35: "txs",
0x36: "psh a",
0x37: "psh b",
0x40: "neg a",
0x41: "!",
0x42: "!",
0x43: "com a",
0x44: "lsr a",
0x45: "!",
0x46: "ror a",
0x47: "asr a",
0x50: "neg b",
0x51: "!",
0x52: "!",
0x53: "com b",
0x54: "lsr b",
0x55: "!",
0x56: "ror b",
0x57: "asr b",
0x60: "neg Nx",
0x61: "!",
0x62: "!",
0x63: "com Nx",
0x64: "lsr Nx",
0x65: "!",
0x66: "ror Nx",
0x67: "asr Nx",
0x70: "neg NN",
0x71: "!",
0x72: "!",
0x73: "com NN",
0x74: "lsr NN",
0x75: "!",
0x76: "ror NN",
0x77: "asr NN",
0x80: "sub a #",
0x81: "cmp a #",
0x82: "sbc a #",
0x83: "!",
0x84: "and a #",
0x85: "bit a #",
0x86: "lda a #",
0x87: "!",
0x90: "sub a N",
0x91: "cmp a N",
0x92: "sbc a N",
0x93: "!",
0x94: "and a N",
0x95: "bit a N",
0x96: "lda a N",
0x97: "sta a N",
0xa0: "sub a Nx",
0xa1: "cmp a Nx",
0xa2: "sbc a Nx",
0xa3: "!",
0xa4: "and a Nx",
0xa5: "bit a Nx",
0xa6: "lda a Nx",
0xa7: "sta a Nx",
0xb0: "sub a NN",
0xb1: "cmp a NN",
0xb2: "sbc a NN",
0xb3: "!",
0xb4: "and a NN",
0xb5: "bit a NN",
0xb6: "lda a NN",
0xb7: "sta a NN",
0xc0: "sub b #",
0xc1: "cmp b #",
0xc2: "sbc b #",
0xc3: "!",
0xc4: "and b #",
0xc5: "bit b #",
0xc6: "lda b #",
0xc7: "!",
0xd0: "sub b N",
0xd1: "cmp b N",
0xd2: "sbc b N",
0xd3: "!",
0xd4: "and b N",
0xd5: "bit b N",
0xd6: "lda b N",
0xd7: "sta b N",
0xe0: "sub b Nx",
0xe1: "cmp b Nx",
0xe2: "sbc b Nx",
0xe3: "!",
0xe4: "and b Nx",
0xe5: "bit b Nx",
0xe6: "lda b Nx",
0xe7: "sta b Nx",
0xf0: "sub b NN",
0xf1: "cmp b NN",
0xf2: "sbc b NN",
0xf3: "!",
0xf4: "and b NN",
0xf5: "bit b NN",
0xf6: "lda b NN",
0xf7: "sta b NN",
0x08: "inx",
0x09: "dex",
0x0a: "clv",
0x0b: "sev",
0x0c: "clc",
0x0d: "sec",
0x0e: "cli",
0x0f: "sei",
0x18: "!",
0x19: "daa",
0x1a: "!",
0x1b: "aba",
0x1c: "!",
0x1d: "!",
0x1e: "!",
0x1f: "!",
0x28: "bvc N",
0x29: "bvs N",
0x2a: "bpl N",
0x2b: "bmi N",
0x2c: "bge N",
0x2d: "blt N",
0x2e: "bgt N",
0x2f: "ble N",
0x38: "!",
0x39: "rts",
0x3a: "!",
0x3b: "rti",
0x3c: "!",
0x3d: "!",
0x3e: "wai",
0x3f: "swi",
0x48: "asl a",
0x49: "rol a",
0x4a: "dec a",
0x4b: "!",
0x4c: "inc a",
0x4d: "tst a",
0x4e: "!",
0x4f: "clr a",
0x58: "asl b",
0x59: "rol b",
0x5a: "dec b",
0x5b: "!",
0x5c: "inc b",
0x5d: "tst b",
0x5e: "!",
0x5f: "clr b",
0x68: "asl Nx",
0x69: "rol Nx",
0x6a: "dec Nx",
0x6b: "!",
0x6c: "inc Nx",
0x6d: "tst Nx",
0x6e: "jmp Nx",
0x6f: "clr Nx",
0x78: "asl NN",
0x79: "rol NN",
0x7a: "dec NN",
0x7b: "!",
0x7c: "inc NN",
0x7d: "tst NN",
0x7e: "jmp NN",
0x7f: "clr NN",
0x88: "eor a #",
0x89: "adc a #",
0x8a: "ora a #",
0x8b: "add a #",
0x8c: "cpx ##",
0x8d: "bsr N",
0x8e: "lds ##",
0x8f: "!",
0x98: "eor a N",
0x99: "adc a N",
0x9a: "ora a N",
0x9b: "add a N",
0x9c: "cpx N",
0x9d: "!hcf",
0x9e: "lds N",
0x9f: "sts N",
0xa8: "eor a Nx",
0xa9: "adc a Nx",
0xaa: "ora a Nx",
0xab: "add a Nx",
0xac: "cpx Nx",
0xad: "jsr Nx",
0xae: "lds Nx",
0xaf: "sts Nx",
0xb8: "eor a NN",
0xb9: "adc a NN",
0xba: "ora a NN",
0xbb: "add a NN",
0xbc: "cpx NN",
0xbd: "jsr NN",
0xbe: "lds NN",
0xbf: "sts NN",
0xc8: "eor b #",
0xc9: "adc b #",
0xca: "ora b #",
0xcb: "add b #",
0xcc: "!",
0xcd: "!",
0xce: "ldx ##",
0xcf: "!",
0xd8: "eor b N",
0xd9: "adc b N",
0xda: "ora b N",
0xdb: "add b N",
0xdc: "!",
0xdd: "!hcf",
0xde: "ldx N",
0xdf: "stx N",
0xe8: "eor b Nx",
0xe9: "adc b Nx",
0xea: "ora b Nx",
0xeb: "add b Nx",
0xec: "!",
0xed: "!",
0xee: "ldx Nx",
0xef: "stx Nx",
0xf8: "eor b NN",
0xf9: "adc b NN",
0xfa: "ora b NN",
0xfb: "add b NN",
0xfc: "!",
0xfd: "!",
0xfe: "ldx NN",
0xff: "stx NN",
};

31
chip-6800/testprogram.js Normal file
View File

@ -0,0 +1,31 @@
// This file testprogram.js can be substituted by one of several tests
testprogramAddress=0x0000;
// we want to auto-clear the console if any output is sent by the program
var consoleboxStream="";
// demonstrate write hook
writeTriggers[0x8000]="consoleboxStream += String.fromCharCode(d);"+
"consolebox.innerHTML = consoleboxStream;";
// demonstrate read hook (not used by this test program)
readTriggers[0x8004]="((consolegetc==undefined)?0:0xff)"; // return zero until we have a char
readTriggers[0x8000]="var c=consolegetc; consolegetc=undefined; (c)";
// for opcodes, see http://www.textfiles.com/programming/CARDS/6800
testprogram = [
0xce, 0x43, 0x21, // LDX #4321
0x35, // TXS
0xce, 0x80, 0x00, // LDX #8000
0xc6, 0x40, // LDAB #$40
0xbd, 0x00, 0x10, // JSR $0010
0x7e, 0x00, 0x09, // JMP $0009
0x01, // NOP
0x4a, // DECA
0xe7, 0x00, // STAB 0, X
0x7c, 0x00, 0x0f, // INC $0F
0x0d, // SEC
0xc9, 0x02, // ADCB #$02
0x39, // RTS
]

4017
chip-6800/transdefs.js Executable file

File diff suppressed because it is too large Load Diff

530
chip-z80/nodenames.js Normal file
View File

@ -0,0 +1,530 @@
// ***********************************************************
// * This file is automatically generated by Z80Simulator. *
// * Please do not manually edit! Instead, find a transistor *
// * that uses the new signal and use FindTransistor(x,y) in *
// * Z80Simulator to cause that signal to be added. *
// * This seems a pain, but it has two advantages: *
// * - all signals are then available in Z80Simulator *
// * - it avoids renumbering issues if/when the PNGs change *
// ***********************************************************
var nodenames ={
// Pads
vss: 1,
vcc: 2,
clk: 3,
ab0: 5,
ab1: 6,
ab2: 7,
ab3: 8,
ab4: 9,
ab5: 10,
ab6: 11,
ab7: 12,
ab8: 13,
ab9: 14,
ab10: 15,
ab11: 16,
ab12: 17,
ab13: 18,
ab14: 19,
ab15: 20,
_reset: 21,
_wait: 22,
wait: 22,
_int: 23,
int: 23,
_irq: 23,
irq: 23,
_nmi: 24,
nmi: 24,
_busrq: 25,
busrq: 25,
_m1: 26,
_rd: 27,
_wr: 28,
_mreq: 29,
_iorq: 30,
_rfsh: 31,
db0: 32,
db1: 33,
db2: 34,
db3: 35,
db4: 36,
db5: 37,
db6: 38,
db7: 39,
_halt: 40,
_busak: 41,
// T-States
t1: 115,
t2: 137,
t3: 144,
t4: 166,
t5: 134,
t6: 168,
// Machine cycles
m1: 155,
m2: 173,
m3: 163,
m4: 159,
m5: 209,
m6: 210,
// EXX latches
ex_af: 631,
ex_bcdehl: 1770,
ex_dehl0: 625,
ex_dehl1: 629,
ex_dehl_combined: 626,
// Registers
reg_a0: 2245,
reg_a1: 2319,
reg_a2: 2357,
reg_a3: 2442,
reg_a4: 2463,
reg_a5: 2552,
reg_a6: 2586,
reg_a7: 2656,
reg_f0: 1827,
reg_f1: 1903,
reg_f2: 1928,
reg_f3: 2009,
reg_f4: 2032,
reg_f5: 2107,
reg_f6: 2132,
reg_f7: 2209,
reg_b0: 2242,
reg_b1: 2316,
reg_b2: 2354,
reg_b3: 2439,
reg_b4: 2460,
reg_b5: 2549,
reg_b6: 2583,
reg_b7: 2653,
reg_c0: 1824,
reg_c1: 1900,
reg_c2: 1925,
reg_c3: 2006,
reg_c4: 2029,
reg_c5: 2104,
reg_c6: 2129,
reg_c7: 2206,
reg_d0: 2238,
reg_d1: 2312,
reg_d2: 2350,
reg_d3: 2435,
reg_d4: 2456,
reg_d5: 2545,
reg_d6: 2579,
reg_d7: 2649,
reg_e0: 1820,
reg_e1: 1896,
reg_e2: 1921,
reg_e3: 2002,
reg_e4: 2025,
reg_e5: 2100,
reg_e6: 2125,
reg_e7: 2202,
reg_h0: 2240,
reg_h1: 2314,
reg_h2: 2352,
reg_h3: 2437,
reg_h4: 2458,
reg_h5: 2547,
reg_h6: 2581,
reg_h7: 2651,
reg_l0: 1822,
reg_l1: 1898,
reg_l2: 1923,
reg_l3: 2004,
reg_l4: 2027,
reg_l5: 2102,
reg_l6: 2127,
reg_l7: 2204,
reg_w0: 2234,
reg_w1: 2308,
reg_w2: 2346,
reg_w3: 2431,
reg_w4: 2452,
reg_w5: 2541,
reg_w6: 2575,
reg_w7: 2645,
reg_z0: 1816,
reg_z1: 1892,
reg_z2: 1917,
reg_z3: 1998,
reg_z4: 2021,
reg_z5: 2096,
reg_z6: 2121,
reg_z7: 2198,
reg_pch0: 2232,
reg_pch1: 2306,
reg_pch2: 2344,
reg_pch3: 2429,
reg_pch4: 2450,
reg_pch5: 2539,
reg_pch6: 2573,
reg_pch7: 2643,
reg_pcl0: 1814,
reg_pcl1: 1890,
reg_pcl2: 1915,
reg_pcl3: 1996,
reg_pcl4: 2019,
reg_pcl5: 2094,
reg_pcl6: 2119,
reg_pcl7: 2196,
reg_sph0: 2235,
reg_sph1: 2309,
reg_sph2: 2347,
reg_sph3: 2432,
reg_sph4: 2453,
reg_sph5: 2542,
reg_sph6: 2576,
reg_sph7: 2646,
reg_spl0: 1817,
reg_spl1: 1893,
reg_spl2: 1918,
reg_spl3: 1999,
reg_spl4: 2022,
reg_spl5: 2097,
reg_spl6: 2122,
reg_spl7: 2199,
reg_ixh0: 2237,
reg_ixh1: 2311,
reg_ixh2: 2349,
reg_ixh3: 2434,
reg_ixh4: 2455,
reg_ixh5: 2544,
reg_ixh6: 2578,
reg_ixh7: 2648,
reg_ixl0: 1819,
reg_ixl1: 1895,
reg_ixl2: 1920,
reg_ixl3: 2001,
reg_ixl4: 2024,
reg_ixl5: 2099,
reg_ixl6: 2124,
reg_ixl7: 2201,
reg_iyh0: 2236,
reg_iyh1: 2310,
reg_iyh2: 2348,
reg_iyh3: 2433,
reg_iyh4: 2454,
reg_iyh5: 2543,
reg_iyh6: 2577,
reg_iyh7: 2647,
reg_iyl0: 1818,
reg_iyl1: 1894,
reg_iyl2: 1919,
reg_iyl3: 2000,
reg_iyl4: 2023,
reg_iyl5: 2098,
reg_iyl6: 2123,
reg_iyl7: 2200,
reg_i0: 2233,
reg_i1: 2307,
reg_i2: 2345,
reg_i3: 2430,
reg_i4: 2451,
reg_i5: 2540,
reg_i6: 2574,
reg_i7: 2644,
reg_r0: 1815,
reg_r1: 1891,
reg_r2: 1916,
reg_r3: 1997,
reg_r4: 2020,
reg_r5: 2095,
reg_r6: 2120,
reg_r7: 2197,
reg_aa0: 2244,
reg_aa1: 2318,
reg_aa2: 2356,
reg_aa3: 2441,
reg_aa4: 2462,
reg_aa5: 2551,
reg_aa6: 2585,
reg_aa7: 2655,
reg_ff0: 1826,
reg_ff1: 1902,
reg_ff2: 1927,
reg_ff3: 2008,
reg_ff4: 2031,
reg_ff5: 2106,
reg_ff6: 2131,
reg_ff7: 2208,
reg_bb0: 2243,
reg_bb1: 2317,
reg_bb2: 2355,
reg_bb3: 2440,
reg_bb4: 2461,
reg_bb5: 2550,
reg_bb6: 2584,
reg_bb7: 2654,
reg_cc0: 1825,
reg_cc1: 1901,
reg_cc2: 1926,
reg_cc3: 2007,
reg_cc4: 2030,
reg_cc5: 2105,
reg_cc6: 2130,
reg_cc7: 2207,
reg_dd0: 2239,
reg_dd1: 2313,
reg_dd2: 2351,
reg_dd3: 2436,
reg_dd4: 2457,
reg_dd5: 2546,
reg_dd6: 2580,
reg_dd7: 2650,
reg_ee0: 1821,
reg_ee1: 1897,
reg_ee2: 1922,
reg_ee3: 2003,
reg_ee4: 2026,
reg_ee5: 2101,
reg_ee6: 2126,
reg_ee7: 2203,
reg_hh0: 2241,
reg_hh1: 2315,
reg_hh2: 2353,
reg_hh3: 2438,
reg_hh4: 2459,
reg_hh5: 2548,
reg_hh6: 2582,
reg_hh7: 2652,
reg_ll0: 1823,
reg_ll1: 1899,
reg_ll2: 1924,
reg_ll3: 2005,
reg_ll4: 2028,
reg_ll5: 2103,
reg_ll6: 2128,
reg_ll7: 2205,
// Data buses and control
dp_dl: 82,
dl_dp: 165,
load_ir: 1354,
dlatch0: 123,
dlatch1: 195,
dlatch2: 414,
dlatch3: 930,
dlatch4: 1000,
dlatch5: 872,
dlatch6: 751,
dlatch7: 358,
dl_d: 87,
d_dl: 133,
dbus0: 138,
dbus1: 196,
dbus2: 412,
dbus3: 480,
dbus4: 485,
dbus5: 486,
dbus6: 380,
dbus7: 370,
_instr0: 1350,
_instr1: 1360,
_instr2: 1366,
_instr3: 1380,
_instr4: 1388,
_instr5: 1395,
_instr6: 1370,
_instr7: 1375,
instr0: 1348,
instr1: 1359,
instr2: 1365,
instr3: 1379,
instr4: 1387,
instr5: 1394,
instr6: 1369,
instr7: 1374,
d_u: 546,
ubus0: 545,
ubus1: 528,
ubus2: 526,
ubus3: 770,
ubus4: 779,
ubus5: 790,
ubus6: 716,
ubus7: 525,
u_v: 750,
vbus0: 755,
vbus1: 772,
vbus2: 783,
vbus3: 796,
vbus4: 803,
vbus5: 808,
vbus6: 836,
vbus7: 839,
rl_wr: 678,
rh_wr: 652,
r_u: 692,
r_v: 693,
regbit0: 702,
regbit1: 732,
regbit2: 738,
regbit3: 775,
regbit4: 776,
regbit5: 807,
regbit6: 809,
regbit7: 864,
regbit8: 870,
regbit9: 902,
regbit10: 906,
regbit11: 934,
regbit12: 935,
regbit13: 970,
regbit14: 973,
regbit15: 999,
r_p: 1785,
r_x1: 608,
pcbit0: 703,
pcbit1: 731,
pcbit2: 739,
pcbit3: 774,
pcbit4: 777,
pcbit5: 806,
pcbit6: 810,
pcbit7: 863,
pcbit8: 871,
pcbit9: 901,
pcbit10: 907,
pcbit11: 933,
pcbit12: 936,
pcbit13: 969,
pcbit14: 974,
pcbit15: 998,
// ALU
alubus0: 837,
alubus1: 889,
alubus2: 937,
alubus3: 983,
alubus4: 852,
alubus5: 903,
alubus6: 951,
alubus7: 995,
alua0: 850,
alua1: 899,
alua2: 947,
alua3: 993,
alua4: 868,
alua5: 920,
alua6: 968,
alua7: 1007,
alub0: 845,
alub1: 897,
alub2: 944,
alub3: 988,
alub4: 867,
alub5: 918,
alub6: 966,
alub7: 1005,
aluout0: 2211,
aluout1: 2338,
aluout2: 2504,
aluout3: 816,
alulat0: 865,
alulat1: 912,
alulat2: 960,
alulat3: 1002,
// PLA
pla0: 287,
pla1: 332,
pla2: 314,
pla3: 333,
pla4: 315,
pla5: 334,
pla6: 316,
pla7: 335,
pla8: 317,
pla9: 336,
pla10: 318,
pla11: 361,
pla12: 261,
pla13: 337,
pla14: 319,
pla15: 464,
pla16: 288,
pla17: 338,
pla18: 320,
pla19: 364,
pla20: 325,
pla21: 324,
pla22: 308,
pla23: 289,
pla24: 339,
pla25: 313,
pla26: 340,
pla27: 290,
pla28: 341,
pla29: 291,
pla30: 342,
pla31: 292,
pla32: 365,
pla33: 293,
pla34: 362,
pla35: 294,
pla36: 331,
pla37: 293,
pla38: 343,
pla39: 296,
pla40: 297,
pla41: 298,
pla42: 344,
pla43: 299,
pla44: 269,
pla45: 300,
pla46: 237,
pla47: 301,
pla48: 345,
pla49: 302,
pla50: 346,
pla51: 264,
pla52: 266,
pla53: 347,
pla54: 303,
pla55: 356,
pla56: 227,
pla57: 366,
pla58: 304,
pla59: 305,
pla60: 271,
pla61: 348,
pla62: 306,
pla63: 309,
pla64: 311,
pla65: 312,
pla66: 307,
pla67: 367,
pla68: 272,
pla69: 349,
pla70: 273,
pla71: 350,
pla72: 274,
pla73: 351,
pla74: 275,
pla75: 276,
pla76: 268,
pla77: 352,
pla78: 277,
pla79: 278,
pla80: 279,
pla81: 280,
pla82: 368,
pla83: 281,
pla84: 282,
pla85: 283,
pla86: 284,
pla87: 285,
pla88: 286,
pla89: 321,
pla90: 353,
pla91: 322,
pla92: 354,
pla93: 323,
pla94: 369,
pla95: 258,
pla96: 249,
pla97: 245,
pla98: 355,
}

14606
chip-z80/segdefs.js Normal file

File diff suppressed because one or more lines are too long

2570
chip-z80/support.js Normal file

File diff suppressed because it is too large Load Diff

73
chip-z80/testprogram.js Normal file
View File

@ -0,0 +1,73 @@
// This file testprogram.js can be substituted by one of several tests
testprogramAddress=0x0000;
// we want to auto-clear the console if any output is sent by the program
var consoleboxStream="";
// demonstrate write hook
writeTriggers[0x8000]="consoleboxStream += String.fromCharCode(d);"+
"consolebox.innerHTML = consoleboxStream;";
// demonstrate read hook (not used by this test program)
readTriggers[0x8004]="((consolegetc==undefined)?0:0xff)"; // return zero until we have a char
readTriggers[0x8000]="var c=consolegetc; consolegetc=undefined; (c)";
// for opcodes, see http://www.textfiles.com/programming/CARDS/6800
testprogram = [
0x00, // NOP
0x31, 0x00, 0x01, // LD SP,0x0100
0xCD, 0x0B, 0x00, // CALL $000B
0x00, // NOP
0x21, 0x78, 0x56, // LD HL,$5678
0x21, 0x34, 0x12, // LD HL,$1234
0xe5, // PUSH HL
0x00, // NOP
0x00, // NOP
0x3C, // INC A
0x04, // INC B
0x15, // DEC D
0x24, // INC H
0xEB, // EXX DE,HL
0x00, // NOP
0x3C, // INC A
0x04, // INC B
0x15, // DEC D
0x24, // INC H
0xD9, // EXX
0x00, // NOP
0x3C, // INC A
0x04, // INC B
0x15, // DEC D
0x24, // INC H
0xEB, // EXX DE,HL
0x00, // NOP
0x3C, // INC A
0x04, // INC B
0x15, // DEC D
0x24, // INC H
0x08, // EXX AF,AF'
0x00, // NOP
0x3C, // INC A
0x04, // INC B
0x15, // DEC D
0x24, // INC H
0x00, // NOP
0x00, // NOP
0x00, // NOP
0x21, 0x00, 0x01, // LD HL,$0100
0x36, 0xCC, // LD (HL),$CC
0x00, // NOP
0x7E, // LD A, (HL)
0x00, // NOP
// Pavel's original test program
0x21, 0x34, 0x12, // LD HL,$1234
0x31, 0xfe, 0xdc, // LD SP,0xDCFE
0xe5, // PUSH HL
0x21, 0x78, 0x56, // LD HL,$5678
0xe3, // EX (SP),HL
0xdd, 0x21, 0xbc,0x9a, // LD IX, 0x9ABC
0xdd, 0xe3, // EX (SP),IX
0x76, // HALT
0x00 // NOP
]

6815
chip-z80/transdefs.js Executable file

File diff suppressed because it is too large Load Diff

View File

@ -143,14 +143,22 @@ function saveString(name, str){
function allNodes(){
var res = new Array();
for(var i in nodes) if((i!=npwr)&&(i!=ngnd)) res.push(i);
var ii = 0;
for(var i in nodes) {
// Don't feed numeric strings to recalcNodeList(). Numeric
// strings can cause a (data dependent) duplicate node number
// hiccup when accumulating a node group's list, ie:
// group => [ "49", 483, 49 ]
ii = Number( i );
if((ii!=npwr)&&(ii!=ngnd)) res.push(ii);
}
return res;
}
function stateString(){
var codes = ['l','h'];
var res = '';
for(var i=0;i<1725;i++){
for(var i=0;i<nodes.length;i++){
var n = nodes[i];
if(n==undefined) res+='x';
else if(i==ngnd) res+='g';

153
expert-6800.html Normal file
View File

@ -0,0 +1,153 @@
<!DOCTYPE html>
<head>
<title>Visual 6800 in JavaScript</title>
<style type="text/css">@import "expert.css";</style>
<script src="chip-6800/segdefs.js"></script>
<script src="chip-6800/transdefs.js"></script>
<script src="chip-6800/nodenames.js"></script>
<script src="wires.js"></script>
<script src="expertWires.js"></script>
<script src="chipsim.js"></script>
<script src="memtable.js"></script>
<script src="macros.js"></script>
<script src="chip-6800/support.js"></script>
<script src="chip-6800/testprogram.js"></script>
<script src="3rdparty/jquery-1.3.2.min.js"></script>
<script src="3rdparty/jquery.cookie.js"></script>
<script src="3rdparty/splitter.js"></script>
<script type="text/javascript">
function handleOnload() {
/MSIE (\d+\.\d+);/.test(navigator.appVersion);
IEVersion=Number(RegExp.$1);
if((navigator.appName == 'Microsoft Internet Explorer') && (IEVersion<9)){
document.getElementById('browsertrouble').innerHTML=
'<p>Sorry, '+navigator.appName+' not supported - showing you a picture instead!</p>';
document.getElementById('frame').innerHTML='<a href="browsertrouble.html"><img src="images/jssim2.png" style="border:10px"></a>';
}else{
setTimeout(setup,200);
}
};
// initialise splitter (built on jquery)
$().ready(function(){
$("#frame").splitter({
type: "v",
outline: true,
minLeft: 20,
sizeLeft: 810,
resizeToWidth: true,
anchorToWindow: true,
});
$("#rightcolumn").splitter({
type: "h",
outline: true,
sizeBottom: 180,
minTop: 100,
});
});
</script>
</head>
<body onload="handleOnload();">
<span id="plain">
<a href="http://www.visual6502.org/faq.html">FAQ</a>&nbsp;
<a href="http://blog.visual6502.org">Blog</a>&nbsp;
<a href="http://www.visual6502.org/links.html">Links</a>&nbsp;
<a href="http://github.com/trebonian/visual6502">Source</a>&nbsp;
<a href="http://www.textfiles.com/programming/CARDS/6800">6800 instruction card</a>&nbsp;
<a href="http://www.sbprojects.com/sbasm/6800.htm#model">programming model</a>&nbsp;
</span>
<div class="frame" id="frame">
<div class="leftcolumn" id="leftcolumn">
<div id="chipsurround" tabindex="1">
<div class="chip" id="chip">
<span id="waiting">Please wait, graphics initialising...</span>
<canvas class="chip" id="chipbg"></canvas>
<canvas class="chip" id="overlay"></canvas>
<canvas class="chip" id="hilite"></canvas>
<canvas class="chip" id="hitbuffer"></canvas>
</div>
</div> <!-- chipsurround -->
<div class="nochip" id="nochip">
<form>
<input type="button" value="Show chip layout" onclick="updateChipLayoutVisibility(true)" />
</form>
</div>
<div id="layoutControlPanel">
Use 'z' or '>' to zoom in, 'x' or '<' to zoom out, click to probe signals and drag to pan.
<form id="updateShow"> Show:
<input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" />(diffusion)
<input type="checkbox" name="3" id="updateShow3" onchange="updateShow(this.name,this.checked)" />(grounded diffusion)
<input type="checkbox" name="4" id="updateShow4" onchange="updateShow(this.name,this.checked)" />(powered diffusion)
<input type="checkbox" name="5" id="updateShow5" onchange="updateShow(this.name,this.checked)" />(polysilicon)
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" />(metal)
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" />(protection)
</form>
<form action="javascript:hiliteNodeList();">
<input type="button" value="Find:" onclick="hiliteNodeList();" />
<input type="text" id="HighlightThese" name="HighlightThese" value="" />
<input type="button" value="Clear Highlighting" onclick="clearHighlight();" />
<span class="animatebox">
Animate during simulation:
<input type="checkbox" id="animateModeCheckbox" onchange="updateChipLayoutAnimation(this.checked)"
/></span>
</form>
<form>
<input type="button" value="Hide Chip Layout" onclick="updateChipLayoutVisibility(false)" />
<a href="" id="linkHere" >Link to this location</a>
</form>
</div>
</div> <!-- closing leftcolumn -->
<div class="rightcolumn" id="rightcolumn">
<div id="righttopdiv">
<div class = "buttons">
<div class="twobuttons">
<a href ="javascript:stopChip()" id="stop"><img class="navstop" src="images/stop.png" title="stop"></a>
<a href ="javascript:runChip()" id="start"><img class="navplay" src="images/play.png" title="run"></a>
</div>
<div class="morebuttons">
<a href ="javascript:resetChip()"><img class="navbutton" src="images/up.png" title="reset"></a>
<a href ="javascript:stepBack()"><img class="navbutton" src="images/prev.png" title="back"></a>
<a href ="javascript:stepForward()"><img class="navbutton" src="images/next.png" title="forward"></a>
<a href ="javascript:goUntilSyncOrWrite()"><img class="navbutton" src="images/singlestep.png" title="step"></a>
<a href ="javascript:goFor()"><img class="navbutton" src="images/fastforward.png" title="fastforward"></a>
</div>
<div style="float:right;">
<a href="http://visual6502.org/wiki/index.php?title=JssimUserHelp" target="_blank">User Guide</a>
&nbsp;
</div>
</div> <!-- buttons -->
<div class="status" id="status"><p>x: 0<br>y: 0</p>
</div> <!-- status -->
<div id="memtablediv">
<table class="memtable" id="memtable" tabindex="2"></table>
</div>
</div> <!-- righttopdiv -->
<div id="tracingdiv">
<textarea id="consolebox">
click here and type if your program handles input
</textarea>
<div id="expertControlPanel" tabindex="3">
<form action="javascript:updateLogList()">
<input type="button" value="Trace more" onclick="updateLoglevel(++loglevel)" />
<input type="button" value="Trace less" onclick="updateLoglevel(--loglevel)" />
<input type="button" value="Trace these too:" onclick="updateLogList()" />
<input type="text" id="LogThese" name="LogThese" value="" />
<input type="button" value="Log Up/Down" onclick="updateLogDirection();" />
<input type="button" value="Clear Log" onclick="updateLoglevel(loglevel)" />
</form>
<br />
</div>
<div id="logstreamscroller">
<table class="logstream" id="logstream"></table>
</div>
</div>
</div> <!-- closing rightcolumn -->
</div> <!-- closing 'frame' div -->
</body>
</html>

14942
expert-allinone.js Normal file

File diff suppressed because one or more lines are too long

151
expert-z80.html Normal file
View File

@ -0,0 +1,151 @@
<!DOCTYPE html>
<head>
<title>Visual Z80 in JavaScript</title>
<style type="text/css">@import "expert.css";</style>
<script src="chip-z80/segdefs.js"></script>
<script src="chip-z80/transdefs.js"></script>
<script src="chip-z80/nodenames.js"></script>
<script src="wires.js"></script>
<script src="expertWires.js"></script>
<script src="chipsim.js"></script>
<script src="memtable.js"></script>
<script src="macros.js"></script>
<script src="chip-z80/support.js"></script>
<script src="chip-z80/testprogram.js"></script>
<script src="3rdparty/jquery-1.3.2.min.js"></script>
<script src="3rdparty/jquery.cookie.js"></script>
<script src="3rdparty/splitter.js"></script>
<script type="text/javascript">
function handleOnload() {
/MSIE (\d+\.\d+);/.test(navigator.appVersion);
IEVersion=Number(RegExp.$1);
if((navigator.appName == 'Microsoft Internet Explorer') && (IEVersion<9)){
document.getElementById('browsertrouble').innerHTML=
'<p>Sorry, '+navigator.appName+' not supported - showing you a picture instead!</p>';
document.getElementById('frame').innerHTML='<a href="browsertrouble.html"><img src="images/jssim2.png" style="border:10px"></a>';
}else{
setTimeout(setup,200);
}
};
// initialise splitter (built on jquery)
$().ready(function(){
$("#frame").splitter({
type: "v",
outline: true,
minLeft: 20,
sizeLeft: 810,
resizeToWidth: true,
anchorToWindow: true,
});
$("#rightcolumn").splitter({
type: "h",
outline: true,
sizeBottom: 180,
minTop: 100,
});
});
</script>
</head>
<body onload="handleOnload();">
<span id="plain">
<a href="http://www.visual6502.org/faq.html">FAQ</a>&nbsp;
<a href="http://blog.visual6502.org">Blog</a>&nbsp;
<a href="http://www.visual6502.org/links.html">Links</a>&nbsp;
<a href="http://github.com/trebonian/visual6502">Source</a>&nbsp;
</span>
<div class="frame" id="frame">
<div class="leftcolumn" id="leftcolumn">
<div id="chipsurround" tabindex="1">
<div class="chip" id="chip">
<span id="waiting">Please wait, graphics initialising...</span>
<canvas class="chip" id="chipbg"></canvas>
<canvas class="chip" id="overlay"></canvas>
<canvas class="chip" id="hilite"></canvas>
<canvas class="chip" id="hitbuffer"></canvas>
</div>
</div> <!-- chipsurround -->
<div class="nochip" id="nochip">
<form>
<input type="button" value="Show chip layout" onclick="updateChipLayoutVisibility(true)" />
</form>
</div>
<div id="layoutControlPanel">
Use 'z' or '>' to zoom in, 'x' or '<' to zoom out, click to probe signals and drag to pan.
<form id="updateShow"> Show:
<input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" />(diffusion)
<input type="checkbox" name="3" id="updateShow3" onchange="updateShow(this.name,this.checked)" />(grounded diffusion)
<input type="checkbox" name="4" id="updateShow4" onchange="updateShow(this.name,this.checked)" />(powered diffusion)
<input type="checkbox" name="5" id="updateShow5" onchange="updateShow(this.name,this.checked)" />(polysilicon)
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" />(metal)
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" />(protection)
</form>
<form action="javascript:hiliteNodeList();">
<input type="button" value="Find:" onclick="hiliteNodeList();" />
<input type="text" id="HighlightThese" name="HighlightThese" value="" />
<input type="button" value="Clear Highlighting" onclick="clearHighlight();" />
<span class="animatebox">
Animate during simulation:
<input type="checkbox" id="animateModeCheckbox" onchange="updateChipLayoutAnimation(this.checked)"
/></span>
</form>
<form>
<input type="button" value="Hide Chip Layout" onclick="updateChipLayoutVisibility(false)" />
<a href="" id="linkHere" >Link to this location</a>
</form>
</div>
</div> <!-- closing leftcolumn -->
<div class="rightcolumn" id="rightcolumn">
<div id="righttopdiv">
<div class = "buttons">
<div class="twobuttons">
<a href ="javascript:stopChip()" id="stop"><img class="navstop" src="images/stop.png" title="stop"></a>
<a href ="javascript:runChip()" id="start"><img class="navplay" src="images/play.png" title="run"></a>
</div>
<div class="morebuttons">
<a href ="javascript:resetChip()"><img class="navbutton" src="images/up.png" title="reset"></a>
<a href ="javascript:stepBack()"><img class="navbutton" src="images/prev.png" title="back"></a>
<a href ="javascript:stepForward()"><img class="navbutton" src="images/next.png" title="forward"></a>
<a href ="javascript:goUntilSyncOrWrite()"><img class="navbutton" src="images/singlestep.png" title="step"></a>
<a href ="javascript:goFor()"><img class="navbutton" src="images/fastforward.png" title="fastforward"></a>
</div>
<div style="float:right;">
<a href="http://visual6502.org/wiki/index.php?title=JssimUserHelp" target="_blank">User Guide</a>
&nbsp;
</div>
</div> <!-- buttons -->
<div class="status" id="status"><p>x: 0<br>y: 0</p>
</div> <!-- status -->
<div id="memtablediv">
<table class="memtable" id="memtable" tabindex="2"></table>
</div>
</div> <!-- righttopdiv -->
<div id="tracingdiv">
<textarea id="consolebox">
click here and type if your program handles input
</textarea>
<div id="expertControlPanel" tabindex="3">
<form action="javascript:updateLogList()">
<input type="button" value="Trace more" onclick="updateLoglevel(++loglevel)" />
<input type="button" value="Trace less" onclick="updateLoglevel(--loglevel)" />
<input type="button" value="Trace these too:" onclick="updateLogList()" />
<input type="text" id="LogThese" name="LogThese" value="" />
<input type="button" value="Log Up/Down" onclick="updateLogDirection();" />
<input type="button" value="Clear Log" onclick="updateLoglevel(loglevel)" />
</form>
<br />
</div>
<div id="logstreamscroller">
<table class="logstream" id="logstream"></table>
</div>
</div>
</div> <!-- closing rightcolumn -->
</div> <!-- closing 'frame' div -->
</body>
</html>

View File

@ -56,8 +56,8 @@ $().ready(function(){
<a href="http://blog.visual6502.org">Blog</a>&nbsp;
<a href="http://www.visual6502.org/links.html">Links</a>&nbsp;
<a href="http://github.com/trebonian/visual6502">Source</a>&nbsp;
<a href="http://www.6502asm.com/">6502asm assembler</a>&nbsp;
<a href="http://www.e-tradition.net/bytes/6502/disassembler.html">e-tradition disassembler</a>&nbsp;
<a href="http://skilldrick.github.io/easy6502/#first-program">easy6502 assembler</a>&nbsp;
<a href="http://www.masswerk.at/6502/disassembler.html">mass:werk disassembler</a>&nbsp;
</span>
<div class="frame" id="frame">
<div class="leftcolumn" id="leftcolumn">
@ -76,21 +76,21 @@ $().ready(function(){
</form>
</div>
<div id="layoutControlPanel">
Use 'z' or '>' to zoom in, 'x' or '<' to zoom out, click to probe signals and drag to pan.
Use 'z' or '&gt;' to zoom in, 'x' or '&lt;' to zoom out, click to probe signals and drag to pan.
<form id="updateShow"> Show:
<input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" />(diffusion)
<input type="checkbox" name="3" id="updateShow3" onchange="updateShow(this.name,this.checked)" />(grounded diffusion)
<input type="checkbox" name="4" id="updateShow4" onchange="updateShow(this.name,this.checked)" />(powered diffusion)
<input type="checkbox" name="5" id="updateShow5" onchange="updateShow(this.name,this.checked)" />(polysilicon)
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" />(metal)
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" />(protection)
<input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" /><label for="updateShow1">(diffusion)</label>
<input type="checkbox" name="3" id="updateShow3" onchange="updateShow(this.name,this.checked)" /><label for="updateShow3">(grounded diffusion)</label>
<input type="checkbox" name="4" id="updateShow4" onchange="updateShow(this.name,this.checked)" /><label for="updateShow4">(powered diffusion)</label>
<input type="checkbox" name="5" id="updateShow5" onchange="updateShow(this.name,this.checked)" /><label for="updateShow5">(polysilicon)</label>
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" /><label for="updateShow0">(metal)</label>
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" /><label for="updateShow2">(protection)</label>
</form>
<form action="javascript:hiliteNodeList();">
<input type="button" value="Find:" onclick="hiliteNodeList();" />
<input type="text" id="HighlightThese" name="HighlightThese" value="" />
<input type="button" value="Clear Highlighting" onclick="clearHighlight();" />
<span class="animatebox">
Animate during simulation:
<label for="animateModeCheckbox">Animate during simulation:</label>
<input type="checkbox" id="animateModeCheckbox" onchange="updateChipLayoutAnimation(this.checked)"
/></span>
</form>
@ -115,7 +115,7 @@ $().ready(function(){
<a href ="javascript:goFor()"><img class="navbutton" src="images/fastforward.png" title="fastforward"></a>
</div>
<div style="float:right;">
<a href="http://visual6502.org/wiki/index.php?title=JssimUserHelp" target="_blank">User Guide</a>
<a href="https://web.archive.org/web/20210608195625/http://visual6502.org/wiki/index.php?title=JssimUserHelp" target="_blank">User Guide</a>
&nbsp;
</div>
</div> <!-- buttons -->

View File

@ -37,12 +37,14 @@ var labelThese=[];
// overlay - a red/white transparency to show logic high or low
// hilite - to show the selected polygon
// hitbuffer - abusing color values to return which polygon is under a point
// we no longer use a scaling transform - we now scale the chip data at
// we no longer use a scaling transform - we now scale the chip data at
// the point of drawing line segments
// if the canvas is any smaller than chip coordinates there will be
// rounding artifacts, and at high zoom there will be anti-aliasing on edges.
var grMaxZoom=12;
var grChipSize=10000;
var grChipOffsetX=400;
var grChipOffsetY=0;
var grCanvasSize=2000;
var grLineWidth=1;
@ -51,7 +53,7 @@ var layernames = ['metal', 'switched diffusion', 'inputdiode', 'grounded diffusi
var colors = ['rgba(128,128,192,0.4)','#FFFF00','#FF00FF','#4DFF4D',
'#FF4D4D','#801AC0','rgba(128,0,255,0.75)'];
var drawlayers = [true, true, true, true, true, true];
// some modes and parameters which can be passed in from the URL query
var moveHereFirst;
var expertMode=true;
@ -96,7 +98,7 @@ function setup_part3(){
// which saves a lot of memory and allows us to run on small systems
updateChipLayoutVisibility(true);
}
setStatus('resetting 6502...');
setStatus('resetting ' + chipname + '...');
setTimeout(setup_part4, 0);
}
@ -195,17 +197,43 @@ function setupParams(){
} else
// setup input pin events, breakpoints, watchpoints
if(name=="reset0" && parseInt(value)!=NaN){
clockTriggers[value]="setLow('res');";
clockTriggers[value]=[clockTriggers[value],"setLow(nodenamereset);"].join("");
} else if(name=="reset1" && parseInt(value)!=NaN){
clockTriggers[value]="setHigh('res');";
clockTriggers[value]=[clockTriggers[value],"setHigh(nodenamereset);"].join("");
} else if(name=="irq0" && parseInt(value)!=NaN){
clockTriggers[value]="setLow('irq');";
clockTriggers[value]=[clockTriggers[value],"setLow('irq');"].join("");
} else if(name=="irq1" && parseInt(value)!=NaN){
clockTriggers[value]="setHigh('irq');";
clockTriggers[value]=[clockTriggers[value],"setHigh('irq');"].join("");
} else if(name=="nmi0" && parseInt(value)!=NaN){
clockTriggers[value]="setLow('nmi');";
clockTriggers[value]=[clockTriggers[value],"setLow('nmi');"].join("");
} else if(name=="nmi1" && parseInt(value)!=NaN){
clockTriggers[value]="setHigh('nmi');";
clockTriggers[value]=[clockTriggers[value],"setHigh('nmi');"].join("");
} else if(name=="rdy0" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setLow('rdy');"].join("");
} else if(name=="rdy1" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setHigh('rdy');"].join("");
} else if(name=="so0" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setLow('so');"].join("");
} else if(name=="so1" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setHigh('so');"].join("");
// Some Z80 inputs - we can refactor if this becomes unwieldy
} else if(name=="int0" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setLow('int');"].join("");
} else if(name=="int1" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setHigh('int');"].join("");
} else if(name=="wait0" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setLow('wait');"].join("");
} else if(name=="wait1" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setHigh('wait');"].join("");
} else if(name=="busrq0" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setLow('busrq');"].join("");
} else if(name=="busrq1" && parseInt(value)!=NaN){
clockTriggers[value]=[clockTriggers[value],"setHigh('busrq');"].join("");
//
} else if(name=="time" && parseInt(value)!=NaN){
eventTime=value;
} else if(name=="databus" && parseInt(value)!=NaN){
clockTriggers[eventTime]=[clockTriggers[eventTime],"writeDataBus(0x"+value+");"].join("");
} else
// run a test program, and optionally check against a golden checksum
if(name=="steps" && parseInt(value)!=NaN){
@ -249,13 +277,22 @@ function handleKey(e){
else if(c=='p') stepBack();
}
// handler for zoom in/out using the mouse wheel
function handleWheelZoom(e){
chipsurround.focus();
e.preventDefault();
var n = e.deltaY / 100;
if(n>0 && zoom>1) setZoom(zoom/1.2);
if(n<0 && zoom<grMaxZoom) setZoom(zoom*1.2);
}
// handler for mousedown events over chip display
// must handle click-to-select (and focus), and drag to pan
function mouseDown(e){
chipsurround.focus();
e.preventDefault();
moved=false;
dragMouseX = e.clientX;
moved=false;
dragMouseX = e.clientX;
dragMouseY = e.clientY;
chipsurround.onmousemove = function(e){mouseMove(e)};
chipsurround.onmouseup = function(e){mouseUp(e)};
@ -278,7 +315,7 @@ function mouseMove(e){
}
function mouseUp(e){
if(!moved) handleClick(e);
if(!moved) handleClick(e);
chipsurround.onmousemove = undefined;
chipsurround.onmouseup = undefined;
}
@ -322,8 +359,8 @@ function updateLinkHere(){
// boxLabel(['PD', 50, 8424, 3536, 9256, 2464])
// boxLabel(['IR', 50, 8432, 2332, 9124, 984])
// boxLabel(['PLA', 100, 1169, 2328, 8393, 934])
// boxLabel(['Y', 50, 2143, 8820, 2317, 5689])
// boxLabel(['X', 50, 2317, 8820, 2490, 5689])
// boxLabel(['Y', 50, 2143, 8820, 2317, 5689])
// boxLabel(['X', 50, 2317, 8820, 2490, 5689])
// boxLabel(['S', 50, 2490, 8820, 2814, 5689])
// boxLabel(['ALU', 50, 2814, 8820, 4525, 5689])
// boxLabel(['DAdj', 40, 4525, 8820, 5040, 5689])
@ -449,7 +486,7 @@ function hiliteNodeList(){
// the localx and localy functions return canvas coordinate offsets from the canvas window top left corner
// we divide the results by 'zoom' to get drawn coordinates useful in findNodeNumber
// to convert to reported user chip coordinates we multiply by grChipSize/600
// to compare to segdefs and transdefs coordinates we subtract 400 from x and subtract y from grChipSize
// to compare to segdefs and transdefs coordinates we subtract grChipOffsetX from x and subtract y from grChipSize plus grChipOffsetY
function handleClick(e){
var x = localx(hilite, e.clientX)/zoom;
@ -459,7 +496,7 @@ function handleClick(e){
var cx = Math.round(x*grChipSize/600);
var cy = Math.round(y*grChipSize/600);
// prepare two lines of status report
var s1='x: ' + cx + ' y: ' + cy;
var s1='x: ' + (cx - grChipOffsetX) + ' y: ' + (cy - grChipOffsetY);
var s2='node:&nbsp;' + w + '&nbsp;' + nodeName(w);
if(w==-1) {
setStatus(s1); // no node found, so report only coordinates
@ -468,8 +505,8 @@ function handleClick(e){
// we have a node, but maybe we clicked over a transistor
var nodelist=[w];
// match the coordinate against transistor gate bounding boxes
x=cx-400;
y=grChipSize-cy;
x=cx-grChipOffsetX;
y=grChipSize+grChipOffsetY-cy;
for(var i=0;i<nodes[w].gates.length;i++){
var xmin=nodes[w].gates[i].bb[0], xmax=nodes[w].gates[i].bb[1];
var ymin=nodes[w].gates[i].bb[2], ymax=nodes[w].gates[i].bb[3];
@ -571,8 +608,10 @@ function setupChipLayoutGraphics(){
}
// grant focus to the chip display to enable zoom keys
chipsurround.focus();
chipsurround.onwheel = function(e){handleWheelZoom(e);};
chipsurround.onmousedown = function(e){mouseDown(e);};
chipsurround.onkeypress = function(e){handleKey(e);};
chipsurround.onmouseout = function(e){mouseLeave(e);};
}
// utility function to save graphics pan and zoom

View File

@ -66,7 +66,7 @@ Keyboard controls: 'z' to zoom in, 'x' to zoom out, 'n' to step the simulation.
<br />
Mouse controls: Left-click and drag to scroll around (when you're zoomed in.)
<br />
More information in the <a href="http://visual6502.org/wiki/index.php?title=JssimUserHelp">User Guide<a>.
More information in the <a href="https://web.archive.org/web/20210608195625/http://visual6502.org/wiki/index.php?title=JssimUserHelp">User Guide</a>.
<br />
<br />
</span>
@ -79,13 +79,13 @@ More information in the <a href="http://visual6502.org/wiki/index.php?title=Jssi
</div>
<div class = "buttons">
<div style="position:relative; float:left;">
<a href ="javascript:stopChip()"id="stop"><img class="navstop" src="images/stop.png"></a>
<a href ="javascript:runChip()" id="start"><img class="navplay" src="images/play.png"></a>
<a href ="javascript:stopChip()" id="stop"><img class="navstop" src="images/stop.png" title="stop"></a>
<a href ="javascript:runChip()" id="start"><img class="navplay" src="images/play.png" title="start"></a>
</div>
<div style="float:left;">
<a href ="javascript:resetChip()"><img class="navbutton" src="images/up.png"></a>
<a href ="javascript:stepBack()"><img class="navbutton" src="images/prev.png"></a>
<a href ="javascript:stepForward()"><img class="navbutton" src="images/next.png"></a>
<a href ="javascript:resetChip()"><img class="navbutton" src="images/up.png" title="reset"></a>
<a href ="javascript:stepBack()"><img class="navbutton" src="images/prev.png" title="back"></a>
<a href ="javascript:stepForward()"><img class="navbutton" src="images/next.png" title="step"></a>
</div>
<div style="float:right; margin-left:20px;">... or try <a href="expert.html">Advanced</a></div>
</div>
@ -97,8 +97,8 @@ More information in the <a href="http://visual6502.org/wiki/index.php?title=Jssi
<br />
<br />
Source code is available on <a href="http://github.com/trebonian/visual6502">github visual6502</a>.
Use the online <a href="http://www.6502asm.com/">emulator and assembler</a> from 6502asm.com
and <a href="http://www.e-tradition.net/bytes/6502/disassembler.html">disassembler</a> from e-tradition.net
Use the online <a href="https://skilldrick.github.io/easy6502/#first-program">emulator and assembler</a> from the easy6502 tutorial
and <a href="http://www.masswerk.at/6502/disassembler.html">disassembler</a> from mass:werk
<br />
For in-depth 6502 investigation and some more advanced features, try our <a href="expert.html">Advanced</a> page.
<br />

View File

@ -89,6 +89,6 @@ table.memtable {
}
#title {
font-size:30px;
font-size:30px;
font-weight:bold;
}

View File

@ -45,6 +45,8 @@ var userResetHigh;
// rounding artifacts, and at high zoom there will be anti-aliasing on edges.
var grMaxZoom=12;
var grChipSize=10000;
var grChipOffsetX=400;
var grChipOffsetY=0;
var grCanvasSize=2000;
var grLineWidth=1;

103
macros.js
View File

@ -26,6 +26,8 @@ var trace = Array();
var logstream = Array();
var running = false;
var logThese=[];
var chipname='6502';
var nodenamereset='res';
var presetLogLists=[
['cycle'],
['ab','db','rw','Fetch','pc','a','x','y','s','p'],
@ -35,7 +37,7 @@ var presetLogLists=[
['alucin','alua','alub','alucout','aluvout','dasb'],
['plaOutputs','DPControl'],
['idb','dor'],
['irq','nmi','res'],
['irq','nmi',nodenamereset],
];
function loadProgram(){
@ -147,13 +149,13 @@ function initChip(){
nodes[npwr].state = true;
nodes[npwr].float = false;
for(var tn in transistors) transistors[tn].on = false;
setLow('res');
setLow(nodenamereset);
setLow('clk0');
setHigh('rdy'); setLow('so');
setHigh('irq'); setHigh('nmi');
recalcNodeList(allNodes());
for(var i=0;i<8;i++){setHigh('clk0'), setLow('clk0');}
setHigh('res');
setHigh(nodenamereset);
for(var i=0;i<18;i++){halfStep();} // avoid updating graphics and trace buffer before user code
refresh();
cycle = 0;
@ -224,9 +226,10 @@ fetchTriggers={};
// simulate a single clock phase with no update to graphics or trace
function halfStep(){
var clk = isNodeHigh(nodenames['clk0']);
eval(clockTriggers[cycle]);
if (clk) {setLow('clk0'); handleBusRead(); }
else {setHigh('clk0'); handleBusWrite();}
eval(clockTriggers[cycle+1]); // pre-apply next tick's inputs now, so the updates are displayed
}
function handleBusRead(){
@ -301,6 +304,71 @@ function listActiveTCStates() {
return s.join("+");
}
// Show all time code node states (active and inactive) in fixed format,
// with non-PLA-controlling internal state indication in square
// brackets, followed by RCL-resident timing state indication.
// ".." for a PLA-controlling node indicates inactive state, "T"* for a
// PLA-controlling node indicates active state.
// Bracketed codes are one of T1/V0/T6/..
// V0 indicates the VEC0 node, T6 is a synonym for the VEC1 node.
// The RCL codes are one of SD1/SD2/...
// 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 ? '&nbsp;' : ' ';
if ( !isNodeHigh( nodenames[ 'clock1' ] ) ) 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
if ( !isNodeHigh( nodenames[ 'clock2' ] ) ) s += "T+"; else s += "..";
s += _spc;
if ( !isNodeHigh( nodenames[ 't2' ] ) ) s += "T2"; else s += "..";
s += _spc;
if ( !isNodeHigh( nodenames[ 't3' ] ) ) s += "T3"; else s += "..";
s += _spc;
if ( !isNodeHigh( nodenames[ 't4' ] ) ) s += "T4"; else s += "..";
s += _spc;
if ( !isNodeHigh( nodenames[ 't5' ] ) ) s += "T5"; else s += "..";
s += _spc + "[";
// Check three confirmed exclusive states (three nodes)
if ( isNodeHigh( 862 ) ) {
s += "T1";
// ...else if VEC0 is on...
} else if ( isNodeHigh( nodenames[ 'VEC0' ] ) ) {
// ...then tell the outside world
s += "V0";
// ...else if VEC1 is on...
} else if ( isNodeHigh( nodenames[ 'VEC1' ] ) ) {
// ...then this is the canonical T6. It is a synonym for VEC1
s += "T6";
} else {
// ...else none of the "hidden" bits in the clock state is active
s += "..";
}
s += "]" + _spc;
// Check the RCL's two confirmed exclusive states (two nodes)
// If this node is grounding ~WR...
if ( isNodeHigh( 440 ) ) {
// ...then we can regard this state as Store Data 1
s += "SD1";
// ...else if this node is grounding ~WR...
} else if ( isNodeHigh( 1258 ) ) {
// ...then we can regard this state as Store Data 2
s += "SD2";
} else {
// ...else none of the RCL-resident timing bits is active
s += "...";
}
return s;
}
function readBit(name){
return isNodeHigh(nodenames[name])?1:0;
}
@ -327,16 +395,23 @@ 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 '&Phi;' +
(isNodeHigh( nodenames[ 'cp1' ] ) ? '1' : '2');
if(busname=='Execute')
return dis6502toHTML(readBits('ir',8));
return disassemblytoHTML(readBits('ir',8));
if(busname=='Fetch')
return isNodeHigh(nodenames['sync'])?dis6502toHTML(readDataBus()):"";
return isNodeHigh(nodenames['sync'])?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]+_');
return listActiveSignals('^dpc[-]?[0-9]+_');
if(busname[0]=="-"){
// invert the value of the bus for display
var value=busToHex(busname.slice(1))
@ -424,7 +499,7 @@ function stopChip(){
function resetChip(){
stopChip();
setStatus('resetting 6502...');
setStatus('resetting ' + chipname + '...');
setTimeout(initChip,0);
}
@ -469,7 +544,7 @@ function chipStatus(){
machine3 += " Chk:" + traceChecksum + ((traceChecksum==goldenChecksum)?" OK":" no match");
}
setStatus(machine1, machine2, machine3);
if (loglevel>0) {
if (logThese.length>1) {
updateLogbox(logThese);
}
selectCell(ab);
@ -507,6 +582,8 @@ function goForN(n){
return;
}
running = false;
var start = document.getElementById('start');
var stop = document.getElementById('stop');
start.style.visibility = 'visible';
stop.style.visibility = 'hidden';
}
@ -623,8 +700,8 @@ function adler32(x){
}
// sanitised opcode for HTML output
function dis6502toHTML(byte){
var opcode=dis6502[byte];
function disassemblytoHTML(byte){
var opcode=disassembly[byte];
if(typeof opcode == "undefined")
return "unknown"
return opcode.replace(/ /,'&nbsp;');
@ -632,7 +709,7 @@ function dis6502toHTML(byte){
// opcode lookup for 6502 - not quite a disassembly
// javascript derived from Debugger.java by Achim Breidenbach
var dis6502={
var disassembly={
0x00:"BRK",
0x01:"ORA (zp,X)",
0x05:"ORA zp",
@ -694,7 +771,7 @@ var dis6502={
0x68:"PLA",
0x69:"ADC #",
0x6A:"ROR ",
0x6C:"JMP zp",
0x6C:"JMP (Abs)",
0x6D:"ADC Abs",
0x6E:"ROR Abs",
0x70:"BVS ",

View File

@ -82,7 +82,7 @@ x4: 85,
x5: 589,
x6: 448,
x7: 777,
pcl0: 1139, // machine state: program counter low (first storage node)
pcl0: 1139, // machine state: program counter low (first storage node output)
pcl1: 1022,
pcl2: 655,
pcl3: 1359,
@ -90,14 +90,30 @@ pcl4: 900,
pcl5: 622,
pcl6: 377,
pcl7: 1611,
pclp0: 1227, // machine state: program counter low (pre-incremented?, second storage node)
pclp1: 1102,
pclp2: 1079,
pclp3: 868,
pclp4: 39,
pclp5: 1326,
pclp6: 731,
pclp7: 536,
pclp0: 488, // machine state: program counter low (pre-incremented?, second storage node)
pclp1: 976,
pclp2: 481,
pclp3: 723,
pclp4: 208,
pclp5: 72,
pclp6: 1458,
pclp7: 1647,
"#pclp0": 1227, // machine state: program counter low (pre-incremented?, inverse second storage node)
"~pclp0": 1227, // automatic alias replacing hash with tilde
"#pclp1": 1102,
"~pclp1": 1102, // automatic alias replacing hash with tilde
"#pclp2": 1079,
"~pclp2": 1079, // automatic alias replacing hash with tilde
"#pclp3": 868,
"~pclp3": 868, // automatic alias replacing hash with tilde
"#pclp4": 39,
"~pclp4": 39, // automatic alias replacing hash with tilde
"#pclp5": 1326,
"~pclp5": 1326, // automatic alias replacing hash with tilde
"#pclp6": 731,
"~pclp6": 731, // automatic alias replacing hash with tilde
"#pclp7": 536,
"~pclp7": 536, // automatic alias replacing hash with tilde
pch0: 1670, // machine state: program counter high (first storage node)
pch1: 292,
pch2: 502,
@ -106,14 +122,30 @@ pch4: 948,
pch5: 49,
pch6: 1551,
pch7: 205,
pchp0: 780, // machine state: program counter high (pre-incremented?, second storage node)
pchp1: 113,
pchp2: 114,
pchp3: 124,
pchp4: 820,
pchp5: 33,
pchp6: 751,
pchp7: 535,
pchp0: 1722, // machine state: program counter high (pre-incremented?, second storage node output)
pchp1: 209,
pchp2: 1496,
pchp3: 141,
pchp4: 27,
pchp5: 1301,
pchp6: 652,
pchp7: 1206,
"#pchp0": 780, // machine state: program counter high (pre-incremented?, inverse second storage node)
"~pchp0": 780, // automatic alias replacing hash with tilde
"#pchp1": 113,
"~pchp1": 113, // automatic alias replacing hash with tilde
"#pchp2": 114,
"~pchp2": 114, // automatic alias replacing hash with tilde
"#pchp3": 124,
"~pchp3": 124, // automatic alias replacing hash with tilde
"#pchp4": 820,
"~pchp4": 820, // automatic alias replacing hash with tilde
"#pchp5": 33,
"~pchp5": 33, // automatic alias replacing hash with tilde
"#pchp6": 751,
"~pchp6": 751, // automatic alias replacing hash with tilde
"#pchp7": 535,
"~pchp7": 535, // automatic alias replacing hash with tilde
// machine state: status register (not the storage nodes)
p0: 32, // C bit of status register (storage node)
p1: 627, // Z bit of status register (storage node)
@ -121,8 +153,8 @@ p2: 1553, // I bit of status register (storage node)
p3: 348, // D bit of status register (storage node)
p4: 1119, // there is no bit4 in the status register! (not a storage node)
p5: -1, // there is no bit5 in the status register! (not a storage node)
p6: 77, // V bit of status register (storage node)
p7: 1370, // N bit of status register (storage node)
p6: 1625, // V bit of status register (storage node)
p7: 69, // N bit of status register (storage node)
// internal bus: status register outputs for push P
Pout0: 687,
@ -158,9 +190,11 @@ notir4: 26,
notir5: 1394,
notir6: 895,
notir7: 1320,
irline3: 996, // internal signal: PLA input - ir0 AND ir1
irline3: 996, // internal signal: PLA input - ir0 OR ir1
clock1: 1536, // internal state: timing control aka #T0
clock1: 1536, // automatic alias replacing hash with tilde
clock2: 156, // internal state: timing control aka #T+
clock2: 156, // automatic alias replacing hash with tilde
t2: 971, // internal state: timing control
t3: 1567,
t4: 690,
@ -214,6 +248,7 @@ sb5: 166,
sb6: 1336,
sb7: 1001,
notalu0: 394, // datapath state: alu output storage node (inverse) aka #ADD0
notalu0: 394, // automatic alias replacing hash with tilde
notalu1: 697,
notalu2: 276,
notalu3: 495,
@ -301,7 +336,9 @@ pd7: 1690,
"PD-xxx010x1": 302,
"PD-n-0xx0xx0x": 125,
"#TWOCYCLE": 851,
"~TWOCYCLE": 851, // automatic alias replacing hash with tilde
"#TWOCYCLE.phi1": 792,
"~TWOCYCLE.phi1": 792, // automatic alias replacing hash with tilde
"ONEBYTE": 778,
abl0: 1096, // internal bus: address bus low latched data out (inverse of inverted storage node)
@ -311,15 +348,23 @@ abl3: 1250,
abl4: 1232,
abl5: 234,
abl6: 178,
abl7: 178,
abl7: 567,
"#ABL0": 153, // internal state: address bus low latched data out (storage node, inverted)
"~ABL0": 153, // automatic alias replacing hash with tilde
"#ABL1": 107,
"~ABL1": 107, // automatic alias replacing hash with tilde
"#ABL2": 707,
"~ABL2": 707, // automatic alias replacing hash with tilde
"#ABL3": 825,
"~ABL3": 825, // automatic alias replacing hash with tilde
"#ABL4": 364,
"~ABL4": 364, // automatic alias replacing hash with tilde
"#ABL5": 1513,
"~ABL5": 1513, // automatic alias replacing hash with tilde
"#ABL6": 1307,
"~ABL6": 1307, // automatic alias replacing hash with tilde
"#ABL7": 28,
"~ABL7": 28, // automatic alias replacing hash with tilde
abh0: 1429, // internal bus: address bus high latched data out (inverse of inverted storage node)
abh1: 713,
abh2: 287,
@ -329,28 +374,41 @@ abh5: 775,
abh6: 997,
abh7: 489,
"#ABH0": 1062, // internal state: address bus high latched data out (storage node, inverted)
"~ABH0": 1062, // automatic alias replacing hash with tilde
"#ABH1": 907,
"~ABH1": 907, // automatic alias replacing hash with tilde
"#ABH2": 768,
"~ABH2": 768, // automatic alias replacing hash with tilde
"#ABH3": 92,
"~ABH3": 92, // automatic alias replacing hash with tilde
"#ABH4": 668,
"~ABH4": 668, // automatic alias replacing hash with tilde
"#ABH5": 1128,
"~ABH5": 1128, // automatic alias replacing hash with tilde
"#ABH6": 289,
"~ABH6": 289, // automatic alias replacing hash with tilde
"#ABH7": 429,
"~ABH7": 429, // automatic alias replacing hash with tilde
notRdy0: 248, // internal signal: global pipeline control
"branch-back": 626, // distinguish forward from backward branches
"branch-forward.phi1": 1110, // distinguish forward from backward branches
"branch-back.phi1": 771, // distinguish forward from backward branches in IPC logic
notRdy0: 248, // internal signal: global pipeline control
"notRdy0.phi1": 1272, // delayed pipeline control
"notRdy0.delay": 770, // global pipeline control latched by phi1 and then phi2
"#notRdy0.delay": 559, // global pipeline control latched by phi1 and then phi2 (storage node)
"~notRdy0.delay": 559, // automatic alias replacing hash with tilde
Reset0: 67, // internal signal: retimed reset from pin
C1x5Reset: 926, // retimed and pipelined reset in progress
notRnWprepad: 187, // internal signal: to pad, yet to be inverted and retimed
RnWstretched: 353, // internal signal: control datapad output drivers, aka TRISTATE
"#DBE": 1035, // internal signal: formerly from DBE pad (6501)
"~DBE": 1035, // automatic alias replacing hash with tilde
cp1: 710, // internal signal: clock phase 1
cclk: 943, // unbonded pad: internal non-overlappying phi2
cclk: 943, // unbonded pad: internal non-overlapping phi2
fetch: 879, // internal signal
clearIR: 1077, // internal signal
D1x1: 827, // internal signal: interrupt handler related
H1x1: 1042, // internal signal: drive status byte onto databus
"brk-done": 1382, // internal signal: interrupt handler related
INTG: 1350, // internal signal: interrupt handler related
// internal signal: pla outputs block 1 (west/left edge of die)
// often 130 pla outputs are mentioned - we have 131 here
@ -500,45 +558,75 @@ INTG: 1350, // internal signal: interrupt handler related
"x-op-push/pull":1050, // pla121 // feeds into pla130 (no normal pla output)
"op-T0-cld/sed":1419, // pla122
"#op-branch-bit6":840, // pla123 // IR bit6 used only to detect branch type
"~op-branch-bit6":840, // automatic alias replacing hash with tilde
"op-T3-mem-abs":607, // pla124
"op-T2-mem-zp":219, // pla125
"op-T5-mem-ind-idx":1385, // pla126
"op-T4-mem-abs-idx":281, // pla127
"#op-branch-bit7":1174, // pla128 // IR bit7 used only to detect branch type
"~op-branch-bit7":1174, // automatic alias replacing hash with tilde
"op-clv":1164, // pla129
"op-implied":1006, // pla130 // has extra pulldowns: pla121 and ir0
// internal signals: derived from pla outputs
"#op-branch-done": 1048,
"~op-branch-done": 1048, // automatic alias replacing hash with tilde
"#op-T3-branch": 1708,
"~op-T3-branch": 1708, // automatic alias replacing hash with tilde
"op-ANDS": 1228,
"op-EORS": 1689,
"op-ORS": 522,
"op-SUMS": 1196,
"op-SRS": 934,
"#op-store": 925,
"~op-store": 925, // automatic alias replacing hash with tilde
"#WR": 1352,
"~WR": 1352, // automatic alias replacing hash with tilde
"op-rmw": 434,
"short-circuit-idx-add": 1185,
"short-circuit-branch-add": 430,
"#op-set-C": 252,
"~op-set-C": 252, // automatic alias replacing hash with tilde
// internal signals: control signals
nnT2BR: 967, // doubly inverted
BRtaken: 1544, // aka #TAKEN
"#BRtaken": 1544, // aka #TAKEN
"~BRtaken": 1544, // automatic alias replacing hash with tilde
// interrupt and vector related
// internal signals and state: interrupt and vector related
// segher says:
// "P" are the latched external signals.
// "G" are the signals that actually trigger the interrupt.
// "NMIL" is to do the edge detection -- it's pretty much just a delayed NMIG.
// INTG is IRQ and NMI taken together.
IRQP: 675,
"#IRQP": 888,
"~IRQP": 888, // automatic alias replacing hash with tilde
NMIP: 1032,
"#NMIP": 297,
"~NMIP": 297, // automatic alias replacing hash with tilde
"#NMIG": 264,
"~NMIG": 264, // automatic alias replacing hash with tilde
NMIL: 1374,
RESP: 67,
RESG: 926,
VEC0: 1465,
VEC1: 1481,
"#VEC": 1134,
"~VEC": 1134, // automatic alias replacing hash with tilde
D1x1: 827, // internal signal: interrupt handler related
"brk-done": 1382, // internal signal: interrupt handler related
INTG: 1350, // internal signal: interrupt handler related
// internal state: misc pipeline state clocked by cclk (phi2)
"pipe#VEC": 1431, // latched #VEC
"pipe~VEC": 1431, // automatic alias replacing hash with tilde
"pipeT-SYNC": 537,
pipeT2out: 40,
pipeT3out: 706,
pipeT4out: 1373,
pipeT5out: 940,
pipeBRtaken: 832,
pipeIPCrelated: 832,
pipeUNK01: 1530,
pipeUNK02: 974,
pipeUNK03: 1436,
@ -577,11 +665,13 @@ pipeUNK35: 1713,
pipeUNK36: 729,
pipeUNK37: 197,
"pipe#WR.phi2": 1131,
"pipe~WR.phi2": 1131, // automatic alias replacing hash with tilde
pipeUNK39: 151,
pipeUNK40: 456,
pipeUNK41: 1438,
pipeUNK42: 1104,
"pipe#T0": 554, // aka #T0.phi2
"pipe~T0": 554, // automatic alias replacing hash with tilde
// internal state: vector address pulldown control
pipeVectorA0: 357,
@ -628,53 +718,91 @@ DC34: 1372, // lower nibble decimal carry
DC78: 333, // carry for decimal mode
"DC78.phi2": 164,
"#C01": 1506,
"~C01": 1506, // automatic alias replacing hash with tilde
"#C12": 1122,
"~C12": 1122, // automatic alias replacing hash with tilde
"#C23": 1003,
"~C23": 1003, // automatic alias replacing hash with tilde
"#C34": 1425,
"~C34": 1425, // automatic alias replacing hash with tilde
"#C45": 1571,
"~C45": 1571, // automatic alias replacing hash with tilde
"#C56": 427,
"~C56": 427, // automatic alias replacing hash with tilde
"#C67": 592,
"~C67": 592, // automatic alias replacing hash with tilde
"#C78": 1327,
"~C78": 1327, // automatic alias replacing hash with tilde
"DA-C01": 623,
"DA-AB2": 216,
"DA-AxB2": 516,
"DA-C45": 1144,
"#DA-ADD1": 901,
"~DA-ADD1": 901, // automatic alias replacing hash with tilde
"#DA-ADD2": 699,
"~DA-ADD2": 699, // automatic alias replacing hash with tilde
// misc alu internals
"#(AxBxC)0": 371,
"~(AxBxC)0": 371, // automatic alias replacing hash with tilde
"#(AxBxC)1": 965,
"~(AxBxC)1": 965, // automatic alias replacing hash with tilde
"#(AxBxC)2": 22,
"~(AxBxC)2": 22, // automatic alias replacing hash with tilde
"#(AxBxC)3": 274,
"~(AxBxC)3": 274, // automatic alias replacing hash with tilde
"#(AxBxC)4": 651,
"~(AxBxC)4": 651, // automatic alias replacing hash with tilde
"#(AxBxC)5": 486,
"~(AxBxC)5": 486, // automatic alias replacing hash with tilde
"#(AxBxC)6": 1197,
"~(AxBxC)6": 1197, // automatic alias replacing hash with tilde
"#(AxBxC)7": 532,
"~(AxBxC)7": 532, // automatic alias replacing hash with tilde
AxB1: 425,
AxB3: 640,
AxB5: 1220,
AxB7: 1241,
"#(AxB)0": 1525,
"~(AxB)0": 1525, // automatic alias replacing hash with tilde
"#(AxB)2": 701,
"~(AxB)2": 701, // automatic alias replacing hash with tilde
"#(AxB)4": 308,
"~(AxB)4": 308, // automatic alias replacing hash with tilde
"#(AxB)6": 1459,
"~(AxB)6": 1459, // automatic alias replacing hash with tilde
"(AxB)0.#C0in": 555,
"(AxB)0.~C0in": 555, // automatic alias replacing hash with tilde
"(AxB)2.#C12": 193,
"(AxB)2.~C12": 193, // automatic alias replacing hash with tilde
"(AxB)4.#C34": 65,
"(AxB)4.~C34": 65, // automatic alias replacing hash with tilde
"(AxB)6.#C56": 174,
"(AxB)6.~C56": 174, // automatic alias replacing hash with tilde
"#(AxB1).C01": 295,
"~(AxB1).C01": 295, // automatic alias replacing hash with tilde
"#(AxB3).C23": 860,
"~(AxB3).C23": 860, // automatic alias replacing hash with tilde
"#(AxB5).C45": 817,
"~(AxB5).C45": 817, // automatic alias replacing hash with tilde
"#(AxB7).C67": 1217,
"~(AxB7).C67": 1217, // automatic alias replacing hash with tilde
"#A.B0": 1628,
"~A.B0": 1628, // automatic alias replacing hash with tilde
"#A.B1": 841,
"~A.B1": 841, // automatic alias replacing hash with tilde
"#A.B2": 681,
"~A.B2": 681, // automatic alias replacing hash with tilde
"#A.B3": 350,
"~A.B3": 350, // automatic alias replacing hash with tilde
"#A.B4": 1063,
"~A.B4": 1063, // automatic alias replacing hash with tilde
"#A.B5": 477,
"~A.B5": 477, // automatic alias replacing hash with tilde
"#A.B6": 336,
"~A.B6": 336, // automatic alias replacing hash with tilde
"#A.B7": 1318,
"~A.B7": 1318, // automatic alias replacing hash with tilde
"A+B0": 693,
"A+B1": 1021,
"A+B2": 110,
@ -684,34 +812,61 @@ AxB7: 1241,
"A+B6": 803,
"A+B7": 117,
"#(A+B)0": 143,
"~(A+B)0": 143, // automatic alias replacing hash with tilde
"#(A+B)1": 155,
"~(A+B)1": 155, // automatic alias replacing hash with tilde
"#(A+B)2": 1691,
"~(A+B)2": 1691, // automatic alias replacing hash with tilde
"#(A+B)3": 649,
"~(A+B)3": 649, // automatic alias replacing hash with tilde
"#(A+B)4": 404,
"~(A+B)4": 404, // automatic alias replacing hash with tilde
"#(A+B)5": 1632,
"~(A+B)5": 1632, // automatic alias replacing hash with tilde
"#(A+B)6": 1084,
"~(A+B)6": 1084, // automatic alias replacing hash with tilde
"#(A+B)7": 1398,
"~(A+B)7": 1398, // automatic alias replacing hash with tilde
"#(AxB)0": 1525,
"~(AxB)0": 1525, // automatic alias replacing hash with tilde
"#(AxB)2": 701,
"~(AxB)2": 701, // automatic alias replacing hash with tilde
"#(AxB)4": 308,
"~(AxB)4": 308, // automatic alias replacing hash with tilde
"#(AxB)6": 1459,
"~(AxB)6": 1459, // automatic alias replacing hash with tilde
"#(AxB)1": 953,
"~(AxB)1": 953, // automatic alias replacing hash with tilde
"#(AxB)3": 884,
"~(AxB)3": 884, // automatic alias replacing hash with tilde
"#(AxB)5": 1469,
"~(AxB)5": 1469, // automatic alias replacing hash with tilde
"#(AxB)7": 177,
"~(AxB)7": 177, // automatic alias replacing hash with tilde
"#aluresult0": 957, // alu result latch input
"~aluresult0": 957, // automatic alias replacing hash with tilde
"#aluresult1": 250,
"~aluresult1": 250, // automatic alias replacing hash with tilde
"#aluresult2": 740,
"~aluresult2": 740, // automatic alias replacing hash with tilde
"#aluresult3": 1071,
"~aluresult3": 1071, // automatic alias replacing hash with tilde
"#aluresult4": 296,
"~aluresult4": 296, // automatic alias replacing hash with tilde
"#aluresult5": 277,
"~aluresult5": 277, // automatic alias replacing hash with tilde
"#aluresult6": 722,
"~aluresult6": 722, // automatic alias replacing hash with tilde
"#aluresult7": 304,
"~aluresult7": 304, // automatic alias replacing hash with tilde
// internal signals: datapath control signals
"ADL/ABL": 639, // load ABL latches from ADL bus
"dpc-1_ADL/ABL": 639,// alias for DPControl pseudo-bus
"ADH/ABH": 821, // load ABH latches from ADH bus
"dpc-2_ADH/ABH": 821,// alias for DPControl pseudo-bus
dpc0_YSB: 801, // drive sb from y
dpc1_SBY: 325, // load y from sb
@ -735,6 +890,7 @@ dpc17_SUMS: 921, // alu op: a plus b (?)
alucin: 910, // alu carry in
notalucin: 1165,
"dpc18_#DAA": 1201, // decimal related (inverted)
"dpc18_~DAA": 1201, // automatic alias replacing hash with tilde
dpc19_ADDSB7: 214, // alu to sb bit 7 only
dpc20_ADDSB06: 129, // alu to sb bits 6-0 only
@ -742,14 +898,21 @@ dpc21_ADDADL: 1015, // alu to adl
alurawcout: 808, // alu raw carry out (no decimal adjust)
notalucout: 412, // alu carry out (inverted)
alucout: 1146, // alu carry out (latched by phi2)
"#alucout": 206,
"~alucout": 206, // automatic alias replacing hash with tilde
"##alucout": 465,
"~~alucout": 465, // automatic alias replacing hash with tilde
notaluvout: 1308, // alu overflow out
aluvout: 938, // alu overflow out (latched by phi2)
"#DBZ": 1268, // internal signal: not (databus is zero)
"~DBZ": 1268, // automatic alias replacing hash with tilde
DBZ: 744, // internal signal: databus is zero
DBNeg: 1200, // internal signal: databus is negative (top bit of db) aka P-#DB7in
DBNeg: 1200, // automatic alias replacing hash with tilde
"dpc22_#DSA": 725, // decimal related/SBC only (inverted)
"dpc22_~DSA": 725, // automatic alias replacing hash with tilde
dpc23_SBAC: 534, // (optionalls decimal-adjusted) sb to acc
dpc24_ACSB: 1698, // acc to sb
dpc25_SBDB: 1060, // sb pass-connects to idb (bi-directionally)
@ -763,8 +926,9 @@ dpc31_PCHPCH: 741, // load pch from pch incremented
dpc32_PCHADH: 1235, // drive adh from pch incremented
dpc33_PCHDB: 247, // drive idb from pch incremented
dpc34_PCLC: 1704, // pch carry in and pcl FF detect?
dpc35_PCHC: 1334, // pcl 0x?F detect - half-carry
dpc36_IPC: 379, // pcl carry in
dpc35_PCHC: 1334, // pch 0x?F detect - half-carry
"dpc36_#IPC": 379, // pcl carry in (inverted)
"dpc36_~IPC": 379, // automatic alias replacing hash with tilde
dpc37_PCLDB: 283, // drive idb from pcl incremented
dpc38_PCLADL: 438, // drive adl from pcl incremented
dpc39_PCLPCL: 898, // load pcl from pcl incremented

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@ var ngnd = nodenames['vss'];
var npwr = nodenames['vcc'];
var chipLayoutIsVisible = true; // only modified in expert mode
var hilited = [];
function setupNodes(){
for(var i in segdefs){
@ -140,6 +141,7 @@ function refresh(){
for(i in nodes){
if(isNodeHigh(i)) overlayNode(nodes[i].segs);
}
hiliteNode(hilited);
}
function overlayNode(w){
@ -156,6 +158,7 @@ function hiliteNode(n){
var ctx = hilite.getContext('2d');
ctx.clearRect(0,0,grCanvasSize,grCanvasSize);
if(n==-1) return;
hilited = n;
for(var i in n){
if(typeof n[i] != "number") {
@ -201,18 +204,33 @@ function ctxDrawBox(ctx, xMin, yMin, xMax, yMax){
function zoomToBox(xmin,xmax,ymin,ymax){
var xmid=(xmin+xmax)/2;
var ymid=(ymin+ymax)/2;
var x=(xmid+400)/grChipSize*600;
var y=600-ymid/grChipSize*600;
var zoom=5; // pending a more careful calculation
var x=(xmid+grChipOffsetX)/grChipSize*600;
var y=600-(ymid-grChipOffsetY)/grChipSize*600;
// Zoom to fill 80% of the window with the selection
var fillfactor=0.80;
var dx=xmax-xmin;
var dy=ymax-ymin;
if (dx < 1) dx=1;
if (dy < 1) dy=1;
var zx=(800/600)*fillfactor*grChipSize/dx;
var zy=fillfactor*grChipSize/dy;
var zoom=Math.min(zx,zy);
if (zoom < 1) {
zoom = 1;
}
if (zoom > grMaxZoom) {
zoom = grMaxZoom;
}
moveHere([x,y,zoom]);
}
function drawSeg(ctx, seg){
var dx = 400;
var dx = grChipOffsetX;
var dy = grChipOffsetY;
ctx.beginPath();
ctx.moveTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]));
for(var i=2;i<seg.length;i+=2) ctx.lineTo(grScale(seg[i]+dx), grScale(grChipSize-seg[i+1]));
ctx.lineTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]));
ctx.moveTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]+dy));
for(var i=2;i<seg.length;i+=2) ctx.lineTo(grScale(seg[i]+dx), grScale(grChipSize-seg[i+1]+dy));
ctx.lineTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]+dy));
}
function findNodeNumber(x,y){