Notes on `compare`.
Chris Pressey
6 years ago
3 | 3 |
0.18
|
4 | 4 |
----
|
5 | 5 |
|
|
6 |
* Added `compare` instruction, which is like `cmp` but can
|
|
7 |
directly compare two `word` memory locations (trashing `a`.)
|
6 | 8 |
* Fixed pathological memory use in the lexical scanner - should
|
7 | 9 |
be much less inefficient now when parsing large source files.
|
8 | 10 |
|
0 | 0 |
TODO for SixtyPical
|
1 | 1 |
===================
|
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.
|
13 | 2 |
|
14 | 3 |
### Save values to other-than-the-stack
|
15 | 4 |
|
413 | 413 |
|
414 | 414 |
Affects n, z, and c flags, requiring that they be in the WRITES,
|
415 | 415 |
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).
|
416 | 422 |
|
417 | 423 |
### and, or, xor ###
|
418 | 424 |
|