git @ Cat's Eye Technologies SixtyPical / a765a50
Notes on `compare`. Chris Pressey 6 years ago
3 changed file(s) with 8 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
33 0.18
44 ----
55
6 * Added `compare` instruction, which is like `cmp` but can
7 directly compare two `word` memory locations (trashing `a`.)
68 * Fixed pathological memory use in the lexical scanner - should
79 be much less inefficient now when parsing large source files.
810
00 TODO for SixtyPical
11 ===================
2
3 ### 16-bit `cmp`
4
5 This is because we don't actually want `low` and `high` address operators
6 that turn `word` type into `byte`.
7
8 This is because this immediately makes things harder (that is, effectively
9 impossible) to analyze.
10
11 16-bit `cmp` also benefits from some special differences between `cmp`
12 and `sub` on 6502, so it would be nice to capture them.
132
143 ### Save values to other-than-the-stack
154
413413
414414 Affects n, z, and c flags, requiring that they be in the WRITES,
415415 and initializing them afterwards.
416
417 Note that, like `cmp`, `compare` is not suitable for making a
418 signed comparison; this article, which mentions
419 techniques that a SixtyPical compiler could use to
420 implement `compare`, also explains why that is:
421 [Beyond 8-bit Unsigned Comparisons, by Bruce Clark](http://www.6502.org/tutorials/compare_beyond.html).
416422
417423 ### and, or, xor ###
418424