Monitor: Z-80 assembler (ASM "file", A addr)
Two-pass table-driven assembler in the monitor: assembles BASIC-saved source files from the file system, or one line at a time with A addr. Labels, EQU/ORG/DB/DW/DS/END, expressions. Table generated from the disassembler (tools/gen-asmtab.py); round-trip and sdasz80 tests, plus a Z-80 build run in z80emu. Monitor RAM grows to 6000-7FFF for the symbol table. Works around an SDCC 4.5 inline strcpy bug with s_copy(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
88b5942da5
commit
fe1daf180d
16 files changed
+14320
-13257
No files matched your search
+21
-1
@@ -455,11 +455,31 @@ module tb_terminal;
|
||||
uart_str("CLS:POKE 36864,0:BLOAD \"MEM1\":BSAVE \"MEM2\",36864,2:BLOAD \"MEM2\",36866:PRINT PEEK(36866);PEEK(36867)\015");
|
||||
wait_row(0, " 72 73");
|
||||
|
||||
// ---- the assembler: source typed into BASIC, saved, assembled by the monitor
|
||||
uart_str({"NEW\01510 ORG 0F000H\01520 START: LD HL,MSG\01530 LOOP: LD A,(HL)\01540 OR A\015",
|
||||
"50 RET Z\01560 LD C,A\01570 WAIT: IN A,(0)\01580 AND 2\01590 JR Z,WAIT\015"});
|
||||
uart_str({"100 LD A,C\015110 OUT (1),A\015120 INC HL\015130 JR LOOP\015",
|
||||
"140 MSG: DB \"ASM OK\",0 ; THE MESSAGE\015SAVE \"HELLO\"\015MONITOR\015"});
|
||||
wait_at(29, 0, "> ");
|
||||
uart_str("ASM \"HELLO\"\015");
|
||||
wait_at(29, 40, "ASSEMBLED F000-F019");
|
||||
uart_str("A F100\015LD A,42H\015\015");
|
||||
wait_at(5, 2, "F100 3E 42");
|
||||
uart_str("X\015");
|
||||
#3_000_000;
|
||||
uart_str("CLS:CALL 61440\015");
|
||||
wait_row(0, "ASM OK");
|
||||
|
||||
// ---- Ctrl-Alt-Del restarts the Z-80
|
||||
ps2_send(8'h14); ps2_send(8'h11); ps2_send(8'hE0); ps2_send(8'h71);
|
||||
ps2_send(8'hE0); ps2_send(8'hF0); ps2_send(8'h71); ps2_send(8'hF0); ps2_send(8'h11);
|
||||
ps2_send(8'hF0); ps2_send(8'h14);
|
||||
wait_row(4, "DARTMOUTH-STYLE BASIC"); // the restarted BASIC's banner
|
||||
// the restarted BASIC's banner, on whichever row it lands
|
||||
t_cmd = $realtime;
|
||||
while ({cellraw(2, 0), cellraw(2, 1)} != "DA" && {cellraw(3, 0), cellraw(3, 1)} != "DA" &&
|
||||
{cellraw(4, 0), cellraw(4, 1)} != "DA" && $realtime - t_cmd < 50_000_000) #100_000;
|
||||
if ($realtime - t_cmd < 50_000_000) $display("PASS Ctrl-Alt-Del restarted BASIC");
|
||||
else begin $display("FAIL Ctrl-Alt-Del: no banner"); errors = errors + 1; end
|
||||
dump_screen;
|
||||
if (errors == 0) $display("ALL TESTS PASSED");
|
||||
else $display("%0d TESTS FAILED", errors);
|
||||
|
||||
Reference in new issue
Block a user