summaryrefslogtreecommitdiff
path: root/asmmon.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-11-20 15:10:24 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2020-11-20 15:10:24 -0500
commit83ce1151ee1f06ae6b1c5c1018cc2489494e5ea4 (patch)
treeba4edade46c57ec5119d01ab8a7ad9f7943c6804 /asmmon.c
parentdc7ebb9d424bb39d59f09b8498746beb871c46f4 (diff)
- 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.
Diffstat (limited to 'asmmon.c')
-rw-r--r--asmmon.c23
1 files changed, 20 insertions, 3 deletions
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;