From f126f591a4d6a578d9af82781a9fb87154029280 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 3 Jun 2015 23:03:34 +0100 Subject: [PATCH] dragon: switch to autodetecting the dragon v coco 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 | 13 ++++++++++++- Kernel/platform-dragon-nx32/devtty.c | 6 ++++++ Kernel/platform-dragon-nx32/main.c | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Kernel/platform-dragon-nx32/crt0.s b/Kernel/platform-dragon-nx32/crt0.s index 01979032..24501b22 100644 --- a/Kernel/platform-dragon-nx32/crt0.s +++ b/Kernel/platform-dragon-nx32/crt0.s @@ -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 diff --git a/Kernel/platform-dragon-nx32/devtty.c b/Kernel/platform-dragon-nx32/devtty.c index 56ee52fd..947a23fb 100644 --- a/Kernel/platform-dragon-nx32/devtty.c +++ b/Kernel/platform-dragon-nx32/devtty.c @@ -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 diff --git a/Kernel/platform-dragon-nx32/main.c b/Kernel/platform-dragon-nx32/main.c index 118ca019..248cb5f4 100644 --- a/Kernel/platform-dragon-nx32/main.c +++ b/Kernel/platform-dragon-nx32/main.c @@ -5,6 +5,7 @@ #include uint8_t membanks; +uint8_t system_id; void platform_idle(void) { -- 2.34.1