From 2d3f3e637563b455b4a09652f86677b29131a7a5 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 10 Aug 2018 22:25:29 +0100 Subject: [PATCH] trs80m1: rearrange memory so that we get 768 bytes back We stick the udata/stack over 4100-42FF, and the istack over the boot area at 4300-43FF --- Kernel/platform-trs80m1/commonmem.s | 39 ++++++++++++++++++++++++++--- Kernel/platform-trs80m1/crt0.s | 10 +++++--- Kernel/platform-trs80m1/fuzix.lnk | 7 +++++- Kernel/platform-trs80m1/kernel.def | 2 +- Kernel/platform-trs80m1/trs80.s | 7 +++++- 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/Kernel/platform-trs80m1/commonmem.s b/Kernel/platform-trs80m1/commonmem.s index bafd590b..4ca88b31 100644 --- a/Kernel/platform-trs80m1/commonmem.s +++ b/Kernel/platform-trs80m1/commonmem.s @@ -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, 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 + .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 +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: diff --git a/Kernel/platform-trs80m1/crt0.s b/Kernel/platform-trs80m1/crt0.s index f544370d..924fc572 100644 --- a/Kernel/platform-trs80m1/crt0.s +++ b/Kernel/platform-trs80m1/crt0.s @@ -11,6 +11,8 @@ ; expand all over it for buffers .area _BUFFERS2 .area _DISCARD2 + .area _COMMONDATA + .area _BOOT .area _COMMONMEM .area _STUBS .area _CONST @@ -51,14 +53,14 @@ ; 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 diff --git a/Kernel/platform-trs80m1/fuzix.lnk b/Kernel/platform-trs80m1/fuzix.lnk index 6b30c55d..103543ca 100644 --- a/Kernel/platform-trs80m1/fuzix.lnk +++ b/Kernel/platform-trs80m1/fuzix.lnk @@ -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 diff --git a/Kernel/platform-trs80m1/kernel.def b/Kernel/platform-trs80m1/kernel.def index 191d8592..14070340 100644 --- a/Kernel/platform-trs80m1/kernel.def +++ b/Kernel/platform-trs80m1/kernel.def @@ -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 diff --git a/Kernel/platform-trs80m1/trs80.s b/Kernel/platform-trs80m1/trs80.s index 66aa61bf..a0949bd7 100644 --- a/Kernel/platform-trs80m1/trs80.s +++ b/Kernel/platform-trs80m1/trs80.s @@ -52,9 +52,14 @@ .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 -- 2.34.1