Commit Graph
56 Commits
Author SHA1 Message Date
glm94 95ed2143ea Updated the parser to handle processing a simple load byte instruction. Added the LODB opcode to the opcode enum listing and updated the Scanner to look for 'byte' and mark it as a directive. 2023-03-24 23:24:24 -05:00
glm94 4230708f15 Added a function to remove an item from the generic list, which is mainly used for the tokens. 2023-03-07 21:31:14 -06:00
glm94 5e9e1bdec4 Massive refactoring to simplify this whole setup. The Token List will be modified in place and reused in the Parser to normalize the list and generate a symbols table. Normalizing the token list will make sure the syntax is valid and the symbols table will have the relative offsets and length of symbol values. At least this is all the plan but one step at a time. 2023-03-06 21:51:36 -06:00
glm94 1b246e90bc Started rethinking how this machine should behave. Updated and refactoring some things with a few new ideas. 2023-02-23 22:22:07 -06:00
glm94 9a602824b6 Added all the instructions supported to a structure to help make validation of parameters easier. 2022-10-18 21:14:50 -05:00
glm94 fd44e03b1b Updated the Parser to try and give 'AddressParameter's more meaning depending on the SymbolType. 2022-10-08 18:21:11 -05:00
glm94 48a77950be Updated the way string symbols are handled, allowing the programmer to terminate a string with any byte or none at all. 2022-10-08 16:35:05 -05:00
glm94 c142d2c6d0 Cleaned up the Symbol struct and updated code accordingly. 2022-10-08 14:43:00 -05:00
glm94 4b08707e67 Cleaned up the list implementation so as to NOT copy items into a new buffer. 2022-10-07 20:46:55 +00:00
glm94 bdb4d2b241 Updated the way Instructions keep track of symbols. Only their name is important but we need the Symbols to be able to track which Instruction they point to (if they do that is, i.e. a label symbol). 2022-10-06 21:11:22 -05:00
glm94 d53833c25f Added some debug print out for the instruction list and a helper function to get a string for any Registers enum. 2022-10-06 21:05:57 +00:00
glm94 f38da9cc74 A bit of cleanup. 2022-10-04 21:05:15 +00:00
glm94 33309a2759 Updated the Instruction's structure and updated the Parser accordingly. 2022-10-04 20:37:47 +00:00
glm94 be91e3c112 Updated the parser to better handle parameters, sort of and including a string length assembly program to use as a test for the whole assembler. 2022-10-03 21:26:28 +00:00
glm94 a949007c75 Updated the ISA so the program will correctly see things like 'load', 'inc' and 'dec'. 2022-10-03 16:56:39 +00:00
glm94 f7cd87f13f Started reworking the Parser to simplify how instructions will be represented. It will act like a 'first pass' that will do grammar checks but not verify the parameters of the opcodes. 2022-10-02 22:54:18 -05:00
glm94 55f4c32764 Missed this for the Scanner fix. 2022-10-02 22:12:16 -05:00
glm94 0b58e0124f Some refactoring to update everything to use the new structures and some new considerations for how Symbols and Instructions shoudl be represented. 2022-09-15 22:14:38 -05:00
glm94 2ae60a607c Incomplete, but I want to make sure the ideas I have here don't get wiped. Sadly this commit won't compile. 2022-09-15 21:29:27 +00:00
glm94 6d17dffcdf Added a SymbolTable object (untested at the moment) and redefined the Symbol object. I think when a Symbol is made only the size of it should matter to the code that will assemble the final binary. 2022-09-08 20:56:02 +00:00
glm94 2518214585 Added a length attribute to the symbol. 2022-09-06 14:15:45 +00:00
glm94 7004fff659 This feels like a trainwreck but eh. Changed the way the opcodes are managed. Hopefully this is the right direction when I add support for multiple ASM files. 2022-09-01 18:46:59 +00:00
glm94 13f8ff194b Smoothbrain indeed... 2022-08-30 22:48:49 -05:00
glm94 dac01ffd0c Changed the TokenClass from opcode to nomic, a less smoothbrain name IMO and also frees up Opcode for a better use later on. 2022-08-30 22:06:50 -05:00
glm94 5f437b6869 Both the assembler and the disassembler should now support all the instructions I've layed out thus far. 2022-08-29 18:51:48 +00:00
glm94 0d3f8a460e Added more instructions for the parser to emit and refactored the code in doing so. 2022-08-28 15:37:56 -05:00
glm94 0785f21805 Added a disassembler which is still very buggy. Also fixed some bugs with the opcode mask getting function. 2022-08-26 21:41:02 +00:00
glm94 eb5e2c506e Got the start of encoding opcodes. 2022-08-26 18:27:41 +00:00
glm94 0e53f9798f Added a distinction between constant numbers and what are effectively memory addresses (i.e. strings and labels). 2022-08-25 19:47:16 -05:00
glm94 64326937b1 Added a LineEnd token type. 2022-08-25 18:37:25 +00:00
glm94 3c4cce0883 Added assembler directives as a class of token. 2022-05-16 14:27:49 +00:00
glm94 2de3538d80 Parser is now mostly setup for the 'peek and advance' pattern. Still having infinite loop issues somewhere though. 2022-05-12 21:30:02 +00:00
glm94 72525959f6 Reworked the tokens to include a broad class to make parameter matching a bit easier, and removed the hexadecimal distinction. 2022-05-12 20:26:14 +00:00
glm94 72abf6c4ab Started work on rewriting the Parser. 2022-05-10 21:03:09 +00:00
glm94 fbef044905 Added some simple symbol handling to the Parser. 2022-05-06 18:55:22 +00:00
glm94 8ec0b9b216 Code cleanup. Converting a number lexeme to a proper integer setup but not done yet. So number tokens don't have a valid value. 2022-05-05 16:12:33 +00:00
glm94 9fa48520c7 Added support for 'labels' in the Scanner. 2022-05-04 22:58:06 -05:00
glm94 859035da2a Updated the scanner to parse registers, assembly keywords and identifiers. 2022-05-04 20:07:47 +00:00
glm94 2c9478d311 Attempting to declutter the lexer and tokenizer by rereolling them into the 'Scanner' object. 2022-05-03 21:20:38 +00:00
glm94 1900b504e7 Setup the assembler to use the new file reading code. 2022-04-28 22:24:10 -05:00
glm94 1968590654 Add a file utility to allow me to read in an entire file instead of doing so line by line. 2022-02-23 21:29:53 +00:00
glm94 19021ff782 Modified how registers and opcodes are represented. This commit is a bit buggy but doesn't crash and burn at least. I just wanted the new structs push out before making a bigger mess of things as I try to organize this all. 2022-02-17 21:35:57 -06:00
glm94 3d4ab57f05 Created the skeleton for the parser. 2022-02-07 15:33:58 +00:00
glm94 7c6e5e1541 Last bit of clean up before building the parser. 2022-02-02 20:43:25 +00:00
glm94 d39e37b078 Updated the lexer to pick out some more language specific grammar. 2022-02-02 19:18:27 +00:00
glm94 7a88d6e34d Added code to detect assembler directives and did some minor code clean up. 2022-02-01 22:07:00 -06:00
glm94 ebc1d30c1c Added a peek function to the tokenizer. 2022-01-31 22:06:52 +00:00
glm94 375fd46045 Split up some code to more in line with what its actually doing. 2022-01-27 18:20:09 +00:00
glm94 f88613a160 Expanded the tokenizer to recognize some opcodes and registers. 2022-01-24 17:09:02 +00:00
glm94 2570c5cac0 Made some chanegs to the tokenizer to understand hexadecimal formatted numbers, along with some more language grammar primitives. 2022-01-23 21:54:06 -06:00