From 83ce1151ee1f06ae6b1c5c1018cc2489494e5ea4 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 20 Nov 2020 15:10:24 -0500 Subject: - Implemented support for Sux's base extension. This is the biggest milestone I've reached for this project, since the base extension changes alot about what Sux can do by default, and now makes it a viable instruction set for modern day use, when compared with other instruction sets. --- asmmon.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'asmmon.c') diff --git a/asmmon.c b/asmmon.c index 6796ebb..0890076 100644 --- a/asmmon.c +++ b/asmmon.c @@ -149,6 +149,7 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u uint8_t am_done = 1; uint8_t op_done = 1; uint16_t bline = s->bline; + const char *inst_name; for (; bline; bline--) { putchar('\n'); } @@ -169,7 +170,6 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u case INDY: putchar('('); am_done = 0; break; case ZMY : case ZMX : am_done = 0; break; - case BREG: putchar('b'); am_done = 1; break; } am = (am_done) ? 0xFF : am; } @@ -188,9 +188,14 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u switch (t->id) { case TOK_DIR : printf(".%s", dir_t[t->type]); break; case TOK_RS : printf("%s", rs_t[t->type]); break; + case TOK_EXTOP : case TOK_OPCODE: + switch (t->id) { + case TOK_EXTOP : inst_name = ext_mne[t->byte]; break; + case TOK_OPCODE: inst_name = /**/mne[t->byte]; break; + } for (; j < 3; j++) { - mne_lower[j] = tolower(mne[t->byte][j]); + mne_lower[j] = tolower(inst_name[j]); } mne_lower[j] = '\0'; j = 0; @@ -300,6 +305,12 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u if (t->next && !isopdone(t)) { op_done = isopdone(t->next); } + if (am != 0xFF && op_done && t->id != TOK_RS && !t->next) { + switch (am) { + case EIND: putchar('('); am_done = 0; break; + case BREG: putchar('b'); am_done = 1; break; + } + } if (am != 0xFF && !am_done && op_done) { switch (am) { case INDX: @@ -309,12 +320,18 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u break; } /* Falls Through. */ + case EIND: + if (am == EIND) { + putchar('e'); + } + /* Falls Through. */ case INDY: case IND : putchar(')'); - if (am == IND) { + if (am == IND || am == EIND) { break; } + /* Falls Through. */ case ZMY : printf(", y"); break; } am = 0xFF; -- cgit v1.2.3-13-gbd6f