1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-25 23:49:17 +00:00

Update spec.

This commit is contained in:
Chris Pressey 2015-10-16 18:39:38 +01:00
parent 8ccabdf202
commit 4fc38be387
2 changed files with 36 additions and 50 deletions

View File

@ -35,15 +35,16 @@ For 0.2:
For 0.3: For 0.3:
* explicitly-addressed memory locations. * extern routines.
* generate 6502 code (either Ophis assembler or machine code `PRG` files.) * generate 6502 code (either Ophis assembler or machine code `PRG` files.)
* `while` loops. * `while` loops.
* `repeat` loops.
* a little demo that actually compiles and runs on a C64 emulator. * a little demo that actually compiles and runs on a C64 emulator.
* add line number (or at least routine name) to error messages.
For 0.4 and/or beyond: For 0.4 and/or beyond:
* explicitly-addressed memory locations
* `repeat` loops.
* add line number (or at least routine name) to error messages.
* hexadecimal literals. * hexadecimal literals.
* `word` type. * `word` type.
* `table` type constructor and indirect addressing. * `table` type constructor and indirect addressing.

View File

@ -258,74 +258,55 @@ Notes:
cmp x, 1 → CPX #1 cmp x, 1 → CPX #1
cmp y, 1 → CPY #1 cmp y, 1 → CPY #1
- - - - ### and, or, xor ###
### and ###
and <dest-memory-location>, <src-memory-location> and <dest-memory-location>, <src-memory-location>
or <dest-memory-location>, <src-memory-location>
xor <dest-memory-location>, <src-memory-location>
"AND"s the contents of src with dest and stores the result in dest. Applies the given bitwise Boolean operation to src and dest and stores
the result in dest.
The constraints are the same as for `cmp`, except that the `c` flag * It is illegal if src OR dest OR is uninitialized.
is not affected. i.e. only `n` and `z` flags are affected. * It is illegal if dest is read-only.
* It is illegal if dest does not occur in the WRITES lists
of the current routine.
Affects n and z flags, requiring that they be in the WRITES lists of the
current routine, and sets them as initialized afterwards.
dest and src continue to be initialized afterwards.
Notes: Notes:
and a, 8 → AND #8 and a, 8 → AND #8
### or ###
or <dest-memory-location>, <src-memory-location>
"OR"s the contents of src with dest and stores the result in dest.
The constraints and effects are exactly the same as for `and`.
Notes:
or a, 8 → ORA #8 or a, 8 → ORA #8
### xor ###
xor <dest-memory-location>, <src-memory-location>
"XOR"s the contents of src with dest and stores the result in dest.
The constraints and effects are exactly the same as for `and`.
Notes:
xor a, 8 → EOR #8 xor a, 8 → EOR #8
### shl ### ### shl, shr ###
shl <dest-memory-location> shl <dest-memory-location>
shr <dest-memory-location>
Shifts the dest left one bit position. The rightmost position becomes `c`, `shl` shifts the dest left one bit position. The rightmost position becomes `c`,
and `c` becomes the bit that was shifted off the left. and `c` becomes the bit that was shifted off the left.
`shr` shifts the dest right one bit position. The leftmost position becomes `c`,
and `c` becomes the bit that was shifted off the right.
* It is illegal if dest is a register besides `a`. * It is illegal if dest is a register besides `a`.
* It is illegal if dest is read-only. * It is illegal if dest is read-only.
* It is illegal if dest OR c is uninitialized. * It is illegal if dest OR c is uninitialized.
* It is illegal if dest does not occur in the WRITES AND READS lists * It is illegal if dest does not occur in the WRITES lists
of the current routine. of the current routine.
Affects the c flag, requiring that it be in the WRITES lists of the
current routine, and it continues to be initialized afterwards.
Notes: Notes:
shl a → ROL A shl a → ROL A
shl lives → ROL LIVES shl lives → ROL LIVES
### shr ###
shr <dest-memory-location>
Shifts the dest right one bit position. The leftmost position becomes `c`,
and `c` becomes the bit that was shifted off the right.
Constraints are exactly the same as for `shl`.
Notes:
shr a → ROR A shr a → ROR A
shr lives → ROR LIVES shr lives → ROR LIVES
@ -335,18 +316,22 @@ Notes:
Just before the call, Just before the call,
* It is illegal if any of the memory locations in the routine's READS list is * It is illegal if any of the memory locations in the called routine's
uninitialized. READS list is uninitialized.
Just after the call, Just after the call,
* All memory locations listed as TRASHED in the routine's WRITES list are * All memory locations listed as TRASHED in the called routine's WRITES
considered uninitialized. list are considered uninitialized.
* All memory locations listed as TRASHED in the called routine's OUTPUTS
list are considered initialized.
Notes: Notes:
call routine → JSR ROUTINE call routine → JSR ROUTINE
- - - -
### if ### ### if ###
if (bit) { if (bit) {