git @ Cat's Eye Technologies SixtyPical / 7f38d04
Documentation updates. Chris Pressey 3 years ago
4 changed file(s) with 41 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
55
66 * Added the so-called "open-faced `for` loop", which spans a loop
77 variable over a range, the end of which is fixed.
8 * `--origin` and `--output-format` options added to reference compiler.
98 * "Tail position" is now more correctly determined for the purposes of
109 insisting that `goto` only appears in it.
10 * New `--origin` and `--output-format` options added to the compiler.
1111 * Fixed bug when `--prelude` option was missing.
1212 * Fixed bug when reporting line numbers of scanner-level syntax errors.
13 * Translated the small demo project Ribos and "The PETulant Cursor"
14 to SixtyPical and added them to the `eg/c64/` section of the repo.
13 * Translated the small demo projects Ribos and "The PETulant Cursor" to
14 SixtyPical, and added them to the `eg/c64/` section of the repo.
1515
1616 0.13
1717 ----
22
33 _Version 0.14. Work-in-progress, everything is subject to change._
44
5 **SixtyPical** is a 6502-assembly-like programming language with advanced
5 **SixtyPical** is a 6502-like programming language with advanced
66 static analysis.
77
8 "6502-assembly-like" means that it has similar restrictions as programming
8 "6502-like" means that it has similar restrictions as programming
99 in 6502 assembly (e.g. the programmer must choose the registers that
1010 values will be stored in) and is concomitantly easy for a compiler to
1111 translate it to 6502 machine language code.
1414 go through the program step by step, tracking not just the changes that
1515 happen during a _specific_ execution of the program, but _sets_ of changes
1616 that could _possibly_ happen in any run of the program. This lets us
17 determine that certain things can never happen, which we can present as
18 safety guarantees.
17 determine that certain things can never happen, which we can then formulate
18 as safety checks.
1919
2020 In practice, this means it catches things like
2121
5050 ![Screenshot of result of running hearts.60p](https://raw.github.com/catseye/SixtyPical/master/images/hearts.png)
5151
5252 You can try the `loadngo.sh` script on other sources in the `eg` directory
53 tree. There is an entire small game(-like program) in [demo-game.60p](eg/c64/demo-game/demo-game.60p).
53 tree, which contains more extensive examples, including an entire
54 game(-like program); see [eg/README.md](eg/README.md) for a listing.
5455
5556 Documentation
5657 -------------
00 SixtyPical
11 ==========
22
3 This document describes the SixtyPical programming language version 0.11,
3 This document describes the SixtyPical programming language version 0.14,
44 both its static semantics (the capabilities and limits of the static
55 analyses it defines) and its runtime semantics (with reference to the
66 semantics of 6502 machine code.)
233233 are considered initialized after it has executed.
234234
235235 If and only if src is a byte table, the index-memory-location must be given.
236 In this case, it is illegal if the value of the index-memory-location falls
237 outside of the range of the table.
236238
237239 Some combinations, such as `ld x, y`, are illegal because they do not map to
238 underlying opcodes.
240 underlying opcodes. (For an instruction which maps more flexibly to underlying
241 opcodes, see `copy`.)
239242
240243 There is another mode of `ld` which reads into `a` indirectly through a pointer.
241244
264267 changed by this instruction (unless of course dest is a flag.)
265268
266269 If and only if dest is a byte table, the index-memory-location must be given.
270 In this case, it is illegal if the value of the index-memory-location falls
271 outside of the range of the table.
267272
268273 There is another mode of `st` which write `a` into memory, indirectly through
269274 a pointer.
570575 LocExpr ::= Register | Flag | Literal | Ident.
571576 Register::= "a" | "x" | "y".
572577 Flag ::= "c" | "z" | "n" | "v".
573 Literal ::= LitByte | LitWord.
578 Literal ::= LitByte | LitWord | LitBit.
574579 LitByte ::= "0" ... "255".
575580 LitWord ::= "0" ... "65535".
581 LitBit ::= "on" | "off".
576582 Block ::= "{" {Instr} "}".
577583 Instr ::= "ld" LocExpr "," LocExpr ["+" LocExpr]
578584 | "st" LocExpr "," LocExpr ["+" LocExpr]
588594 | "dec" LocExpr
589595 | "call" Ident<routine>
590596 | "goto" Ident<executable>
597 | "copy" LocExpr "," LocExpr ["+" LocExpr]
591598 | "if" ["not"] LocExpr Block ["else" Block]
592599 | "repeat" Block ("until" ["not"] LocExpr | "forever")
593 | "copy" LocExpr "," LocExpr ["+" LocExpr]
600 | "for" LocExpr ("up"|"down") "to" Literal Block
601 | "with" "interrupts" LitBit Block
594602 .
0 This directory contains SixtyPical example programs, categorized
1 in subdirectories by the machine architecture.
2
3 In the [c64](c64/) directory are programs that run on the Commodore 64:
4
5 * [demo-game](c64/demo-game/): a little game-like program written as a
6 "can we write something you'd see in practice?" test case for SixtyPical.
7 * [ribos](c64/ribos/): a well-commented example of a C64 raster interrupt
8 routine. Originally written with the P65 assembler (now Ophis).
9 The second version of it has been translated to SixtyPical.
10 * [petulant](c64/petulant/) -- "The PETulant Cursor", a tiny (44 bytes)
11 "display hack". Originally written in the late 80's. Rewritten with
12 the P65 assembler (now Ophis) and re-released April 1, 2008 (a
13 hint as to its nature). Translated to SixtyPical, it's 48 bytes.
14
15 In the [rudiments](rudiments/) directory are programs which are not for
16 any particular machine, but meant to demonstrate the features of SixtyPical.
17 Some are meant to fail and produce an error message. Others can run on
18 any architecture where there is a routine at 65490 which outputs the value
19 of the accumulator as an ASCII character.