From: Brett Gordon Date: Sun, 2 Oct 2016 19:36:49 +0000 (-0400) Subject: coco3: use indirect queues X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=45e62eedb3f31e61458a6e205d8f899cba5979a5;p=FUZIX.git coco3: use indirect queues --- diff --git a/Kernel/platform-coco3/config.h b/Kernel/platform-coco3/config.h index 3e025cbc..d4a3d051 100644 --- a/Kernel/platform-coco3/config.h +++ b/Kernel/platform-coco3/config.h @@ -96,3 +96,9 @@ extern unsigned char vt_map( unsigned char c ); #define CONFIG_LEVEL_2 #define CONFIG_NET #define CONFIG_NET_NATIVE + +/* redefine tty queue primitives to use our banking ones */ +#define CONFIG_INDIRECT_QUEUES +typedef unsigned char *queueptr_t; +#define GETQ(p) getq(p) +#define PUTQ(p, v) putq((p), (v)) diff --git a/Kernel/platform-coco3/devtty.c b/Kernel/platform-coco3/devtty.c index 250328b3..104948d0 100644 --- a/Kernel/platform-coco3/devtty.c +++ b/Kernel/platform-coco3/devtty.c @@ -28,19 +28,19 @@ extern uint8_t hz; uint8_t vtattr_cap; -uint8_t tbuf1[TTYSIZ]; /* console 0 */ -uint8_t tbuf2[TTYSIZ]; /* console 1 */ -uint8_t tbuf3[TTYSIZ]; /* drivewire VSER 0 */ -uint8_t tbuf4[TTYSIZ]; /* drivewire VSER 1 */ -uint8_t tbuf5[TTYSIZ]; /* drivewire VSER 2 */ -uint8_t tbuf6[TTYSIZ]; /* drivewire VSER 3 */ -uint8_t tbuf7[TTYSIZ]; /* drivewire VWIN 0 */ -uint8_t tbuf8[TTYSIZ]; /* drivewire VWIN 1 */ -uint8_t tbuf9[TTYSIZ]; /* drivewire VWIN 2 */ -uint8_t tbufa[TTYSIZ]; /* drivewire VWIN 3 */ - - -struct s_queue ttyinq[NUM_DEV_TTY + 1] = { +#define tbuf1 (uint8_t *)(0x2000+TTYSIZ*0) +#define tbuf2 (uint8_t *)(0x2000+TTYSIZ*1) +#define tbuf3 (uint8_t *)(0x2000+TTYSIZ*2) +#define tbuf4 (uint8_t *)(0x2000+TTYSIZ*3) +#define tbuf5 (uint8_t *)(0x2000+TTYSIZ*4) +#define tbuf6 (uint8_t *)(0x2000+TTYSIZ*5) +#define tbuf7 (uint8_t *)(0x2000+TTYSIZ*6) +#define tbuf8 (uint8_t *)(0x2000+TTYSIZ*7) +#define tbuf9 (uint8_t *)(0x2000+TTYSIZ*8) +#define tbufa (uint8_t *)(0x2000+TTYSIZ*9) + + +struct s_queue ttyinq[NUM_DEV_TTY + 1] = { /* ttyinq[0] is never used */ {NULL, NULL, NULL, 0, 0, 0}, /* GIME Consoles */ diff --git a/Kernel/platform-coco3/main.c b/Kernel/platform-coco3/main.c index ffe004ae..2bc2f831 100644 --- a/Kernel/platform-coco3/main.c +++ b/Kernel/platform-coco3/main.c @@ -69,7 +69,7 @@ void pagemap_init(void) /* We have 64 8k pages for a CoCo3 so insert every other one * into the kernel allocator map. */ - for (i = 10; i < max ; i+=2) + for (i = 12; i < max ; i+=2) pagemap_add(i); /* add common page last so init gets it */ pagemap_add(6); diff --git a/Kernel/platform-coco3/videoll.s b/Kernel/platform-coco3/videoll.s index 0b6f8b09..5b6c9c7a 100644 --- a/Kernel/platform-coco3/videoll.s +++ b/Kernel/platform-coco3/videoll.s @@ -11,6 +11,8 @@ .globl _video_read .globl _video_write .globl _video_cmd + .globl _putq + .globl _getq include "kernel.def" include "../kernel09.def" @@ -125,3 +127,38 @@ b@ ldb ,x+ ; get a byte from src dec 1,y ; bump row counter bne a@ ; loop puls u,y,pc ; restore regs, return + + +;;; +;;; Low Level Queueing Routine +;;; + + +;;; Put a character into tty queue +;;; void putq( uint8_t *ptr, uint8_t c ) +;;; takes: B = character, X = ptr to buffer (in queue-space) +;;; modifies: A +_putq + pshs cc ; save interrupt state + orcc #0x50 ; stop interrupt till we restore map + lda #10 ; mmu page 10 for queue structs + sta 0xffa9 ; + stb ,x ; store the character + lda #1 ; restore kernel map + sta 0xffa9 ; + puls cc,pc ; restore interrupts, return + +;;; Gets a character from tty queue +;;; uint8_t getq( uint8_t *ptr ) +;;; takes: X = ptr to buffer (in queue-space) +;;; returns: B = retrieved character +;;; modifies: nothing +_getq + pshs cc ; save interrupt state + orcc #0x50 ; stop interrupt till we restore map + lda #10 ; mmu page 10 for queue structs + sta 0xffa9 ; + ldb ,x + lda #1 ; restore kernel map + sta 0xffa9 ; + puls cc,pc ; restore interrupts, return \ No newline at end of file