From bcee768c0995697074dd4388a0d2335ce12cfd0e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 13 Jul 2018 01:26:35 +0100 Subject: [PATCH] trs80m1: switch to separately banked buffers This is a first cut. The buffers.c code needs rewriting. --- Kernel/platform-trs80m1/config.h | 8 ++++---- Kernel/platform-trs80m1/trs80.h | 2 ++ Kernel/platform-trs80m1/trs80.s | 23 ++++++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Kernel/platform-trs80m1/config.h b/Kernel/platform-trs80m1/config.h index 5cc1b4e2..f1b1803b 100644 --- a/Kernel/platform-trs80m1/config.h +++ b/Kernel/platform-trs80m1/config.h @@ -23,6 +23,8 @@ #define CONFIG_INPUT /* Full keycode level grabbing supported */ #define CONFIG_INPUT_GRABMAX 3 +/* External buffers (so we can balance things better) */ +#define CONFIG_BLKBUF_EXTERNAL #define MAX_MAPS 16 /* 512K */ @@ -64,9 +66,7 @@ #define NUM_DEV_TTY 3 #define TTYDEV BOOT_TTY /* Device used by kernel for messages, panics */ #define SWAPDEV (swap_dev) /* Device for swapping (dynamic). */ -#define NBUFS 5 /* Number of block buffers - keep in sync with asm! */ -#define NMOUNTS 2 /* Number of mounts at a time */ -/* Reclaim the discard space for buffers */ -#define CONFIG_DYNAMIC_BUFPOOL +#define NBUFS 10 /* Number of block buffers - keep in sync with asm! */ +#define NMOUNTS 3 /* Number of mounts at a time */ extern void platform_discard(void); diff --git a/Kernel/platform-trs80m1/trs80.h b/Kernel/platform-trs80m1/trs80.h index 7c62a010..32003102 100644 --- a/Kernel/platform-trs80m1/trs80.h +++ b/Kernel/platform-trs80m1/trs80.h @@ -31,3 +31,5 @@ extern uint8_t trs80_mapper; * Note that the Colour Genie is a very different beast. * */ + +extern void bufsetup(void); diff --git a/Kernel/platform-trs80m1/trs80.s b/Kernel/platform-trs80m1/trs80.s index 9394f7dd..90f95f2f 100644 --- a/Kernel/platform-trs80m1/trs80.s +++ b/Kernel/platform-trs80m1/trs80.s @@ -23,9 +23,6 @@ .globl s__COMMONMEM .globl l__COMMONMEM - .globl _bufpool - .globl bufend - .globl _trs80_model ; hard disk helpers @@ -54,11 +51,6 @@ .include "kernel.def" .include "../kernel.def" - .area _BUFFERS - -_bufpool: - .ds BUFSIZE * NBUFS -bufend: ; ----------------------------------------------------------------------------- ; COMMON MEMORY BANK (0xE800 upwards) ; ----------------------------------------------------------------------------- @@ -197,7 +189,12 @@ outchar: ret ; -; Swap helpers +; Swap helpers. +; We have our buffers mapepd in Bank 2 but we don't need to do +; anything here as we are in common memory and we've carefully +; arranged that the device driver callers are in BANK2 thus we'll +; have BANK2 mapped by default, although we may map a user bank +; in temporarily if going direct to user. ; _hd_xfer_in: pop de @@ -233,3 +230,11 @@ _hd_xfer_out: call nz, map_kernel_restore ret + +; +; Storage for buffers. Must be banked with CODE2 +; + .area _DATA2 + .globl _bufdata +_bufdata: + .ds 512 * 10 -- 2.34.1