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
+115
@@ -0,0 +1,115 @@
|
||||
;; Monitor start-up. The monitor's bank holds ROM at 0000-6FFF and RAM at
|
||||
;; 7000-7FFF. It is entered through the trampoline at 0066h (shared with
|
||||
;; BASIC) with the program's AF and PC pushed on the program's stack.
|
||||
.module crt0
|
||||
.globl _mon_main
|
||||
.globl l__INITIALIZER, s__INITIALIZER, s__INITIALIZED
|
||||
.globl l__DATA, s__DATA
|
||||
.globl _u
|
||||
|
||||
;; saved registers, at a fixed place gsinit never clears (see struct regs)
|
||||
_u = 0x7F00
|
||||
U_SP = 0x7F00
|
||||
U_BC = 0x7F02
|
||||
U_DE = 0x7F04
|
||||
U_HL = 0x7F06
|
||||
U_IX = 0x7F08
|
||||
U_IY = 0x7F0A
|
||||
U_AF2 = 0x7F0C
|
||||
U_BC2 = 0x7F0E
|
||||
U_DE2 = 0x7F10
|
||||
U_HL2 = 0x7F12
|
||||
U_I = 0x7F14
|
||||
U_R = 0x7F15
|
||||
U_EXIT = 0x7F16
|
||||
INITED = 0x7FFE
|
||||
|
||||
.area _HEADER (ABS)
|
||||
.org 0x0000
|
||||
halt ; the bank is never in at reset
|
||||
.include "../basic/tramp.s"
|
||||
|
||||
.org 0x0100
|
||||
entry: ld (U_SP), sp
|
||||
ld sp, #0x7F00
|
||||
ld (U_BC), bc
|
||||
ld (U_DE), de
|
||||
ld (U_HL), hl
|
||||
ld (U_IX), ix
|
||||
ld (U_IY), iy
|
||||
ex af, af'
|
||||
push af
|
||||
pop hl
|
||||
ld (U_AF2), hl
|
||||
ex af, af'
|
||||
exx
|
||||
ld (U_BC2), bc
|
||||
ld (U_DE2), de
|
||||
ld (U_HL2), hl
|
||||
exx
|
||||
ld a, i
|
||||
ld (U_I), a
|
||||
ld a, r
|
||||
ld (U_R), a
|
||||
ld a, (INITED) ; C data is set up once, then kept
|
||||
cp #0xA5
|
||||
jr z, 1$
|
||||
call gsinit
|
||||
ld a, #0xA5
|
||||
ld (INITED), a
|
||||
1$: call _mon_main
|
||||
ld a, (U_I)
|
||||
ld i, a
|
||||
ld hl, (U_AF2)
|
||||
push hl
|
||||
pop af
|
||||
ex af, af'
|
||||
exx
|
||||
ld bc, (U_BC2)
|
||||
ld de, (U_DE2)
|
||||
ld hl, (U_HL2)
|
||||
exx
|
||||
ld bc, (U_BC)
|
||||
ld de, (U_DE)
|
||||
ld hl, (U_HL)
|
||||
ld ix, (U_IX)
|
||||
ld iy, (U_IY)
|
||||
ld sp, (U_SP)
|
||||
ld a, (U_EXIT)
|
||||
jp 0x0070
|
||||
|
||||
.area _HOME
|
||||
.area _CODE
|
||||
.area _INITIALIZER
|
||||
.area _GSINIT
|
||||
.area _GSFINAL
|
||||
.area _DATA
|
||||
.area _INITIALIZED
|
||||
.area _BSEG
|
||||
.area _BSS
|
||||
.area _HEAP
|
||||
|
||||
.area _GSINIT
|
||||
gsinit:
|
||||
ld bc, #l__DATA ; clear uninitialised data
|
||||
ld a, b
|
||||
or a, c
|
||||
jr z, 1$
|
||||
ld hl, #s__DATA
|
||||
ld (hl), #0
|
||||
dec bc
|
||||
ld a, b
|
||||
or a, c
|
||||
jr z, 1$
|
||||
ld de, #s__DATA + 1
|
||||
ldir
|
||||
1$: ld bc, #l__INITIALIZER ; copy initialised data
|
||||
ld a, b
|
||||
or a, c
|
||||
jr z, 2$
|
||||
ld de, #s__INITIALIZED
|
||||
ld hl, #s__INITIALIZER
|
||||
ldir
|
||||
2$:
|
||||
.area _GSFINAL
|
||||
ret
|
||||
Reference in new issue
Block a user