git @ Cat's Eye Technologies SixtyPical / cfd99c6
Tweaks to README. Cat's Eye Technologies 7 years ago
1 changed file(s) with 15 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
66 It is a **work in progress**, currently at the **proof-of-concept** stage.
77
88 It is expected that a common use case for SixtyPical would be retroprogramming
9 for the Commodore 64 and other 6502-based computers such as the VIC-20.
9 for the Commodore 64 and other 6502-based computers such as the VIC-20, the
10 Apple ][+, and the NES.
1011
1112 Many SixtyPical instructions map precisely to 6502 opcodes. However, SixtyPical
1213 is not an assembly language: the programmer does not have total control over
2829 If you have `ghc`, Ophis, and VICE 2.4 installed, clone this repo, `cd` into it,
2930 and run
3031
31 ./loadngo.sh eg/demo.60p
32 ./loadngo.sh eg/game.60p
3233
3334 The Big Idea(s)
3435 ---------------
4445 reserve byte lives
4546 reserve word score
4647 routine do_it {
47 lda score ; no! can't treat word as if it were a byte
48 lda lives, x ; no! can't treat a byte as if it were a table
48 lda score // no! can't treat word as if it were a byte
49 lda lives, x // no! can't treat a byte as if it were a table
4950 }
5051
5152 ### Abstract Interpretation ###
5960 routine do_it {
6061 lda #0
6162 jsr update_score
62 sta vic_border_colour ; uh... what do we know about reg A here?
63 sta vic_border_colour // uh... what do we know about reg A here?
6364 }
6465
6566 ...is illegal *unless* one of the following is true:
6667
6768 * the A register is declared to be a meaningful output of `update_score`
68 * `update_score` was determined to not change the value of the A register
69 * `update_score` was analyzed and determined to not change the value of the
70 A register
6971
7072 The first case must be done with an explicit declaration on `update_score`.
7173 The second case will be be inferred using abstract interpretation of the code
151153 --------------------
152154
153155 For more information, see the docs (which are written in the form of
154 Falderal literate test suites. If you have Falderal installed, you can run
155 the tests with `./test.sh`.)
156 [Falderal](http://catseye.tc/node/Falderal) literate test suites. If you
157 have `falderal` on your executable search path, you can run the tests with
158 `./test.sh`.)
156159
157160 * [Checking](https://github.com/catseye/SixtyPical/blob/master/doc/Checking.markdown)
158161 * [Analyzing](https://github.com/catseye/SixtyPical/blob/master/doc/Analyzing.markdown)
163166 ---------
164167
165168 Some (OK, a lot) of the Haskell code is kind of gross and non-idiomatic.
166 The parser, in particular, would not be described as "elegant". There
169 The parser, in particular, could not be described as "elegant". There
167170 could definitely be more higher-order functions defined and used. At the
168171 same time, I'm really not a fan of pointless style — I prefer it when things
169172 are written out explicitly and pedantically. Still, there are places where
173176 are translated into an intermediate representation which is arguably CISC-like.
174177 For example, `lda`, `sta`, `ldx`, and `tax` all become kinds of `COPY`
175178 internally. This internal instruction set is much smaller than the 6502's,
176 and thus is usually easier to analyze.
179 and thus is usually easier to analyze. It would also be easier to adapt to
180 other instruction sets, such as the Z80 or the 8086.
177181
178182 Notes
179183 -----
213217 * Addressing modes — indexed mode on more instructions
214218 * Rename and lift temporaries in nested blocks
215219 * Tail-recursion optimization
220 * `word 100` to promote an otherwise 8-bit literal to a 16-bit value
216221 * `jmp routine`
217222 * Enforce that `jmp`s come at ends of blocks(?)
218223 * `outputs` on externals