zeta-v2: _trap_reboot now disables memory paging entirely
authorWill Sowerbutts <will@sowerbutts.com>
Mon, 29 Jun 2015 20:53:01 +0000 (21:53 +0100)
committerWill Sowerbutts <will@sowerbutts.com>
Mon, 29 Jun 2015 20:59:15 +0000 (21:59 +0100)
Kernel/platform-zeta-v2/zeta-v2.s

index 0ace3cd..8c7ced3 100644 (file)
@@ -183,6 +183,21 @@ init_partial_uart:
 
        ret
 
+;=========================================================================
+; Kernel code
+;=========================================================================
+        .area _CODE
+
+_trap_reboot:
+        ; We need to map the ROM back in -- ideally into every page.
+        ; This little trick based on a clever suggestion from John Coffman.
+        di
+        ld hl, #(MPGENA << 8) | 0xD3    ; OUT (MPGENA), A
+        ld (0xFFFE), hl                 ; put it at the very top of RAM
+        xor a                           ; A=0
+        jp 0xFFFE                       ; execute it; PC then wraps to 0
+
+
 ;=========================================================================
 ; Common Memory (0xF000 upwards)
 ;=========================================================================
@@ -280,12 +295,6 @@ _program_vectors:
 
        jr map_kernel
 
-_trap_reboot:
-        di
-        xor a                           ; ROM starts at page 0
-        out (MPGSEL_0), a               ; map ROM to low 16K
-        jp 0                            ; jump into ROM
-
 ;=========================================================================
 ; Memory management
 ; - kernel pages:     32 - 34