trs80m1: rearrange memory so that we get 768 bytes back
authorAlan Cox <alan@linux.intel.com>
Fri, 10 Aug 2018 21:25:29 +0000 (22:25 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 10 Aug 2018 21:25:29 +0000 (22:25 +0100)
We stick the udata/stack over 4100-42FF, and the istack over the boot area at
4300-43FF

Kernel/platform-trs80m1/commonmem.s
Kernel/platform-trs80m1/crt0.s
Kernel/platform-trs80m1/fuzix.lnk
Kernel/platform-trs80m1/kernel.def
Kernel/platform-trs80m1/trs80.s

index bafd590..4ca88b3 100644 (file)
@@ -1,10 +1,41 @@
 ;
-;      We have no real common on the TRS80so just tuck it up at the top of
-;      memory leaving room for the keyboard and video (3K)
+;      We keep this down at 4100-43ff overlaying the original boot up stuff
 ;
         .module commonmem
 
-        .area _COMMONMEM
+        .area _COMMONDATA
 
-       .include "../cpu-z80/std-commonmem.s"
+        .globl _ub
+        .globl _udata
+        .globl kstack_top
+        .globl istack_switched_sp
 
+
+_ub:    ; first 512 bytes: starts with struct u_block, with the kernel stack working down from above
+_udata:
+kstack_base:
+        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0
+        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+kstack_top:
+
+istack_switched_sp: .dw 0
+
+;
+;      We link the pre bank switching setup code in 4400-44FF and a bit
+;      then convert it into istack.
+;
+istack_base:
index f544370..924fc57 100644 (file)
@@ -11,6 +11,8 @@
                ; expand all over it for buffers
                .area _BUFFERS2
                .area _DISCARD2
+               .area _COMMONDATA
+               .area _BOOT
                .area _COMMONMEM
                .area _STUBS
                .area _CONST
 ;
 start:
                ; Take care to preserve A until init_early
-               ld sp, #kstack_top
+               ld sp, #kstack_top      ; just below us
                ; then zero the data area
                ld hl, #s__DATA
                ld de, #s__DATA + 1
                ld bc, #l__DATA - 1
                ld (hl), #0
                ldir
-               ; We pass A into init_eatly holding the mapper type
+               ; We pass A into init_early holding the mapper type
                call init_early
                call init_hardware
                push af
@@ -72,6 +74,6 @@ stop:         halt
                jr stop
 
 
-       .area _STUBS
+               .area _STUBS
 stubs:
-       .ds 768
+               .ds 768
index 6b30c55..103543c 100644 (file)
@@ -5,7 +5,7 @@
 -b _BOOT=0x4300
 -b _CODE1=0x8000
 -b _CODE2=0x8000
--b _COMMONMEM=0x4400
+-b _COMMONDATA=0x4100
 -l z80
 platform-trs80m1/crt0.rel
 platform-trs80m1/commonmem.rel
@@ -53,5 +53,10 @@ platform-trs80m1/devlpr.rel
 platform-trs80m1/devtty.rel
 platform-trs80m1/vtsupport.rel
 platform-trs80m1/devinput.rel
+platform-trs80m1/devide.rel
+platform-trs80m1/blkdev.rel
+platform-trs80m1/mbr.rel
 platform-trs80m1/discard.rel
+platform-trs80m1/devide_discard.rel
+platform-trs80m1/ide.rel
 -e
index 191d859..1407034 100644 (file)
@@ -1,6 +1,6 @@
 ; UZI mnemonics for memory addresses etc
 
-U_DATA                      .equ 0x4400       ; (this is struct u_data from kernel.h)
+U_DATA                      .equ 0x4100       ; (this is struct u_data from kernel.h)
 U_DATA__TOTALSIZE           .equ 0x200        ; 256+256 (we don't save istack)
 
 U_DATA_STASH               .equ 0xFE00       ; FE00-FFFF
index 66aa61b..a0949bd 100644 (file)
             .include "../kernel.def"
 
 ; -----------------------------------------------------------------------------
-; COMMON MEMORY BANK (0xE800 upwards)
+; COMMON MEMORY BANK (0x4000 upwards after the udata etc)
 ; -----------------------------------------------------------------------------
             .area _COMMONMEM
+;
+;      This is linked first after udata and boot, and we turn the boot area
+;      into the istack. Don't screw around with the link order!
+;
+istack_top:
 
 _platform_monitor:
            push af