1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-14 23:29:29 +00:00
Commit Graph

235 Commits

Author SHA1 Message Date
Chris Pressey
7a3b52dc1e More correct determination of tail position for purposes of goto. 2018-03-13 17:00:49 +00:00
Chris Pressey
5f62de11c2 Add failing test for multiple gotos that are all in tail position. 2018-03-13 13:33:30 +00:00
Chris Pressey
f73a2313bd Add some failing tests for analyzing "for". 2018-03-08 17:17:49 +00:00
Chris Pressey
d815e05e0c Syntax for "open-faced for loop". 2018-03-08 16:54:12 +00:00
Chris Pressey
72efecbb1a Support different preludes for different archs (c64 and vic20 now.) 2018-03-06 17:00:39 +00:00
Chris Pressey
bda0202dee Confirm that AND clips the range and INC/DEC invalidate it. 2018-03-06 15:42:12 +00:00
Chris Pressey
1eaec602e3 The exception object now contains an AST node, renders name. 2018-03-06 14:39:47 +00:00
Chris Pressey
e44c802314 Syntax errors have line numbers in them now. 2018-03-06 12:23:57 +00:00
Chris Pressey
d24e9fa2e1 I can no longer see a reason to require that it is a power of two. 2018-03-05 10:38:20 +00:00
Chris Pressey
15fa4889e7 Add some more tests (failing currently). 2018-02-16 12:28:11 +00:00
Chris Pressey
0687da80d5 Some headway on context.assert_in_range(). 2018-02-14 15:54:57 +00:00
Chris Pressey
93e2dada16 Check for table size (in parser, thus tests are for syntax.) 2018-02-14 13:53:22 +00:00
Chris Pressey
aa5b06980c Add some initial failing tests. 2018-02-14 13:41:48 +00:00
Chris Pressey
f6fa1ec7d2 Remove need for forward keyword in forward reference in copy. 2018-02-12 15:59:20 +00:00
Chris Pressey
08ec0e46a3 Remove the need for parens in vector (routine ...) table type. 2018-02-12 14:53:49 +00:00
Chris Pressey
7a024f3062 Compile static storage location access. 2018-02-09 16:13:09 +00:00
Chris Pressey
71cded0297 Move compiler towards being able to compile access to statics. 2018-02-09 14:13:39 +00:00
Chris Pressey
55331e9c54 Statics are always writeable. Statics are always meaningful. 2018-02-09 13:35:59 +00:00
Chris Pressey
b829836cdc Ability to parse static definitions and look them up. 2018-02-09 12:33:45 +00:00
Chris Pressey
ca1c877a60 Support indirect refs in st, e.g. st a, [ptr] + y. 2018-02-09 11:23:18 +00:00
Chris Pressey
b20b664748 Implement the "union rule for trashes" when analyzing if blocks. 2018-02-08 14:04:51 +00:00
Chris Pressey
3f1f3bf16e Set a location as touched when trashed with a trash instruction. 2018-02-08 13:43:06 +00:00
Chris Pressey
f4befb45d3 Add more tests, which show inconsistent treatment of trashes. 2018-02-08 13:34:03 +00:00
Chris Pressey
cde2824c44 Articulate the "union rule" for trashes in if, add failing tests. 2018-02-08 12:46:28 +00:00
Chris Pressey
f92e1f15bf Tired: copy [ptr]+y, a. Wired: ld a, [ptr]+y. 2018-02-08 11:58:24 +00:00
Chris Pressey
34daad0e56 Make ld parse to a IndexedRef or IndirectRef (latter still todo.) 2018-02-08 11:04:11 +00:00
Chris Pressey
7c8f113c07 Properly store address (not contents) of routine into vector table. 2018-02-07 13:56:17 +00:00
Chris Pressey
6c1c1cb153 Include final RTS when emitting trampolines for indirect calls. 2018-02-07 11:11:14 +00:00
Chris Pressey
b4f5d60ad3 I think it should actually look like this! 2018-02-06 17:00:04 +00:00
Chris Pressey
ed1ed3eb5d Always analyze before compiling. 2018-02-06 16:14:44 +00:00
Chris Pressey
9778e083c1 Move test, add test, add assertion. 2018-02-06 11:52:50 +00:00
Chris Pressey
70ecd52e8a Retain some syntax compatibility: make table a postfix operator. 2018-02-06 11:34:21 +00:00
Chris Pressey
612ae588f7 Add some tests, fix some bugs, show that one bug remains. 2018-02-06 10:05:56 +00:00
Chris Pressey
74f8675761 Start of typedef support. 2018-02-05 18:12:48 +00:00
Chris Pressey
0be721667a Kind-of not-pretty syntax refactor to support adding typedefs. 2018-02-05 17:01:25 +00:00
Chris Pressey
15072eff52 The evaluator doesn't add much and keeps falling behind; remove it. 2018-02-05 13:17:23 +00:00
Chris Pressey
20c824743e Fix table access bug where index wasn't required to be initialized. 2018-02-05 12:35:19 +00:00
Chris Pressey
7dfd2cfe0c Allow copying a routine directly into a vector table. 2018-02-05 12:04:28 +00:00
Chris Pressey
bbd3a84c00 Retain silly 'name inside the type' syntax (a la C) for now. 2018-02-05 11:18:35 +00:00
Chris Pressey
a082aee001 NOt 100% sure it's correct, but it seems close. 2018-02-02 17:56:50 +00:00
Chris Pressey
0fff8e4f0a Begin to implement vector tables, stuck at a type equality problem. 2018-02-02 17:45:07 +00:00
Chris Pressey
eb1974eb8a Vector tables can be parsed. 2018-02-02 17:18:25 +00:00
Chris Pressey
b29716fccf Constraints for vector come immediately after the type expression. 2018-02-02 17:16:31 +00:00
Chris Pressey
548905dce4 Initialized byte tables need not have all 256 bytes initialized. 2018-02-02 16:31:23 +00:00
Chris Pressey
f9dc730f88 copy []+y, a to indirectly read byte into the a register. 2017-12-13 16:11:02 +00:00
Chris Pressey
c7861d375c trash indicates a value is no longer considered meaningful. 2017-12-13 15:23:06 +00:00
Chris Pressey
5f535c963e Subtract word (constant or memory location) from word memory location. 2017-12-13 14:07:59 +00:00
Chris Pressey
f87bcf5ee4 Initial work on initialized byte tables. 2017-12-12 16:41:49 +00:00
Chris Pressey
50390b0787 Can copy a literal word to a word table. 2017-12-12 16:04:59 +00:00
Chris Pressey
63f75a26b4 Initialized word type memory locations. 2017-12-12 15:34:51 +00:00
Chris Pressey
4854077cce Correctly analyze repeat { ... } forever loops. 2017-12-12 15:18:59 +00:00
Chris Pressey
3417fd96c7 Apparently this hack was only needed previously due to a bug? 2017-12-12 14:55:57 +00:00
Chris Pressey
0194d37bbd forward modifier on location expression, instead of assign. 2017-12-12 14:23:34 +00:00
Chris Pressey
b7b28830d7 Introducing a new pseudo-opcode is rarely an elegant solution. 2017-12-12 14:09:17 +00:00
Chris Pressey
19dd089a03 Allow call and goto routines defined further down in the source. 2017-12-12 13:17:00 +00:00
Chris Pressey
8dc44673fa LocationRefs are equal if names/type are; this needed __str__ tho. 2017-12-12 12:45:47 +00:00
Chris Pressey
b3d2d0bfcf Clearing up a little mystery I had here. 2017-12-12 10:10:58 +00:00
Chris Pressey
ec2e051518 Constraint sets may only contain labels, which are resolved late. 2017-12-11 17:49:02 +00:00
Chris Pressey
2a71c7e247 Add failing test for a vector being able to name itself in outputs. 2017-12-11 16:57:18 +00:00
Chris Pressey
b4709268bc Check in test appliance (dcc6502-adapter) that was missed. 2017-12-11 13:46:06 +00:00
Chris Pressey
2216fcec17 copy from word storage to word table and back, indexed by x or y. 2017-12-11 12:02:48 +00:00
Chris Pressey
b86e7491d5 Copy word to word table. 2017-12-11 11:43:53 +00:00
Chris Pressey
81aeb6c3f7 Use dcc6502 to disassemble code for comparison in unit tests. 2017-12-11 11:16:27 +00:00
Chris Pressey
404f8c72a3 We really need to review how storage location labels are emitted. 2017-12-08 16:59:31 +00:00
Chris Pressey
84ca6c4e96 Break the ground where we need to implement word table read/write. 2017-12-08 15:53:18 +00:00
Chris Pressey
689ed37f2e Beginnings of implementing word tables. One test still fails. 2017-12-08 13:41:48 +00:00
Chris Pressey
ad8e0647a4 Use right endianness when copying literal word into storage. 2017-12-07 16:49:43 +00:00
Chris Pressey
75cf18d3a2 Add word (constant or memory loc) to pointer (unchecked for now). 2017-12-07 14:14:43 +00:00
Chris Pressey
a4fd0e590b Adding a word memory location to another word memory location. 2017-12-07 13:15:21 +00:00
Chris Pressey
92525fd482 Adding a constant word to a memory location. 2017-12-07 12:48:56 +00:00
Chris Pressey
cf679b293a Ability to --debug analysis. Make 16-bit addition test pass. 2017-12-07 11:49:15 +00:00
Chris Pressey
97d00637d2 Initial work on adding 16-bit constants to a 16-bit location. 2017-12-07 11:31:46 +00:00
Chris Pressey
6afbf581f7 Deal with the inputs/outputs of buffers, in a weak way. 2017-12-01 15:10:16 +00:00
Chris Pressey
d84566a880 Write stored values, and read values, through pointers. 2017-12-01 13:52:56 +00:00
Chris Pressey
32389e4422 Require that the program does ^buf to get at the address of buf. 2017-12-01 12:36:58 +00:00
Chris Pressey
19a196f765 Compile copy[]+y. 2017-11-24 16:56:55 +00:00
Chris Pressey
c8c69a2a7d Fix problem with test case, and with serializing as zero page. 2017-11-24 13:42:14 +00:00
Chris Pressey
e41dd1aa01 Attempt to add Zero Page addressing; the emitter may need rethink. 2017-11-24 13:09:10 +00:00
Chris Pressey
c91574186b First pass of buffer, pointer, copy b, [p] + y, indirect indexed. 2017-11-24 12:35:36 +00:00
Chris Pressey
42438dd97f Beginning of: buffers and pointers. 2017-11-24 11:30:20 +00:00
Chris Pressey
c33e6ef0e9 Assert that the loop variable is meaningful in repeat. Unit test. 2017-11-20 16:39:39 +00:00
Chris Pressey
b2b2582e0f Add some tests for copying literal words to word memory locations. 2017-11-20 15:53:34 +00:00
Chris Pressey
feb5729ab9 Minor changes to docs. 2017-11-20 14:10:43 +00:00
Chris Pressey
563aaeba47 Remove low/high byte operators until I've thought about it more. 2017-11-17 15:54:50 +00:00
Chris Pressey
9d6ca0b2b4 Low and high address operators, parsing and execution thereof. 2016-06-16 11:10:43 -05:00
Chris Pressey
e2daa33dc5 Compile copy byte to byte and word to word. 2016-06-16 11:10:03 -05:00
Chris Pressey
fc8c85e670 word types, with syntax and analysis thereof 2016-06-16 11:08:57 -05:00
Chris Pressey
7b1ee60a73 Initial value for locations: changed syntax, executes, compiles. 2016-06-16 11:03:31 -05:00
Chris Pressey
6cf8b5fe1e Spec and tests for initial values of locations. 2016-06-16 11:02:13 -05:00
Chris Pressey
b5763e84b4 Constants (such as routines) cannot be given in call-constraints. 2015-10-22 20:01:02 +01:00
Chris Pressey
33d72c0692 Fix tests. 2015-10-22 17:21:01 +01:00
Chris Pressey
cb2bda6afd Fix my own confusion, and with it, the unit test. 2015-10-22 09:54:11 +01:00
Chris Pressey
0361016e4c Bring the rest of the tests up to date with the new names. 2015-10-22 09:48:26 +01:00
Chris Pressey
cc433e9c64 Try to improve error messages, thus breaking many unit tests. 2015-10-21 19:43:44 +01:00
Chris Pressey
45310b8f9c It's getting a little chaotic. Needs better error messages! 2015-10-21 17:05:49 +01:00
Chris Pressey
16450e06d5 Compile goto's. 2015-10-21 15:51:52 +01:00
Chris Pressey
bb6ad5d3cf Refactor Analyzer. Get analysis tests passing once again. 2015-10-21 15:45:14 +01:00
Chris Pressey
49d07cee5f Attempt to analyze goto. Looks like it'll need some rewriting. 2015-10-21 11:41:52 +01:00
Chris Pressey
6e0ca3838e Recast Evaluator as an object. Handle goto inside it. 2015-10-20 14:39:32 +01:00
Chris Pressey
be76b9a00d Syntax for goto. 2015-10-20 14:10:33 +01:00
Chris Pressey
16649042cb I kind of forgot that indirect JSR needs a trampoline first :/ 2015-10-20 13:15:21 +01:00
Chris Pressey
2dc4dd988e Parse indirect calls, but break evaluator. 2015-10-20 09:33:30 +01:00
Chris Pressey
7d56705530 Check that the constraints on a routine match those of vector. 2015-10-19 19:17:27 +01:00
Chris Pressey
f0b8942aa1 Allow vectors to be decorated with inputs/outputs/trashes; test. 2015-10-19 13:04:08 +01:00
Chris Pressey
a12a44eadb Re-enable disabled test and fix it and add a few related tests. 2015-10-19 12:22:44 +01:00
Chris Pressey
04de73d04d Solve this by defining an Offset emittable. 2015-10-19 08:55:47 +01:00
Chris Pressey
645079f03a Implement 'with interrupts off'. 2015-10-18 23:15:40 +01:00
Chris Pressey
8b30a232fa Analyze copy, but... we now need more sophisticated context. :/ 2015-10-18 20:16:14 +01:00
Chris Pressey
c98e446583 Spec and syntax for vectors and copy instruction. 2015-10-18 19:41:26 +01:00
Chris Pressey
9235c6eacc Support line comments. 2015-10-18 18:54:28 +01:00
Chris Pressey
a933c81768 Well, that's a hack. But it works. 2015-10-18 18:47:47 +01:00
Chris Pressey
a9bd8a3714 Indexed access, + x / + y, at least for LDA and STA.
--HG--
rename : eg/screen.60p => eg/screen1.60p
2015-10-18 18:32:20 +01:00
Chris Pressey
5a5953ca4c A little awkward, but analyze byte table access correctly. 2015-10-18 18:12:47 +01:00
Chris Pressey
4287bf81c1 Parse byte table declarations and indexing modifiers. 2015-10-18 17:40:53 +01:00
Chris Pressey
41432b5cb3 Syntax is syntax, test it there. Register built-ins as symbols. 2015-10-18 17:32:12 +01:00
Chris Pressey
e1cf162a5b Refs have types. 2015-10-18 17:23:01 +01:00
Chris Pressey
522c771208 Add explicitly-addressed memory locations. 2015-10-18 16:22:36 +01:00
Chris Pressey
49e42af953 Implement if not and repeat forever. 2015-10-18 15:32:28 +01:00
Chris Pressey
c5998ed240 Compile repeat loops. 2015-10-18 13:55:40 +01:00
Chris Pressey
f7eb0d48a8 Spec, parse, evaluate, and analyze repeat blocks. 2015-10-18 13:37:35 +01:00
Chris Pressey
070ffacf69 Don't generate code for empty else blocks. 2015-10-17 18:25:54 +01:00
Chris Pressey
b794d8d273 Get serialization of relative labels correct. 2015-10-17 18:11:23 +01:00
Chris Pressey
b6bb64528f Implement compiling if, but we need relative addressing first. 2015-10-17 16:34:02 +01:00
Chris Pressey
479b484313 Compile the rest of the instructions. 2015-10-17 16:17:35 +01:00
Chris Pressey
e62fd85ccf Compile access of defined memory locations. 2015-10-17 15:46:28 +01:00
Chris Pressey
a3160a5166 Call defined routines. 2015-10-17 15:23:00 +01:00
Chris Pressey
643a48a2c5 Compiler object, labels, compile 'call'... It prints 'A'! 2015-10-17 15:06:50 +01:00
Chris Pressey
2ffff3bbdb Make extern routines survive analysis. 2015-10-17 14:54:28 +01:00
Chris Pressey
49d90dfae0 Add syntax for extern routines, add syntax tests. 2015-10-17 13:50:21 +01:00
Chris Pressey
d0e3dfbf84 Add tests for compilation, BASIC header, load-n-go script. 2015-10-17 12:28:39 +01:00
Chris Pressey
22c58ba556 Improve evaluator internals. Finish test suite for analysis. 2015-10-16 19:32:18 +01:00
Chris Pressey
4d61f439bc Fix up spec, split off to 6502 opcodes doc, add some tests. 2015-10-16 19:15:01 +01:00
Chris Pressey
c3a0659058 Write sufficient tests (I think) for analysis of ifs. 2015-10-16 14:01:45 +01:00
Chris Pressey
6192a6a7f8 Add specific error for uninit outputs. Sketch if analysis. 2015-10-16 09:38:38 +01:00
Chris Pressey
f92056d640 REBOOT the entire language & implementation as version 0.2-PRE. 2015-10-16 09:30:24 +01:00