plus3: do some initial changes
authorAlan Cox <alan@linux.intel.com>
Tue, 15 Aug 2017 21:20:50 +0000 (22:20 +0100)
committerAlan Cox <alan@linux.intel.com>
Tue, 15 Aug 2017 21:20:50 +0000 (22:20 +0100)
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
Kernel/platform-plus3/crt0.s
Kernel/platform-plus3/fuzix.lnk
Kernel/platform-plus3/plus3.s
Kernel/platform-plus3/zxvideo.s

index 6e211ba..000348a 100644 (file)
@@ -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
index 2d93b0f..b50fb7b 100644 (file)
@@ -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
        ;
index e4f6246..29de6f7 100644 (file)
@@ -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
index 36ac256..088af13 100644 (file)
@@ -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)
index 0efba37..47ba376 100644 (file)
@@ -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