Commit Graph
48 Commits
Author SHA1 Message Date
glm94 4af2527806 Updated the structure of symbols and tokens to hopefully help make computing symbol values easier. 2023-08-07 01:18:01 -05:00
glm94 65383cded2 Updated the way symbols are represented and how they are marked as resolved. 2023-07-09 22:04:55 -05:00
glm94 9c8fe17c8f Minor code cleanup and added an extra flag to the compiler. If a symbol is a label it will now hold a reference to the opcode and by extension the offset into the file it points to. 2023-07-06 19:39:03 -05:00
glm94 3031fa8b9b Code cleanup. 2023-06-29 20:53:39 -05:00
glm94 2918f2964d Fixed a bug where words weren't being written to 'memory' correctly. 2023-06-24 18:00:13 -05:00
glm94 980b0449fc Fixed a bug with the parse discarding identifier tokens when parsing a COPY instruction. Added the first batch of code to encode the final token array to a binary form. 2023-06-22 20:22:20 -05:00
glm94 6741dde7ce Hooked up the program counter in the parser to set the memory offset of symbols, well labels to be more acurrate. 2023-06-18 14:51:37 -05:00
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 f96e1c6380 Added grammar checking for DB declarations. 2023-03-08 21:38:33 -06: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 6d6bf1cbaf Wrote the first step for the binary output. Doesn't handle instruction pointer symbols yet since those emit addresses that still need to be computed. 2022-10-10 18:36:38 +00: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 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 cd1258a724 Fixed various Parser bugs. 2022-10-03 19:58:44 -05:00
glm94 706f480e31 The Scanner will now check for empty lines (is the previous token and the current token a new line?) and simply not emit a NewLine Token. 2022-10-03 19:40:00 +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 63438b551b Got the scanner running again. Seems to be picking up punctuation, labels, identifiers and strings as expected. 2022-09-29 21:32:08 -05: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 3c7056c5e6 The main function will now write out the output of the parser. 2022-08-29 21:23:02 +00:00
glm94 6c7b8d5356 Fixed a bug where CMP REG, REG wouldn't get encoded and a disassembler bug related to said CMP bug. 2022-08-29 19:29:34 +00: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 4f6d5f652e Made use of the Symbols Table, and started the proccess of determining the memory location of opcodes and variables. 2022-08-25 19:06:05 +00:00
glm94 64326937b1 Added a LineEnd token type. 2022-08-25 18:37:25 +00:00
glm94 89ab951c6a Refactored the parsing code just a touch. 2022-08-24 21:23:14 +00:00
glm94 fbef044905 Added some simple symbol handling to the Parser. 2022-05-06 18:55:22 +00:00
glm94 fc47bf2143 Fixed up the code a bit and fixed a memory leak bug (of course, there's still no good way to free Tokens but that'll be sorted out later). 2022-05-05 20:10:10 +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 859035da2a Updated the scanner to parse registers, assembly keywords and identifiers. 2022-05-04 20:07:47 +00:00
glm94 1900b504e7 Setup the assembler to use the new file reading code. 2022-04-28 22:24:10 -05: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 375fd46045 Split up some code to more in line with what its actually doing. 2022-01-27 18:20:09 +00:00
glm94 019a7f44a8 Cleaned up the tokenizer and setting the stage for more granular token types. 2022-01-21 21:17:37 +00:00
glm94 99ebd82996 Experimenting with tokenizing strings. This commit just focuses on splitting strings up by whitespace. 2022-01-20 18:17:58 +00:00
glm94 479dc57ea8 Code cleanup in the List code. Possibly saved myself some headache in the future by using the right pointer type in the struct definition. 2022-01-18 16:28:49 +00:00
glm94 929f2a7f4b Made the List generic, though more care needs to be taken when using it since memory leaks can happen when structs are used with it. 2022-01-17 17:21:40 +00:00
glm94 8656ba7d0c Fixed a bug where the last character of a line would be lost when generating a list of string tokens. 2022-01-05 22:51:56 +00:00
glm94 08acc6af22 First stage of splitting up a source line complete. Next is tokenizing the list of string being generated. 2021-12-30 15:21:09 -06:00
glm94 168d8e1548 Created a list structure for strings. Should work for splitting lines of text up just before they're tokenized. 2021-12-30 14:28:02 -06:00
glm94 9c6b1d9057 Added very simple parsing logic. 2021-12-28 20:48:09 +00:00
glm94 5162804270 Initial commit, can read from a list of files passed. 2021-12-28 20:09:33 +00:00