zx128: link and crt0
authorAlan Cox <alan@linux.intel.com>
Wed, 10 Dec 2014 23:24:55 +0000 (23:24 +0000)
committerAlan Cox <alan@linux.intel.com>
Wed, 10 Dec 2014 23:24:55 +0000 (23:24 +0000)
Call the microdrive init functions
Do the initializer copy (makes no odds if disk loading, matters if ROM)
Shuffle things so that the kernel is at 0x0000->0x3FFF and 0xC000+. The
common, video and other bits then live between 5B and 9F. That leaves us
with A0-BF free plus the C0-FF of the other banks, so we can run somewhat
bigger apps. Not ideal but SDCC hacking is going to be needed to do better
plus teach fuse to emulate banked cartridges.

Memory map open to discussion anyway.

BUG: right now the mdv loader doesn't load 0xFE00-0xFFFF but needs to, need
to move the boot stack first.

Kernel/platform-zx128/crt0.s
Kernel/platform-zx128/uzi.lnk

index 181eb0c..ba198b7 100644 (file)
@@ -9,9 +9,7 @@
         .area _CODE
         .area _COMMONMEM
         .area _DATA
-        .area _CODE2
         .area _VIDEO
-        .area _DISCARD      ; not discarded yet
         .area _CONST
         .area _FONT
         .area _INITIALIZED
         .area _INITIALIZER
         .area _GSINIT
         .area _GSFINAL
+        .area _DISCARD
+       ; In high space
+        .area _CODE2
 
         ; imported symbols
         .globl _fuzix_main
         .globl init_early
         .globl init_hardware
         .globl s__INITIALIZER
+        .globl l__INITIALIZER
+        .globl s__INITIALIZED
         .globl s__COMMONMEM
         .globl l__COMMONMEM
         .globl s__DATA
         .globl l__DATA
         .globl kstack_top
 
+       .globl mdv_boot
 
         .globl unix_syscall_entry
         .globl nmi_handler
@@ -86,8 +90,18 @@ init_continue:
         ld sp, #kstack_top
 
         ; hack for emulator. Read remaining fuzix part to RAM from fuzix.bin
-        ld bc, #0x1ee7
-        in a, (c)
+;        ld bc, #0x1ee7
+;        in a, (c)
+       ld hl, #0x4000
+       ld de, #0x4001
+       ld (hl), #0
+       ld bc, #0x1800
+       ldir
+       ld (hl), #0x7
+       ld bc, #0x02ff
+       ldir
+
+       call mdv_boot
 
         ; Configure memory map
         call init_early
@@ -95,6 +109,12 @@ init_continue:
         ; our COMMONMEM is located in main code-data blob, so we
         ; do not need to move it manually
 
+       ; initialized data
+       ld hl, #s__INITIALIZER
+       ld de, #s__INITIALIZED
+       ld bc, #l__INITIALIZER
+       ldir
+
         ; then zero the data area
         ld hl, #s__DATA
         ld de, #s__DATA + 1
index 7085013..a0c6d6b 100644 (file)
@@ -2,6 +2,7 @@
 -i uzi.ihx
 -b _CODE=0x0000
 -b _COMMONMEM=0x5B00
+-b _CODE2=0xC000
 -l z80
 platform-zx128/crt0.rel
 platform-zx128/commonmem.rel
@@ -17,6 +18,8 @@ timer.rel
 kdata.rel
 usermem.rel
 platform-zx128/devices.rel
+platform-zx128/devmdv.rel
+platform-zx128/microdrive.rel
 devio.rel
 filesys.rel
 process.rel