From cb143b12b422171b94b68ed69caf938817519d1a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 5 Mar 2019 23:06:16 +0000 Subject: [PATCH] pentagon: bring back pieces from the pentagon1024 There is still much to be done to support older Pentagons but keep the tree in sync --- Kernel/platform-pentagon/Makefile | 4 +- Kernel/platform-pentagon/README | 8 +- Kernel/platform-pentagon/config.h | 2 + Kernel/platform-pentagon/devtty.c | 149 ----------------------------- Kernel/platform-pentagon/fuzix.lnk | 2 +- Kernel/platform-pentagon/rules.mk | 2 + 6 files changed, 13 insertions(+), 154 deletions(-) delete mode 100644 Kernel/platform-pentagon/devtty.c diff --git a/Kernel/platform-pentagon/Makefile b/Kernel/platform-pentagon/Makefile index 0b5adba5..e6395b3f 100644 --- a/Kernel/platform-pentagon/Makefile +++ b/Kernel/platform-pentagon/Makefile @@ -1,9 +1,9 @@ -CSRCS = devtty.c devices.c main.c +CSRCS = devices.c main.c CDSRCS = discard.c DSRCS = ../dev/devide.c ../dev/devsd.c ../dev/blkdev.c DDSRCS = ../dev/devide_discard.c ../dev/devsd_discard.c ../dev/mbr.c DZSRCS = ../dev/zx/nemoide.c ../dev/zx/zxmmc.c ../dev/zx/zxkeyboard.c -DZSRCS += ../dev/zx/devinput.c ../dev/zx/bankbig.c +DZSRCS += ../dev/zx/devinput.c ../dev/zx/bankbig.c ../dev/zx/zxtty.c DDZSRCS = ASRCS = crt0.s pentagon.s zxvideo.s ASRCS += tricks.s commonmem.s diff --git a/Kernel/platform-pentagon/README b/Kernel/platform-pentagon/README index e69cea93..f2646bc0 100644 --- a/Kernel/platform-pentagon/README +++ b/Kernel/platform-pentagon/README @@ -56,14 +56,18 @@ to page 2 due to the memory manager liits. To Do: - Debug the rest -- Write SMUC and Nemo ATA driver code +- Write SMUC driver code - Work out what we need to do for Pentagon v Scorpion etc - Floppy driver +- Optimizations for switching (runticks expiry on non-preempt case + should we clear runticks - pro it gets us better perf, anti it reduces + responsiveness. +- Parent first support + - Why does ls /bin lose the lowest pixel row of the 'yes' command ? (Seems we lose the bottom line of the left most char - off by one bug in zxvid ?) -- Enable interrupts during swap - 6 or 5bit wide fonts (42, 51 column) - Optimize zxvid - especially scrolling - Move vtborder to common diff --git a/Kernel/platform-pentagon/config.h b/Kernel/platform-pentagon/config.h index 7bbd4bf9..41063b23 100644 --- a/Kernel/platform-pentagon/config.h +++ b/Kernel/platform-pentagon/config.h @@ -29,6 +29,8 @@ #define CONFIG_DYNAMIC_BUFPOOL #define CONFIG_DYNAMIC_SWAP +/* Tell the spectrum devtty layer where graphics is mapped */ +#define CONFIG_GFXBASE 0x4000 /* Custom banking */ /* A 1MB machine has 64 blocks and the kernel plus system pages eat diff --git a/Kernel/platform-pentagon/devtty.c b/Kernel/platform-pentagon/devtty.c deleted file mode 100644 index 61003df9..00000000 --- a/Kernel/platform-pentagon/devtty.c +++ /dev/null @@ -1,149 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static char tbuf1[TTYSIZ]; - -uint8_t vtattr_cap = VTA_INVERSE|VTA_FLASH|VTA_UNDERLINE; -uint8_t vtborder; -uint8_t curattr = 7; - -static tcflag_t console_mask[4] = { - _ISYS, - _OSYS, - _CSYS, - _LSYS -}; - -tcflag_t *termios_mask[NUM_DEV_TTY + 1] = { - NULL, - console_mask -}; - - -struct s_queue ttyinq[NUM_DEV_TTY + 1] = { /* ttyinq[0] is never used */ - {NULL, NULL, NULL, 0, 0, 0}, - {tbuf1, tbuf1, tbuf1, TTYSIZ, 0, TTYSIZ / 2}, -}; - -/* tty1 is the screen */ - -/* Output for the system console (kprintf etc) */ -void kputchar(char c) -{ - if (c == '\n') - tty_putc(0, '\r'); - tty_putc(0, c); -} - -/* Both console and debug port are always ready */ -ttyready_t tty_writeready(uint8_t minor) -{ - minor; - return TTY_READY_NOW; -} - -void tty_putc(uint8_t minor, unsigned char c) -{ - minor; - vtoutput(&c, 1); -} - -int tty_carrier(uint8_t minor) -{ - minor; - return 1; -} - -void tty_setup(uint8_t minor, uint8_t flags) -{ - minor; -} - -void tty_sleeping(uint8_t minor) -{ - minor; -} - -void tty_data_consumed(uint8_t minor) -{ -} - - -/* This is used by the vt asm code, but needs to live in the kernel */ -uint16_t cursorpos; - -static struct display specdisplay = { - 0, - 256, 192, - 256, 192, - 0xFF, 0xFF, - FMT_SPECTRUM, - HW_UNACCEL, - GFX_VBLANK|GFX_MAPPABLE|GFX_TEXT, - 0 -}; - -static struct videomap specmap = { - 0, - 0, - 0x4000, - 6912, - 0, - 0, - 0, - MAP_FBMEM|MAP_FBMEM_SIMPLE -}; - -/* - * Graphics ioctls. Very minimal for this platform. It's a single fixed - * mode with direct memory mapping. - */ -int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr) -{ - if (minor != 1 || arg >> 8 != 0x03) - return vt_ioctl(minor, arg, ptr); - switch(arg) { - case GFXIOC_GETINFO: - return uput(&specdisplay, ptr, sizeof(struct display)); - case GFXIOC_MAP: - return uput(&specmap, ptr, sizeof(struct videomap)); - case GFXIOC_UNMAP: - return 0; - case GFXIOC_WAITVB: - /* Our system clock is vblank */ - timer_wait++; - psleep(&timer_interrupt); - timer_wait--; - chksigs(); - if (udata.u_cursig) { - udata.u_error = EINTR; - return -1; - } - return 0; - } - return -1; -} - -void vtattr_notify(void) -{ - /* Attribute byte fixups: not hard as the colours map directly - to the spectrum ones */ - if (vtattr & VTA_INVERSE) - curattr = ((vtink & 7) << 3) | (vtpaper & 7); - else - curattr = (vtink & 7) | ((vtpaper & 7) << 3); - if (vtattr & VTA_FLASH) - curattr |= 0x80; - /* How to map the bright bit - we go by either */ - if ((vtink | vtpaper) & 0x10) - curattr |= 0x40; -} diff --git a/Kernel/platform-pentagon/fuzix.lnk b/Kernel/platform-pentagon/fuzix.lnk index 736ab54a..195c964e 100644 --- a/Kernel/platform-pentagon/fuzix.lnk +++ b/Kernel/platform-pentagon/fuzix.lnk @@ -40,7 +40,7 @@ platform-pentagon/bankbig.rel swap.rel devsys.rel devinput.rel -platform-pentagon/devtty.rel +platform-pentagon/zxtty.rel platform-pentagon/devide.rel platform-pentagon/devide_discard.rel platform-pentagon/devsd.rel diff --git a/Kernel/platform-pentagon/rules.mk b/Kernel/platform-pentagon/rules.mk index 58567b35..c0539a62 100644 --- a/Kernel/platform-pentagon/rules.mk +++ b/Kernel/platform-pentagon/rules.mk @@ -2,6 +2,8 @@ # ZX128 uses banked kernel images # CROSS_CCOPTS += --external-banker + +CFLAGS += -Idev/zx/ # # Tell the core code we are using the banked helpers # -- 2.34.1