Assembler in GNU as syntax, objdump-style disassembly, UCASE$ and LCASE$

The monitor's assembler takes GNU as directives (.org, .equ, .byte, .half,
.word, .ascii, .string, .space, .align, .balign ...), # comments, 0x/0b
numbers, '\n' constants, . for the current address, << >> ^ ~, %hi/%lo and
the FP CSR short forms; the old ORG/DB/EQU/0FFH forms remain as aliases. The
disassembler prints lower case and 0x hex as objdump does. The monitor is
built with -msave-restore and puts .rodata first, to fit its ROM.
BASIC gains UCASE$ and LCASE$. Manual, README and tests updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-12-01 18:14:19 -08:00
1 parent 25c8286cf2
commit fa4752fd7a
16 files changed
+7921 -7615

No files matched your search

+9 -2
View File
@@ -124,7 +124,14 @@ FCSR_ALIAS = {"FRCSR": ("FCSR", "R"), "FRRM": ("FRM", "R"), "FRFLAGS": ("FFLAGS"
"FSRMI": ("FRM", "I"), "FSFLAGSI": ("FFLAGS", "I")}
FABI = ["FT%d" % i for i in range(8)] + ["FS0", "FS1"] + ["FA%d" % i for i in range(8)] + \
["FS%d" % i for i in range(2, 12)] + ["FT%d" % i for i in range(8, 12)]
def same(gnu_mn, gnu_ops, our):
# ours is in lower case, with float registers by ABI name: objdump -M
# numeric's f0-f31
our = re.sub(r"\bF[TSA]\d+\b", lambda q: "F%d" % FABI.index(q.group(0)), our.upper())
m = our.split(None, 1)
mn = m[0]
ops = [o.strip() for o in m[1].split(",")] if len(m) > 1 else []
@@ -145,7 +152,7 @@ def same(gnu_mn, gnu_ops, our):
gnu_mn, gnu_ops = "CSRW" + kind, [csr] + gnu_ops
gnu_ops = [str(CSRN[o]) if o in CSRN else o for o in gnu_ops]
ops = [str(CSRN[o]) if o in CSRN else o for o in ops]
alias = {"FENCE.I": "FENCE.I", "UNIMP": "DW"}
alias = {"FENCE.I": "FENCE.I", "UNIMP": ".WORD"}
if alias.get(gnu_mn, gnu_mn) != mn:
return False
# objdump writes "fence iorw,iorw"
@@ -208,7 +215,7 @@ def main():
print("DIS %08X: objdump '%s', monitor '%s'" % (w, g, o))
# round trip through the monitor's assembler, one instruction at 1000h each
bad_asm = 0
back = subprocess.run([HOST, "asm"], input="".join("ORG 1000H\n%s\n" % o for o in ours),
back = subprocess.run([HOST, "asm"], input="".join(".org 0x1000\n%s\n" % o for o in ours),
capture_output=True, text=True).stdout.splitlines()
for w, o, b in zip(ws, ours, back):
want = 0x0FF0000F if (w & 0x707F) == 0x0F else w