diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-27 22:59:18 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-28 03:30:58 -0400 |
commit | a4a7080dee359ca95f09d91d68d1d8c4a1f59cd6 (patch) | |
tree | ea3a16a62d1c2bd4426273f8e28907f20c6e69ff /usr.bin/oasm/parse.c | |
parent | 6b3c37f5bc9dbd3656ee08b925f2df2d233084fe (diff) |
oasm: Introduce AND mnemonic
Implement mnemonic for the AND instruction:
--
and x1, #7 ! x1 = x1 & 7
--
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/oasm/parse.c')
-rw-r--r-- | usr.bin/oasm/parse.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/oasm/parse.c b/usr.bin/oasm/parse.c index c81b498..523058b 100644 --- a/usr.bin/oasm/parse.c +++ b/usr.bin/oasm/parse.c @@ -58,7 +58,7 @@ static const char *tokstr[] = { [ TT_MROW ] = "mrow", [ TT_MROD ] = "mrod", [ TT_MROQ ] = "mroq", - + [ TT_AND ] = "and", /* X<n> registers */ [ TT_X0 ] = "x0", @@ -124,6 +124,7 @@ parse_reg(struct oasm_state *state, struct oasm_token *tok) case TT_MUL: case TT_DIV: case TT_BR: + case TT_AND: state->last = tok->type; break; default: @@ -166,6 +167,10 @@ parse_tok(struct oasm_state *state, struct oasm_token *tok) state->last = tok->type; label_enter(tok->raw, state->pip); break; + case TT_AND: + state->last = tok->type; + emit_osmx64(&emit_state, tok); + break; case TT_HLT: state->last = tok->type; emit_osmx64(&emit_state, tok); |