.globl _switchout
.globl _dofork
.globl map_kernel
+ .globl map_process_always
+ .globl map_save
+ .globl map_restore
.globl unix_syscall_entry
.globl null_handler
.globl nmi_handler
ld hl, #badswitchmsg
call outstring
jp _trap_monitor
+
+map_kernel: ; map the kernel into the low 60K, leaves common memory unchanged
+ push af
+.if DEBUGBANK
+ ld a, #'K'
+ call outchar
+.endif
+ ld a, #(OS_BANK + FIRST_RAM_BANK)
+ out0 (MMU_BBR), a
+ pop af
+ ret
+
+map_process_always: ; map the process into the low 60K based on current common mem (which is unchanged)
+ push af
+.if DEBUGBANK
+ ld a, #'='
+ call outchar
+.endif
+ ld a, (U_DATA__U_PAGE)
+ out0 (MMU_BBR), a
+.if DEBUGBANK
+ call outcharhex
+.endif
+ ; MMU_CBR is left unchanged
+ pop af
+ ret
+
+map_save: ; save the current process/kernel mapping
+ push af
+ in0 a, (MMU_BBR)
+ ld (map_store), a
+ pop af
+ ret
+
+map_restore: ; restore the saved process/kernel mapping
+ push af
+.if DEBUGBANK
+ ld a, #'-'
+ call outchar
+.endif
+ ld a, (map_store)
+ out0 (MMU_BBR), a
+.if DEBUGBANK
+ call outcharhex
+.endif
+ pop af
+ ret
+
+map_store: ; storage for map_save/map_restore
+ .db 0
-This is UZI for the N8VEM Mark IV SBC
+This is Fuzix for the N8VEM Mark IV SBC
By Will Sowerbutts <will@sowerbutts.com>
Assumes an N8VEM Mark IV SBC fitted with 512KB RAM, with the RS232 port as
+++ /dev/null
-.module cpmload
-.area _LOADER (ABS)
-
- ; CP/M will load us at 0x0100
- ; We want to relocate our payload (the kernel) and jump into it.
- ; We put a small stub at the very bottom of memory, copy the kernel into
- ; place above us, then jump into it.
-
- .org 0x100
- di
- ; copy ourselves to the very bottom of memory -- 0x00 upwards
- ld de, #0
- ld hl, #(doload) ; start of loader code
- ld bc, #(endloader-doload) ; length of our loader
- ldir ; copy copy copy!
- ld hl, (load_address)
- ld sp, hl ; stash copy of entry vector in SP for now
- ex de, hl ; load_address to de
- ld hl, #payload_start
- ld bc, (load_length)
- jp 0 ; jump and perform copy in low memory
-
- ; this code gets copied to .org 0
-doload:
- ldir ; copy image into correct place
- ld hl, #0
- add hl, sp ; recover entry vector
- jp (hl) ; run image
-endloader: ; end of code to copy
-
- ; the data is in a trailer, with a 6-byte header:
-load_address:
- .ds 2
-load_length:
- .ds 2
-payload_start:
.globl platform_interrupt_all
.globl _trap_monitor
- .globl map_kernel
- .globl map_process_always
- .globl map_save
- .globl map_restore
- ;.globl map_process_only
-
; imported symbols
.globl z180_init_hardware
.globl z180_init_early
platform_interrupt_all:
ret
-map_kernel: ; map the kernel into the low 60K, leaves common memory unchanged
- push af
-.if DEBUGBANK
- ld a, #'K'
- call outchar
-.endif
- ld a, #(OS_BANK + FIRST_RAM_BANK)
- out0 (MMU_BBR), a
- pop af
- ret
-
-; this "map_process" business makes no sense on mark4 since we'd switch stacks
-; and the RET would thus lose its return address. oh damn. I suppose we could
-; pop the stack address into hl, then jp (hl) or whatever. let's try and get by
-; without it.
-;
-; map_process: ; if HL=0 call map_kernel, else map the full 64K in bank pointed to by HL
-; ld a, h
-; or l
-; jr z, map_kernel
-; ld a, (hl)
-; out0 (MMU_BBR), a
-; out0 (MMU_CBR), a
-; ret
-
-; map_process_only: ; as map_process, but does not modify common memory
-; ld a, h
-; or l
-; jr z, map_kernel
-; ld a, (hl)
-; out0 (MMU_BBR), a
-; ret
-
-map_process_always: ; map the process into the low 60K based on current common mem (which is unchanged)
- push af
-.if DEBUGBANK
- ld a, #'='
- call outchar
-.endif
- ld a, (U_DATA__U_PAGE)
- out0 (MMU_BBR), a
-.if DEBUGBANK
- call outcharhex
-.endif
- ; MMU_CBR is left unchanged
- pop af
- ret
-
-map_save: ; save the current process/kernel mapping
- push af
- in0 a, (MMU_BBR)
- ld (map_store), a
- pop af
- ret
-
-map_restore: ; restore the saved process/kernel mapping
- push af
-.if DEBUGBANK
- ld a, #'-'
- call outchar
-.endif
- ld a, (map_store)
- out0 (MMU_BBR), a
-.if DEBUGBANK
- call outcharhex
-.endif
- pop af
- ret
-
_trap_monitor:
di
call outnewline
call outnewline
halt
jr _trap_monitor
-
-map_store: ; storage for map_save/map_restore
- .db 0
-This is UZI for the DX-Designs P112
+This is Fuzix for the DX-Designs P112
By Will Sowerbutts <will@sowerbutts.com>
Assumes a P112 fitted with 1024KB RAM and G-IDE
{
int i;
- /* N8VEM SBC Mark IV has RAM in the top 512K of physical memory.
+ /* P112 has RAM across the full physical 1MB address space
* First 64K is used by the kernel.
* Each process gets the full 64K for now.
* Page size is 4KB. */
void platform_idle(void)
{
/* Let's go to sleep while we wait for something to interrupt us;
- * Makes the Mark IV's run LED go red, which amuses me greatly. */
+ * sadly no fun LED to change colour */
__asm
halt
__endasm;
.globl platform_interrupt_all
.globl _trap_monitor
- .globl map_kernel
- .globl map_process_always
- .globl map_save
- .globl map_restore
- ;.globl map_process_only
-
; imported symbols
.globl z180_init_hardware
.globl z180_init_early
platform_interrupt_all:
ret
-map_kernel: ; map the kernel into the low 60K, leaves common memory unchanged
- push af
-.if DEBUGBANK
- ld a, #'K'
- call outchar
-.endif
- ld a, #(OS_BANK + FIRST_RAM_BANK)
- out0 (MMU_BBR), a
- pop af
- ret
-
-; this "map_process" business makes no sense on mark4 since we'd switch stacks
-; and the RET would thus lose its return address. oh damn. I suppose we could
-; pop the stack address into hl, then jp (hl) or whatever. let's try and get by
-; without it.
-;
-; map_process: ; if HL=0 call map_kernel, else map the full 64K in bank pointed to by HL
-; ld a, h
-; or l
-; jr z, map_kernel
-; ld a, (hl)
-; out0 (MMU_BBR), a
-; out0 (MMU_CBR), a
-; ret
-
-; map_process_only: ; as map_process, but does not modify common memory
-; ld a, h
-; or l
-; jr z, map_kernel
-; ld a, (hl)
-; out0 (MMU_BBR), a
-; ret
-
-map_process_always: ; map the process into the low 60K based on current common mem (which is unchanged)
- push af
-.if DEBUGBANK
- ld a, #'='
- call outchar
-.endif
- ld a, (U_DATA__U_PAGE)
- out0 (MMU_BBR), a
-.if DEBUGBANK
- call outcharhex
-.endif
- ; MMU_CBR is left unchanged
- pop af
- ret
-
-map_save: ; save the current process/kernel mapping
- push af
- in0 a, (MMU_BBR)
- ld (map_store), a
- pop af
- ret
-
-map_restore: ; restore the saved process/kernel mapping
- push af
-.if DEBUGBANK
- ld a, #'-'
- call outchar
-.endif
- ld a, (map_store)
- out0 (MMU_BBR), a
-.if DEBUGBANK
- call outcharhex
-.endif
- pop af
- ret
-
_trap_monitor:
di
call outnewline
call outnewline
halt
jr _trap_monitor
-
-map_store: ; storage for map_save/map_restore
- .db 0