git @ Cat's Eye Technologies SixtyPical / 4fc38be
Update spec. Chris Pressey 6 years ago
2 changed file(s) with 40 addition(s) and 54 deletion(s). Raw diff Collapse all Expand all
3434
3535 For 0.3:
3636
37 * explicitly-addressed memory locations.
37 * extern routines.
3838 * generate 6502 code (either Ophis assembler or machine code `PRG` files.)
3939 * `while` loops.
40 * `repeat` loops.
4140 * a little demo that actually compiles and runs on a C64 emulator.
42 * add line number (or at least routine name) to error messages.
4341
4442 For 0.4 and/or beyond:
4543
44 * explicitly-addressed memory locations
45 * `repeat` loops.
46 * add line number (or at least routine name) to error messages.
4647 * hexadecimal literals.
4748 * `word` type.
4849 * `table` type constructor and indirect addressing.
257257 cmp x, 1 → CPX #1
258258 cmp y, 1 → CPY #1
259259
260 - - - -
261
262 ### and ###
260 ### and, or, xor ###
263261
264262 and <dest-memory-location>, <src-memory-location>
265
266 "AND"s the contents of src with dest and stores the result in dest.
267
268 The constraints are the same as for `cmp`, except that the `c` flag
269 is not affected. i.e. only `n` and `z` flags are affected.
263 or <dest-memory-location>, <src-memory-location>
264 xor <dest-memory-location>, <src-memory-location>
265
266 Applies the given bitwise Boolean operation to src and dest and stores
267 the result in dest.
268
269 * It is illegal if src OR dest OR is uninitialized.
270 * It is illegal if dest is read-only.
271 * It is illegal if dest does not occur in the WRITES lists
272 of the current routine.
273
274 Affects n and z flags, requiring that they be in the WRITES lists of the
275 current routine, and sets them as initialized afterwards.
276
277 dest and src continue to be initialized afterwards.
270278
271279 Notes:
272280
273281 and a, 8 → AND #8
274
275 ### or ###
276
277 or <dest-memory-location>, <src-memory-location>
278
279 "OR"s the contents of src with dest and stores the result in dest.
280
281 The constraints and effects are exactly the same as for `and`.
282
283 Notes:
284
285282 or a, 8 → ORA #8
286
287 ### xor ###
288
289 xor <dest-memory-location>, <src-memory-location>
290
291 "XOR"s the contents of src with dest and stores the result in dest.
292
293 The constraints and effects are exactly the same as for `and`.
294
295 Notes:
296
297283 xor a, 8 → EOR #8
298284
299 ### shl ###
285 ### shl, shr ###
300286
301287 shl <dest-memory-location>
302
303 Shifts the dest left one bit position. The rightmost position becomes `c`,
288 shr <dest-memory-location>
289
290 `shl` shifts the dest left one bit position. The rightmost position becomes `c`,
304291 and `c` becomes the bit that was shifted off the left.
305292
293 `shr` shifts the dest right one bit position. The leftmost position becomes `c`,
294 and `c` becomes the bit that was shifted off the right.
295
306296 * It is illegal if dest is a register besides `a`.
307297 * It is illegal if dest is read-only.
308298 * It is illegal if dest OR c is uninitialized.
309 * It is illegal if dest does not occur in the WRITES AND READS lists
310 of the current routine.
299 * It is illegal if dest does not occur in the WRITES lists
300 of the current routine.
301
302 Affects the c flag, requiring that it be in the WRITES lists of the
303 current routine, and it continues to be initialized afterwards.
311304
312305 Notes:
313306
314307 shl a → ROL A
315308 shl lives → ROL LIVES
316
317 ### shr ###
318
319 shr <dest-memory-location>
320
321 Shifts the dest right one bit position. The leftmost position becomes `c`,
322 and `c` becomes the bit that was shifted off the right.
323
324 Constraints are exactly the same as for `shl`.
325
326 Notes:
327
328309 shr a → ROR A
329310 shr lives → ROR LIVES
330311
334315
335316 Just before the call,
336317
337 * It is illegal if any of the memory locations in the routine's READS list is
338 uninitialized.
318 * It is illegal if any of the memory locations in the called routine's
319 READS list is uninitialized.
339320
340321 Just after the call,
341322
342 * All memory locations listed as TRASHED in the routine's WRITES list are
343 considered uninitialized.
323 * All memory locations listed as TRASHED in the called routine's WRITES
324 list are considered uninitialized.
325 * All memory locations listed as TRASHED in the called routine's OUTPUTS
326 list are considered initialized.
344327
345328 Notes:
346329
347330 call routine → JSR ROUTINE
331
332 - - - -
348333
349334 ### if ###
350335