dragon: switch to autodetecting the dragon v coco
authorAlan Cox <alan@linux.intel.com>
Wed, 3 Jun 2015 22:03:34 +0000 (23:03 +0100)
committerAlan Cox <alan@linux.intel.com>
Wed, 3 Jun 2015 22:03:34 +0000 (23:03 +0100)
And do a quick swizzle on the lines to avoid having two keymaps.

The platform detect is a bit dubious - possibly some magic ROM location would
be safer.

50/60Hz also needs doing but that's a timing loop problem I think

Kernel/platform-dragon-nx32/crt0.s
Kernel/platform-dragon-nx32/devtty.c
Kernel/platform-dragon-nx32/main.c

index 0197903..24501b2 100644 (file)
@@ -6,11 +6,13 @@
                .globl init_early
                .globl init_hardware
                .globl kstack_top
+               .globl _system_id
 
                ; startup code
                .area .start
 
 start:
+               ldb $80FD               ; save from ROM space
                ; text may be in memory bank 0
                jsr map_kernel
                jmp main
@@ -26,7 +28,16 @@ main:                orcc #0x10              ; interrupts definitely off
 bss_wipe:      sta ,x+
                leay -1,y
                bne bss_wipe
-
+               ; This might be in BSS so don't save until we've wiped!
+               lda #0
+               cmpb #0x49              ; Dragon32
+               beq identified
+               inca
+               cmpb #0x50              ; COCO3
+               beq identified
+               inca                    ; Guess it's a COCO ?
+identified:
+               sta _system_id          ; what sort of a box are we ?
                jsr init_early
                jsr init_hardware
                jsr _fuzix_main
index 56ee52f..947a23f 100644 (file)
@@ -88,6 +88,7 @@ static uint8_t keyin[8];
 static uint8_t keybyte, keybit;
 static uint8_t newkey;
 static int keysdown = 0;
+/* FIXME: shouldn't COCO shiftmask also differ ??? 0x02 not 0x40 ?? */
 static uint8_t shiftmask[8] = {
        0, 0x40, 0, 0, 0, 0, 0, 0x40
 };
@@ -141,6 +142,11 @@ static void keyproc(void)
                }
                keymap[i] = keyin[i];
        }
+       if (system_id) {        /* COCO series */
+         keybit += 2;
+         if (keybit > 5)
+           keybit -= 6;
+        }
 }
 
 #ifdef CONFIG_COCO_KBD
index 118ca01..248cb5f 100644 (file)
@@ -5,6 +5,7 @@
 #include <devtty.h>
 
 uint8_t membanks;
+uint8_t system_id;
 
 void platform_idle(void)
 {