summaryrefslogtreecommitdiff
path: root/asmmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'asmmon.c')
-rw-r--r--asmmon.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/asmmon.c b/asmmon.c
index 9f1b511..5bc1993 100644
--- a/asmmon.c
+++ b/asmmon.c
@@ -127,8 +127,7 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u
char ch[6];
do {
- token *tok = s->tok;
- token *t;
+ token *t = s->tok;
uint8_t am = 0xFF;
uint8_t rs = 0xFF;
if (dbg) {
@@ -151,8 +150,7 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u
tabs--;
}
}
- for (; tok && tok->id != TOK_COMMENT && tok >= t; tok = tok->next) {
- t = tok;
+ while (t && t->id != TOK_COMMENT) {
switch (t->id) {
case TOK_DIR : printf(".%s ", dir_t[t->type] ); break;
case TOK_OPCODE:
@@ -163,8 +161,8 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u
j = 0;
printf("%s", mne_lower);
am = t->type;
- t = t->next;
- if (t && t->id == TOK_RS) {
+ if (t->next && t->next->id == TOK_RS) {
+ t = t->next;
rs = t->type;
printf("%s", rs_t[t->type]);
}
@@ -217,8 +215,10 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u
default : ch[j++] = t->byte; break;
case '\n': ch[j++] = '\\'; ch[j++] = 'n' ; break;
case '\r': ch[j++] = '\\'; ch[j++] = 'r' ; break;
+ case '\t': ch[j++] = '\\'; ch[j++] = 't' ; break;
case '\b': ch[j++] = '\\'; ch[j++] = 'b' ; break;
case '\\': ch[j++] = '\\'; ch[j++] = '\\'; break;
+ case '\0': ch[j++] = '\\'; ch[j++] = '0'; break;
case '\'': ch[j++] = '\\'; ch[j++] = '\''; break;
case '\"': ch[j++] = '\\'; ch[j++] = '\"'; break;
}
@@ -245,6 +245,7 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u
}
break;
}
+ t = t->next;
}
if (am != 0xFF) {
if (fall) {
@@ -285,8 +286,8 @@ void list(uint16_t start, uint16_t end, uint8_t all, uint8_t ln, uint8_t addr, u
tabs--;
}
}
- if (tok && tok->id == TOK_COMMENT) {
- printf(";%s", (tok->str) ? tok->str : "");
+ if (t && t->id == TOK_COMMENT) {
+ printf(";%s", (t->str) ? t->str : "");
}
puts("");
s = s->next;