summaryrefslogtreecommitdiff
path: root/asmmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'asmmon.c')
-rw-r--r--asmmon.c60
1 files changed, 46 insertions, 14 deletions
diff --git a/asmmon.c b/asmmon.c
index 453ff3c..198254c 100644
--- a/asmmon.c
+++ b/asmmon.c
@@ -114,6 +114,8 @@ void list(struct line *l, uint16_t start, uint16_t end, uint8_t all, uint8_t ln,
uint8_t spaces;
uint8_t tabs;
char mne_lower[4];
+ char ch[6];
+
if (all) {
end = lineidx;
}
@@ -202,10 +204,28 @@ void list(struct line *l, uint16_t start, uint16_t end, uint8_t all, uint8_t ln,
}
}
+ j = 0;
+
+ if (l[i].opbase == BASE_CHAR) {
+ switch (l[i].op) {
+ default : ch[j++] = l[i].op; break;
+ case '\n': ch[j++] = '\\'; ch[j++] = 'n' ; break;
+ case '\r': ch[j++] = '\\'; ch[j++] = 'r' ; break;
+ case '\b': ch[j++] = '\\'; ch[j++] = 'b' ; break;
+ case '\\': ch[j++] = '\\'; ch[j++] = '\\'; break;
+ case '\'': ch[j++] = '\\'; ch[j++] = '\''; break;
+ case '\"': ch[j++] = '\\'; ch[j++] = '\"'; break;
+ }
+ }
+
+ ch[j] = '\0';
+ j = 0;
+
switch (l[i].opbase) {
- case BASE_HEX: printf("$%"PRIX64, l[i].op); break;
- case BASE_DEC: printf("%"PRIu64, l[i].op); break;
- case BASE_BIN: printf("%%%s", showbits(l[i].op, bitnum, dbg)); break;
+ case BASE_HEX: printf("$%"PRIX64, l[i].op); break;
+ case BASE_DEC: printf("%"PRIu64, l[i].op); break;
+ case BASE_BIN: printf("%%%s", showbits(l[i].op, bitnum, dbg)); break;
+ case BASE_CHAR: printf("\'%s\'", ch); break;
}
bitnum = 0;
opsize = 0;
@@ -226,10 +246,29 @@ void list(struct line *l, uint16_t start, uint16_t end, uint8_t all, uint8_t ln,
if (opsize) {
bitnum = bitsize[opsize-1];
}
+
+ j = 0;
+
+ if (l[i].aopbase == BASE_CHAR) {
+ switch (l[i].aop) {
+ default : ch[j++] = l[i].aop; break;
+ case '\n': ch[j++] = '\\'; ch[j++] = 'n' ; break;
+ case '\r': ch[j++] = '\\'; ch[j++] = 'r' ; break;
+ case '\b': ch[j++] = '\\'; ch[j++] = 'b' ; break;
+ case '\\': ch[j++] = '\\'; ch[j++] = '\\'; break;
+ case '\'': ch[j++] = '\\'; ch[j++] = '\''; break;
+ case '\"': ch[j++] = '\\'; ch[j++] = '\"'; break;
+ }
+ }
+
+ ch[j] = '\0';
+ j = 0;
+
switch (l[i].aopbase) {
- case BASE_HEX: printf("$%"PRIX64, l[i].aop); break;
- case BASE_DEC: printf("%"PRIu64, l[i].aop); break;
- case BASE_BIN: printf("%%%s", showbits(l[i].aop, bitnum, dbg)); break;
+ case BASE_HEX : printf("$%"PRIX64, l[i].aop); break;
+ case BASE_DEC : printf("%"PRIu64, l[i].aop); break;
+ case BASE_BIN : printf("%%%s", showbits(l[i].aop, bitnum, dbg)); break;
+ case BASE_CHAR: printf("\'%s\'", ch); break;
}
bitnum = 0;
opsize = 0;
@@ -443,14 +482,7 @@ uint64_t assemble(struct line *line, uint8_t dbg) {
}
tmpaddr += tmp;
tmp = 0;
- if (skip || flags & 0x80) {
- if (dbg) {
- printf("assemble(): The address that this line starts at is, $%"PRIX64".\n", address);
- printf("assemble(): The address that this line ends on is, $%"PRIX64".\n", tmpaddr);
- }
- continue;
- }
- if (flags == 0x108) {
+ if (skip | (flags & 0x80) | (flags == 0x108)) {
if (dbg) {
printf("assemble(): The address that this line starts at is, $%"PRIX64".\n", address);
printf("assemble(): The address that this line ends on is, $%"PRIX64".\n", tmpaddr);