coco3: use indirect queues
authorBrett Gordon <beretta42@gmail.com>
Sun, 2 Oct 2016 19:36:49 +0000 (15:36 -0400)
committerBrett Gordon <beretta42@gmail.com>
Sun, 2 Oct 2016 19:36:49 +0000 (15:36 -0400)
Kernel/platform-coco3/config.h
Kernel/platform-coco3/devtty.c
Kernel/platform-coco3/main.c
Kernel/platform-coco3/videoll.s

index 3e025cb..d4a3d05 100644 (file)
@@ -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))
index 250328b..104948d 100644 (file)
@@ -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 */
index ffe004a..2bc2f83 100644 (file)
@@ -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);
index 0b6f8b0..5b6c9c7 100644 (file)
@@ -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