s502 assembler
A very simple assembler for the 6502 line of processors written in C
|
As the project evolved, many first ideas were changed. Here is a list of changes from the previous documentations:
This directive might be useful, but implementing it with the constraints of the homework (can not check size of file) would be over-complicated, unrealistic and possibly ugly, so I dropped this feature and focused on other aspects of the program instead.
In the original doc I used the percentage ('') character with labels as arguments, but the ampersand ('&') character is easier to remember as "the address of a label", so I changed this character.
Since forcing a number to be 16 bit instead of 8 only made sense in address modes (absolute vs. zpg) and .data directives, and I used a different marking for the former (start character to force ZPG), I also changed the way to .data words via prefixing them with "w:", instead of a general number modifier.
While refactoring around Token, non-instruction data entries (and thus the whole union) become useless and thus were removed. Now it has instruction related data or (mostly) uninitialized data if it's not an instruction
Added address field to store the address of the instruction. Used for relative addressing.
token_recognize
(read step)token_analyze_instruction
token_get_operand
token_compile
link_instruction
privateget_addressmode
privateSee Token for current members and methods!
Since it's only used internally by map_set and map_get, I removed this function from the private interface, but kept it for internal use.