From: Alan Cox Date: Fri, 21 Sep 2018 22:40:21 +0000 (+0100) Subject: trs80m1: rework the code to avoid banking fixup problems X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=2e6ffc50aa0f90a8ee0f4ee0619be77bbde0289b;p=FUZIX.git trs80m1: rework the code to avoid banking fixup problems --- diff --git a/Kernel/platform-trs80m1/devices.c b/Kernel/platform-trs80m1/devices.c index 5962de14..90159b4a 100644 --- a/Kernel/platform-trs80m1/devices.c +++ b/Kernel/platform-trs80m1/devices.c @@ -38,6 +38,10 @@ struct devsw dev_tab[] = /* The device driver switch table */ { blkdev_open, no_close, blkdev_read, blkdev_write, blkdev_ioctl }, }; +static struct devsw floppy3 = { + fd3_open, no_close, fd3_read, fd3_write, no_ioctl +}; + bool validdev(uint16_t dev) { /* This is a bit uglier than needed but the right hand side is @@ -50,10 +54,6 @@ bool validdev(uint16_t dev) void floppy_setup(void) { - if (trs80_model == TRS80_MODEL3) { - dev_tab[1].dev_open = fd3_open; - dev_tab[1].dev_read = fd3_read; - dev_tab[1].dev_write = fd3_write; - dev_tab[8].dev_open = nxio_open; - } + if (trs80_model == TRS80_MODEL3) + memcpy(dev_tab + 1, &floppy3, sizeof(struct devsw)); } diff --git a/Kernel/platform-trs80m1/devstringy.c b/Kernel/platform-trs80m1/devstringy.c index 1b9169f2..9b1a87da 100644 --- a/Kernel/platform-trs80m1/devstringy.c +++ b/Kernel/platform-trs80m1/devstringy.c @@ -4,6 +4,7 @@ #include #include #include +#include #include /* @@ -62,7 +63,7 @@ int tape_open(uint8_t minor, uint16_t flag) uint8_t unit; /* Check for the floppy tape ROM */ - if (*((uint16_t *)0x3034) != 0x3C3C) { + if (trs80_model == TRS80_MODEL3 || *((uint16_t *)0x3034) != 0x3C3C) { udata.u_error = ENODEV; return -1; }