From de9a3869a13bc7368a6129f1ab517b4e130db082 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 15 Aug 2017 22:20:50 +0100 Subject: [PATCH] plus3: do some initial changes At this point we are not yet booting. We start the image but not everything ends up in the right place to enter the C code --- Kernel/platform-plus3/README.md | 1 + Kernel/platform-plus3/crt0.s | 9 +++------ Kernel/platform-plus3/fuzix.lnk | 7 ++++--- Kernel/platform-plus3/plus3.s | 24 ++++-------------------- Kernel/platform-plus3/zxvideo.s | 3 ++- 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/Kernel/platform-plus3/README.md b/Kernel/platform-plus3/README.md index 6e211ba7..000348af 100644 --- a/Kernel/platform-plus3/README.md +++ b/Kernel/platform-plus3/README.md @@ -26,6 +26,7 @@ We then map 0/1/2/3 - user process 0: 48K, 16K common 4/5/6/3 - user process 1: 32K, 16K common, 16K is kernel reserved 4/7/6/3 - kernel: 48K minus screen, common 16K (some kernel in it) + (conveniently the map 'BOOT' uses) As an aside this only works for the +2A/+3. The various clones even with lots of RAM clone the original 128K and add more pages of memory in the top diff --git a/Kernel/platform-plus3/crt0.s b/Kernel/platform-plus3/crt0.s index 2d93b0fe..b50fb7b8 100644 --- a/Kernel/platform-plus3/crt0.s +++ b/Kernel/platform-plus3/crt0.s @@ -2,14 +2,12 @@ .module crt0 - ; - ; Bank 4-7 - ; - .area _CODE - .area _CODE2 + .area _CODE ; Code lives at 0000-0x3FFF in bank 4 + .area _CODE2 ; Lives at 0x5B00 onwards in bank 7/6 .area _CODE3 .area _CONST .area _VIDEO + .area _FONT .area _INITIALIZED .area _DATA .area _BSEG @@ -21,7 +19,6 @@ .area _GSINIT .area _GSFINAL .area _DISCARD - .area _FONT ; ; Above 0xC000 in the top of bank 3 ; diff --git a/Kernel/platform-plus3/fuzix.lnk b/Kernel/platform-plus3/fuzix.lnk index e4f6246b..29de6f78 100644 --- a/Kernel/platform-plus3/fuzix.lnk +++ b/Kernel/platform-plus3/fuzix.lnk @@ -1,9 +1,10 @@ -mwxuy --r -i fuzix.ihx -b _COMMONDATA=0xF800 --b _CODE=0x0000 --b _DISCARD=0xC000 +-b _COMMONMEM=0xF000 +-b _CODE=0x0100 +-b _CODE2=0x5B00 +-b _DISCARD=0xE400 -l z80 platform-plus3/crt0.rel platform-plus3/commonmem.rel diff --git a/Kernel/platform-plus3/plus3.s b/Kernel/platform-plus3/plus3.s index 36ac2561..088af138 100644 --- a/Kernel/platform-plus3/plus3.s +++ b/Kernel/platform-plus3/plus3.s @@ -27,8 +27,6 @@ .globl map_restore .globl map_process_save .globl map_kernel_restore - .globl map_video - .globl unmap_video .globl map_for_swap .globl _need_resched @@ -97,11 +95,10 @@ init_hardware: ld hl, #(128 - 64) ; 64K for kernel/screen/etc ld (_procmem), hl - call map_video ; screen initialization ; clear - ld hl, #0xC000 - ld de, #0xC001 + ld hl, #0x4000 + ld de, #0x4001 ld bc, #0x1800 ; There should be 0x17FF, but we are going xor a ; to copy additional byte to avoid need of ld (hl), a ; DE and HL increment before attribute @@ -113,7 +110,6 @@ init_hardware: ld (hl), a ldir - call unmap_video ret ;------------------------------------------------------------------------------ @@ -160,8 +156,7 @@ _program_vectors: switch_kernel: ld a, (port_map) - and #0xF8 ; Preserve the other bits - or #0x05 ; Map 4,5,6,3 + or #0x07 ; Map 4,7,6,3 switchit: push bc ld (port_map), a @@ -174,11 +169,7 @@ switch_user: ld a, (port_map) and #0xF8 ; Preserve the other bits and #0x01 ; Map 0,1,2,3 - jr switch_kernel - -switch_video: - ld a, (port_map) - or #0x7 ; Map 4,7,6,3 + or #0x04 jr switchit map_process: @@ -192,7 +183,6 @@ map_process_always: pop af ret -unmap_video: map_kernel: map_kernel_restore: push af @@ -200,12 +190,6 @@ map_kernel_restore: pop af ret -map_video: - push af - call switch_video - pop af - ret - map_save: push af ld a, (port_map) diff --git a/Kernel/platform-plus3/zxvideo.s b/Kernel/platform-plus3/zxvideo.s index 0efba37f..47ba3762 100644 --- a/Kernel/platform-plus3/zxvideo.s +++ b/Kernel/platform-plus3/zxvideo.s @@ -35,7 +35,7 @@ videopos: ld e,a ld a,d and #0x18 - or #0xC0 ; not 0x40 as in screen 7 + or #0x40 ; page 7 is mapped here ld d,a ret @@ -71,6 +71,7 @@ nofiddle: rl b ld c, a + ; FIXME: Can't do this any more! ld hl, #0x3C00 ; ROM font add hl, bc ; hl points to first byte of char data -- 2.34.1