monitor-z80: allow moving to different segments (updates p112, n8vem-mark4)
authorWill Sowerbutts <will@sowerbutts.com>
Mon, 2 Feb 2015 23:28:57 +0000 (23:28 +0000)
committerWill Sowerbutts <will@sowerbutts.com>
Tue, 3 Feb 2015 13:27:58 +0000 (13:27 +0000)
Kernel/lib/monitor-z80.s
Kernel/platform-n8vem-mark4/monitor.s
Kernel/platform-p112/monitor.s

index 190a157..57d2e27 100644 (file)
@@ -9,11 +9,10 @@
 ;   I arg1         - input from port address arg1
 ;   O arg1 arg2    - output arg2 to port address arg1
 
-                .module monitor-z80
                 .z80
 
                 ; exported symbols
-                .globl _trap_monitor
+                .globl monitor_entry
 
                 ; imported symbols
                 .globl inchar
                 .globl outnewline
                 .globl outstring
 
-                .area _COMMONMEM
+                ; NOTE: no .area declaration -- this file should be
+                ; .include'd from platform code (see monitor.s in
+                ; platform-p112 or platform-n8vem-mark4)
 
 ; expect to arrive here with return PC on stack
-_trap_monitor:  di                      ; turn off pesky interrupts
+monitor_entry:  di                      ; turn off pesky interrupts
                 ld hl, #0
                 add hl, sp              ; save SP
                 pop bc                  ; save PC
index 656d650..83af254 100644 (file)
@@ -1,19 +1,32 @@
 ; 2015-01-17 William R Sowerbutts
+
                 .module monitor
                 .include "kernel.def"
+                .globl _trap_monitor
+                .globl map_kernel
 
-.ifne USE_FANCY_MONITOR
+; -----------------------------------------------------------------------------
+.ifne USE_FANCY_MONITOR ; -----------------------------------------------------
+                .area _CODE ; actual monitor lives in kernel bank
                 .include "../lib/monitor-z80.s"
-.else
+
+                .area _COMMONMEM ; just a stub goes in common memory
+_trap_monitor:
+                di
+                call map_kernel
+                jp monitor_entry
+
+
+; -----------------------------------------------------------------------------
+.else ; MICRO MONITOR ---------------------------------------------------------
                 .globl outchar
                 .globl outnewline
                 .globl outhl
-                .globl _trap_monitor
 
-                ; micro monitor -
-                ; just dumps a few words from the stack
+                .area _COMMONMEM
 _trap_monitor:  di
                 call outnewline
+                ; just dump a few words from the stack
                 ld b, #50
 stacknext:      pop hl
                 call outhl
index 656d650..83af254 100644 (file)
@@ -1,19 +1,32 @@
 ; 2015-01-17 William R Sowerbutts
+
                 .module monitor
                 .include "kernel.def"
+                .globl _trap_monitor
+                .globl map_kernel
 
-.ifne USE_FANCY_MONITOR
+; -----------------------------------------------------------------------------
+.ifne USE_FANCY_MONITOR ; -----------------------------------------------------
+                .area _CODE ; actual monitor lives in kernel bank
                 .include "../lib/monitor-z80.s"
-.else
+
+                .area _COMMONMEM ; just a stub goes in common memory
+_trap_monitor:
+                di
+                call map_kernel
+                jp monitor_entry
+
+
+; -----------------------------------------------------------------------------
+.else ; MICRO MONITOR ---------------------------------------------------------
                 .globl outchar
                 .globl outnewline
                 .globl outhl
-                .globl _trap_monitor
 
-                ; micro monitor -
-                ; just dumps a few words from the stack
+                .area _COMMONMEM
 _trap_monitor:  di
                 call outnewline
+                ; just dump a few words from the stack
                 ld b, #50
 stacknext:      pop hl
                 call outhl