sam: initial pieces for mouse support
authorAlan Cox <alan@linux.intel.com>
Sat, 17 Nov 2018 22:24:17 +0000 (22:24 +0000)
committerAlan Cox <alan@linux.intel.com>
Sat, 17 Nov 2018 22:24:17 +0000 (22:24 +0000)
Kernel/platform-sam/README
Kernel/platform-sam/devtty.c
Kernel/platform-sam/devtty.h
Kernel/platform-sam/discard.c
Kernel/platform-sam/sam.s

index a07372e..8d24ccd 100644 (file)
@@ -16,9 +16,13 @@ This port provides fairly basic support for the following configurations
                Joystick
                Mouse
                Floppy Disk
-               Serial I/O
+               Serial I/O (no emulation so tricky)
                MegaRAM (as a RAM disc)
 
+       No online docs/emulation
+               Trinity
+               SID
+
 
 Memory layout
 
index a5f4c6c..50c2179 100644 (file)
@@ -215,10 +215,15 @@ static void keydecode(void)
 
 static uint8_t kbd_timer;
 
+uint8_t mousein[7];
+uint8_t mouse_present;
+
 void kbd_interrupt(void)
 {
        newkey = 0;
        keyproc();
+       if (mouse_present)
+               mousescan();
        if (keysdown && keysdown < 3) {
                if (newkey) {
                        keydecode();
index d011b94..92c4e78 100644 (file)
@@ -4,6 +4,10 @@
 extern void tty_interrupt(void);
 extern void kbd_interrupt(void);
 extern void keyscan(void);
+extern void mousescan(void);
+extern uint8_t mouse_probe(void);      /* 0 means yes */
+
+extern uint8_t mouse_present;
 
 #define KEY_ROWS       9
 #define KEY_COLS       8
index 191d99e..6b3c2c7 100644 (file)
@@ -42,6 +42,8 @@ void device_init(void)
        platform_rtc_probe();
        inittod();
 #endif
+       if (!mouse_probe())
+               mouse_present = 1;
        if (atom_probe())
                devide_init();
 }
index b1dfd00..dd2595e 100644 (file)
@@ -22,6 +22,8 @@
            .globl _platform_copier_l
            .globl _platform_copier_h
            .globl _keyscan
+           .globl _mousescan
+           .globl _mouse_probe
            .globl _int_disabled
 
             ; exported debugging tools
@@ -37,6 +39,7 @@
             .globl unix_syscall_entry
             .globl outcharhex
            .globl _keyin
+           .globl _mousein
 
            .globl _vtwipe
            .globl _vtinit
@@ -281,6 +284,51 @@ keyscl:
            ld (hl), a
            ret
 
+_mousescan:
+           ld hl,#0
+           ld bc,#0xfffe
+           in a,(c)
+           in a,(c)            ; should be xxxx1111
+           or #0xf0            ; should now be 11111111
+           inc a               ; cheap way to and 15, cp 15...
+           ret nz              ; was not right - punt return 0
+           ld hl,#_mousein
+           ini                 ; fetch and store buttons
+           inc b               ; fix up B (needs to be FFFE for the port)
+           ini                 ; y256
+           inc b
+           ini                 ; y16
+           inc b
+           ini                 ; y1
+           inc b
+           ini                 ; x256
+           inc b
+           ini                 ; x16
+           inc b
+           ini                 ; x1
+           inc b
+           in a,(c)            ; end
+           ret                 ; hl will be non zero
+
+           .area _DISCARD
+
+_mouse_probe:
+           ld bc,#0xfffe
+           ld hl,#0x0b01       ; 0b for count, 01 so can ret nz
+           in a,(c)
+           in a,(c)
+           or #0xf0
+           inc a
+           ret nz
+probe_in:
+           in a,(c)
+           dec h
+           jr nz, probe_in
+           and #0x0f
+           ld l,a              ; 0 if present
+           ret
+
+           .area _CODE
 ;
 ;      Real time clock on port 239
 ;