summaryrefslogtreecommitdiff
path: root/usr.bin/oasm/parse.c
AgeCommit message (Collapse)Author
2 daysoasm: Remove redundant state->last updateIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2 daysoasm: lex: lex_is_mro() -> tok_is_mro()Ian Moffett
Improve naming consistency Signed-off-by: Ian Moffett <ian@osmora.org>
2 daysoasm: parse: "instruction" -> "token"Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
3 daysoasm: Introduce encoding for the NOP instructionIan Moffett
The NOP (no operation) instruction simply tells the processor to do nothing. This can be useful for various things such as padding, timing, etc. -- nop nop nop ... -- Signed-off-by: Ian Moffett <ian@osmora.org>
4 daysoasm: Add table to keep track of labelsIan Moffett
Implement a hash table used to store a maximum of 128 labels. This commit adds functions such as label_enter() to add labels to the table, label_lookup() to lookup labels as well as various utility functions used internally by the assembler. Signed-off-by: Ian Moffett <ian@osmora.org>
4 daysoasm: Add encoding for MRO type instructionsIan Moffett
This commit introduces encoding logic for 4 additional instructions: - MROB (Mask Register Over [byte]) - MROW (Mask Register Over [word]) - MROD (Mask Register Over [dword]) - MROQ (Mask Register Over [qword]) This instruction is used to fill a register with a specific length of zeros or ones. For example, to fill a register (e.g., x2) with 16-bits of 1s: -- !! !! Clear bits x2[7:0]... Mrrp,, !! mrow!! !! mrow x2, #1 -- Similarly, an operand of zero sets it to zero. For example, to clear an entire 64-bit register with zeros. Something like this can be done: -- mroq x1, #0 -- Signed-off-by: Ian Moffett <ian@osmora.org>
4 daysoasm: parse: Remove unused stubIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
4 daysoasm: Add initial support for labelsIan Moffett
A label is like a pin on a map with a number attached to it. OASM keeps track of a number referred to as the psuedo instruction pointer (PIP). This value is initially zero by default and is incremented every instruction. The purpose of this value is to pin a location in the code and mark it to be at a specific address so that further references to that label would be translated to the previous PIP value at the time of encountering the label. Signed-off-by: Ian Moffett <ian@osmora.org>
4 daysoasm: parse: Use oasm_err instead of printf()Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
5 daysoasm: Add encoding for BR instructionIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 daysoasm: Add encoding logic for "DIV" instructionIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 daysoasm: Introduce encoding for MUL instructionIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 daysoasm: 'osxm64' -> 'osmx64'Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 daysoasm: Add encoding logic for "SUB" instructionIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 daysoasm: Parse and encode the "HLT" instructionIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 daysoasm: Implement encoding for 'ADD' instructionIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
7 daysoasm: parse: Add TT_INC to parse_tok()Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
7 daysoasm: Add initial codegen emit sourcesIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
7 daysoasm: parse: Add tok_is_xreg() helperIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
8 daysusr: oasm: Add initial parsing logicIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
8 daysusr: oasm: Add IMM tokstr entryIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
8 daysusr: Add initial "oasm" assembler workIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>