Machine-code monitor, fast serial, memory files, Ctrl-Alt-Del
Monitor: the CPU gets an NMI (taken at an instruction start, or from HALT) raised by the Pause key, BASIC's MONITOR, two hardware breakpoint comparators or a step counter. It enters through a trampoline at 0066h (the same bytes in BASIC's ROM and the monitor's, basic/tramp.s) that switches in a 32 KB monitor bank over 0000-7FFF. The monitor (monitor/, C) runs on the terminal's new alternate screen (CSI ?47 h/l, a second screen page; graphics hidden) and shows registers, flags, a disassembly from PC, the stack and memory. Commands: Enter/S n step, O step over, G/X go, B breakpoint, D/M windows, E edit, R registers, and SAVE/LOAD/ DIR for memory files. The disassembler covers every opcode; monitor/test-disasm.py round-trips all forms through sdasz80. Lockstep CPU tests still match the reference emulator. BASIC: MONITOR, CALL addr, BSAVE "N",start,len and BLOAD "N"[,addr] (memory files: load address then bytes). The DATE clock moves to F3F8h so the monitor can date files. F000-F3F7 is kept free for machine code (program area 21076 bytes). Serial: SW1:0 = 10 is now 921600 and 11 is 3 Mbaud. A 17 KB burst to BASIC lists back identical at both on the board. send-bas.py reads the echo while sending; unread, it could stall the PC's flow control. Ctrl-Alt-Del in Z-80 mode restarts the Z-80 like BTND. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
767377f38d
commit
634e314010
27 files changed
+37481
-3039
No files matched your search
+2
-2
@@ -17,8 +17,8 @@ import select
|
||||
import termios
|
||||
import time
|
||||
|
||||
BAUDS = {9600: termios.B9600, 19200: termios.B19200, 57600: termios.B57600,
|
||||
115200: termios.B115200}
|
||||
BAUDS = {9600: termios.B9600, 115200: termios.B115200, 921600: termios.B921600,
|
||||
3000000: termios.B3000000}
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("file", nargs="?", help="where to write the listing")
|
||||
|
||||
+11
-2
@@ -10,11 +10,12 @@ SW1:0. Sets BASIC's clock to the PC's (unless --no-date), sends NEW unless
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import select
|
||||
import termios
|
||||
import time
|
||||
|
||||
BAUDS = {9600: termios.B9600, 19200: termios.B19200, 57600: termios.B57600,
|
||||
115200: termios.B115200}
|
||||
BAUDS = {9600: termios.B9600, 115200: termios.B115200, 921600: termios.B921600,
|
||||
3000000: termios.B3000000}
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("file")
|
||||
@@ -41,10 +42,18 @@ if a.run:
|
||||
lines.append("RUN")
|
||||
if not a.no_date:
|
||||
lines.insert(0, time.strftime('DATE "%Y-%m-%d %H:%M:%S"'))
|
||||
t[6][termios.VMIN] = 0 # reads don't wait
|
||||
t[6][termios.VTIME] = 0
|
||||
termios.tcsetattr(fd, termios.TCSANOW, t)
|
||||
for n, line in enumerate(lines, 1):
|
||||
os.write(fd, line.encode("ascii") + b"\r")
|
||||
termios.tcdrain(fd)
|
||||
time.sleep(0.02) # let BASIC store the line
|
||||
# Read BASIC's echo (copied back when SW14 is up). Left unread, it fills the
|
||||
# PC's input buffer; Linux then stops reading the port, misses the board's
|
||||
# XON and never sends again.
|
||||
while select.select([fd], [], [], 0)[0] and os.read(fd, 4096):
|
||||
pass
|
||||
print("\r%d/%d lines" % (n, len(lines)), end="", flush=True)
|
||||
print()
|
||||
os.close(fd)
|
||||
Reference in new issue
Block a user