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

298 Commits

Author SHA1 Message Date
Chris Pressey
dcc944d732 If add and sub can work on words, then cmp can work on words too. 2018-11-23 23:00:41 +00:00
Chris Pressey
e74c7f2b31 Initial attempt at 16-bit compare. Not super well tested yet. 2018-11-23 22:09:28 +00:00
Chris Pressey
0429e4bd90 Make lexer greatly less inefficient on large source files. 2018-11-20 13:14:45 +00:00
Chris Pressey
0c63de9351 Merge branch 'develop-0.17' into remove-legacy-syntax 2018-09-07 17:49:03 +01:00
Chris Pressey
684b26dd5c locexpr() always returns a ForwardReference if it can't lookup it. 2018-09-07 15:03:41 +01:00
Chris Pressey
07ef1e243a backpatch_constraint_labels can resolve ForwardReferences. 2018-09-07 14:51:16 +01:00
Chris Pressey
29a5bba85c Distinct symbol resolution phase (as a method on parser.) 2018-09-07 14:27:49 +01:00
Chris Pressey
cc98e023c4 Simply always produce ForwardReferences in locexpr(forward=True). 2018-09-07 14:02:40 +01:00
Chris Pressey
d70092c373 Even more general. 2018-09-07 13:42:18 +01:00
Chris Pressey
af0e1b41c7 Forward-reference resolution becomes increasingly general. 2018-09-07 13:40:41 +01:00
Chris Pressey
26a2fb448c Generalize forward reference resolution a smidge. 2018-09-07 13:27:18 +01:00
Chris Pressey
33d5093e5a Resolve forward references more explicitly. 2018-09-07 13:20:18 +01:00
Chris Pressey
7c9f76c007 Removing support for it is one thing, updating all tests another. 2018-09-07 13:03:57 +01:00
Chris Pressey
5bad7ff576 Another conversion away from self.context.fetch to self.declare. 2018-09-07 12:43:55 +01:00
Chris Pressey
c73590f88c Begin refactoring how the ParsingContext is used by the Parser. 2018-09-07 12:24:07 +01:00
Chris Pressey
e7674c44ce Confirm constraint on saveing a. 2018-09-07 11:33:24 +01:00
Chris Pressey
19461bc205 Support save X, Y, Z {} as a shortcut syntax for nested saves. 2018-09-07 11:27:42 +01:00
Chris Pressey
b63bcfcd2b Begin introducing shortcut syntax for nested saves. 2018-09-07 09:36:51 +01:00
Chris Pressey
0593ce6a66 Move merge_programs() out of main. Handle missing -o options. 2018-09-07 09:26:11 +01:00
Chris Pressey
8ce787a797 Inheritance hierarchy; binding is a little less awful. 2018-09-07 09:10:20 +01:00
Chris Pressey
0b6a66fdbb pyflakes. 2018-09-06 18:26:30 +01:00
Chris Pressey
99a0d5624a Awful binding, but at least this code isn't in main anymore. 2018-09-06 18:25:29 +01:00
Chris Pressey
24f093b1db Make all serialize() methods take addr() as an arg, not kwarg. 2018-09-06 18:11:47 +01:00
Chris Pressey
0a91d6bbc0 Rename method for more distinction/clarity. 2018-09-06 17:21:43 +01:00
Chris Pressey
8efa73f79d Explicitly sort the chains by their content, for stable sort. 2018-09-06 17:15:10 +01:00
Chris Pressey
4bba75857f --output cmdline argument, serialize() returns an array of bytes. 2018-09-06 16:18:41 +01:00
Chris Pressey
3fd7e52bc7 Reduce number of errors under Python 3 another smidge. 2018-09-06 14:21:29 +01:00
Chris Pressey
c11869f322 Not making any promises, but reduce the errors under Python 3. 2018-09-05 21:45:58 +01:00
Chris Pressey
eb4ed6a6bc Extract locations from context appropriately. All tests pass. 2018-04-25 16:58:21 +01:00
Chris Pressey
01e3ab00aa Make tests pass. 2018-04-25 13:40:39 +01:00
Chris Pressey
4986454733 Support save'ing user-defined locations. 2018-04-25 13:27:47 +01:00
Chris Pressey
07541d7913 Compile code for saving a, x, or y on the stack. 2018-04-25 13:15:53 +01:00
Chris Pressey
80c46485f1 Saving anything except a trashes a. 2018-04-25 13:06:11 +01:00
Chris Pressey
4d1f9d0f3c First cut at implementing save. Only the most basic tests though. 2018-04-19 13:18:52 +01:00
Chris Pressey
bc91ef1602 Compile byte-table add, sub, cmp, and, or, xor, shl, shr, inc, dec. 2018-04-18 16:32:12 +01:00
Chris Pressey
5fcbfa1d21 Analyze reads and updates of tables. 2018-04-18 15:45:47 +01:00
Chris Pressey
0c22944afc Able to parse, but not yet able to analyze, other table accesses. 2018-04-18 14:21:03 +01:00
Chris Pressey
e565234d28 Support for shl foo and shr foo where foo is a byte storage. 2018-04-18 12:01:53 +01:00
Chris Pressey
3c7d95a724 Support for copy [ptra]+y, [ptrb]+y to indirect LDA indirect STA 2018-04-18 10:57:57 +01:00
Chris Pressey
70247e0e44 Generate zero-page code for and, or, and xor, when possible. 2018-04-17 17:58:26 +01:00
Chris Pressey
475584769d Add more test cases. 2018-04-06 14:08:09 +01:00
Chris Pressey
5f64113484 1-line bugfix. Now the optimizer does do the expected good job. 2018-04-06 13:27:40 +01:00
Chris Pressey
27df0d27db Optimize away RTS and JMP when possible. Fallthru stuff done. 2018-04-05 14:10:04 +01:00
Chris Pressey
2ca843ece7 Begin hooking the fallthru analysis up to the compilation phase. 2018-04-05 10:52:14 +01:00
Chris Pressey
ac24f98dd3 Vastly simplify the fallthru analysis algorithm. 2018-04-05 09:57:14 +01:00
Chris Pressey
7fa54f53cb Serialize main first. However, this could use a fresh approach. 2018-04-04 17:55:59 +01:00
Chris Pressey
9c68b6a7e0 Serialize routines with in() sets first, and in the right order. 2018-04-04 17:49:50 +01:00
Chris Pressey
cab84b8ebe Change the serialization format to be (hopefully) clearer. 2018-04-04 17:05:48 +01:00
Chris Pressey
efe8859209 Find the longest chain of routines in R and remove it. 2018-04-04 16:54:12 +01:00
Chris Pressey
b1bcc21ffc Go slightly further with the serialization. 2018-04-04 16:22:14 +01:00
Chris Pressey
30e839033c First cut at serialization of fallthru-optimized routines. 2018-04-04 15:09:48 +01:00
Chris Pressey
e39dbf68ed Call it fall_in_map. 2018-04-04 14:16:49 +01:00
Chris Pressey
448849ac4b Successfully break cycle. 2018-04-04 14:01:17 +01:00
Chris Pressey
50433ac860 Find cycles in fallthru map. Try to break them; not right, yet. 2018-04-04 13:37:32 +01:00
Chris Pressey
a0d3ea8167 Add a dedicated module for a dedicated FallthruAnalyzer. 2018-04-04 11:09:39 +01:00
Chris Pressey
237a8b5b39 Lessen dependence on the internals of ParsingContext. 2018-03-29 17:31:14 +01:00
Chris Pressey
a759f4414b Make tests pass again. 2018-03-29 16:50:07 +01:00
Chris Pressey
8f1e35fb39 Add some tests, some failing, for expected fallthru maps. 2018-03-29 16:44:06 +01:00
Chris Pressey
b33998cddc First cut at building fallthru map. Needs tests. 2018-03-29 15:07:44 +01:00
Chris Pressey
fa1b0cfae1 Support branching and looping on the n flag. 2018-03-29 14:45:28 +01:00
Chris Pressey
ebe53f540c Fix bug when zero page address was $00. 2018-03-29 11:46:56 +01:00
Chris Pressey
eadf1eb4ae A byte or word table can be initialized with a list of constants. 2018-03-29 11:09:02 +01:00
Chris Pressey
2f513f7291 Initial support for initializing byte tables with list of bytes. 2018-03-29 10:45:18 +01:00
Chris Pressey
9b912de17c Accessing zero-page with ld and st generates zero-page opcodes. 2018-03-29 10:31:42 +01:00
Chris Pressey
1f992f8dbd Support of NOP opcode. 2018-03-28 14:52:16 +01:00
Chris Pressey
0093c7b7d9 First cut at support for targetting the Atari 2600. 2018-03-28 14:20:53 +01:00
Chris Pressey
bb0e7aa992 Track the gotos that we have encountered in a routine. 2018-03-27 17:27:09 +01:00
Chris Pressey
6744ad29a9 Beginnings of modularity. 2018-03-27 16:23:22 +01:00
Chris Pressey
d9e625db30 Clean up driver code, add filename to error messages. 2018-03-27 15:55:29 +01:00
Chris Pressey
3f0e36a67c Add symbolic constants. 2018-03-27 12:36:33 +01:00
Chris Pressey
b91c3ed2f1 Add three more tests. Ensure they pass. 2018-03-26 17:40:43 +01:00
Chris Pressey
ceaae962d5 Make tests pass. Add two more tests towards completeness of spec. 2018-03-26 12:48:57 +01:00
Chris Pressey
96fbe03ce7 Make compilation tests pass. 2018-03-14 16:27:33 +00:00
Chris Pressey
adb53f7a04 Almost compile for loops correctly. 2018-03-14 15:33:11 +00:00
Chris Pressey
b79059faa4 Two seperate words looks better. 2018-03-14 09:51:24 +00:00
Chris Pressey
9a9db83fc6 Analyze the range in the for loop. All unit tests pass again. 2018-03-13 17:44:44 +00:00
Chris Pressey
7a3b52dc1e More correct determination of tail position for purposes of goto. 2018-03-13 17:00:49 +00:00
Chris Pressey
689670a69e Small bugfixes and changes. 2018-03-13 09:25:06 +00:00
Chris Pressey
994449ecb0 Make the loop variable unwriteable in the body of the "for" loop. 2018-03-08 17:41:42 +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
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
42cbd73a20 Show line numbers in static analysis errors (clumsily.) 2018-03-06 13:13:18 +00:00
Chris Pressey
e44c802314 Syntax errors have line numbers in them now. 2018-03-06 12:23:57 +00:00
Chris Pressey
9ad34ed34f Refine the AST classes even more. 2018-03-06 10:43:23 +00:00
Chris Pressey
8a7e3aaebb Flatten more. 2018-03-05 15:32:08 +00:00
Chris Pressey
1180d2fe2a Attempt to flatten the code for generating code for copy. 2018-03-05 15:22:47 +00:00
Chris Pressey
c194808e64 Label the various cases for compiling a copy instruction. 2018-03-05 13:23:09 +00:00
Chris Pressey
c85159a9c0 Start trying to clean up the code for compiling copy. 2018-03-05 12:34:24 +00:00
Chris Pressey
b579e8b2eb Refs have indexes. Instructions do not. 2018-03-05 12:19:27 +00:00
Chris Pressey
0a83d90515 Tighten structure of AST more. 2018-03-05 12:13:15 +00:00
Chris Pressey
4b43ba734e Make AST more structured (borrowed from ALPACA.) 2018-03-05 11:55:06 +00:00
Chris Pressey
b42aa8b051 Fix error message. 2018-03-05 11:28:08 +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
42c4bed36e Make tests pass. 2018-02-16 15:46:55 +00:00
Chris Pressey
0e0a3d552a Implement Context.copy_range(), ranges for constants. Progress! 2018-02-14 16:35:19 +00:00
Chris Pressey
0687da80d5 Some headway on context.assert_in_range(). 2018-02-14 15:54:57 +00:00
Chris Pressey
2897a04718 Get and set top of range of a location. Make AND do this to A reg. 2018-02-14 15:13:35 +00:00
Chris Pressey
93e2dada16 Check for table size (in parser, thus tests are for syntax.) 2018-02-14 13:53:22 +00:00