From a4fcfa9c786e64d582ede73e9237f4f991a93b4f Mon Sep 17 00:00:00 2001 From: TC1995 Date: Fri, 21 Oct 2016 23:28:25 +0200 Subject: [PATCH] Separate Amstrad Mouse from main Amstrad machine core. --- src/amstrad.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/src/amstrad.c b/src/amstrad.c index 3b2918bdc..7756f80cc 100644 --- a/src/amstrad.c +++ b/src/amstrad.c @@ -38,49 +38,10 @@ void amstrad_write(uint16_t port, uint8_t val, void *priv) } } -static uint8_t mousex,mousey; - -void amstrad_mouse_write(uint16_t addr, uint8_t val, void *priv) -{ -// pclog("Write mouse %04X %02X %04X:%04X\n", addr, val, CS, pc); - if (addr==0x78) mousex=0; - else mousey=0; -} - -uint8_t amstrad_mouse_read(uint16_t addr, void *priv) -{ -// printf("Read mouse %04X %04X:%04X %02X\n", addr, CS, pc, (addr == 0x78) ? mousex : mousey); - if (addr==0x78) return mousex; - return mousey; -} - -static int oldb = 0; - -void amstrad_mouse_poll(int x, int y, int b) -{ - mousex += x; - mousey -= y; - - if ((b & 1) && !(oldb & 1)) - keyboard_send(0x7e); - if ((b & 2) && !(oldb & 2)) - keyboard_send(0x7d); - if (!(b & 1) && (oldb & 1)) - keyboard_send(0xfe); - if (!(b & 2) && (oldb & 2)) - keyboard_send(0xfd); - - oldb = b; -} - void amstrad_init() { lpt2_remove_ams(); - io_sethandler(0x0078, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL); - io_sethandler(0x007a, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL); io_sethandler(0x0379, 0x0002, amstrad_read, NULL, NULL, NULL, NULL, NULL, NULL); io_sethandler(0xdead, 0x0001, amstrad_read, NULL, NULL, amstrad_write, NULL, NULL, NULL); - - mouse_poll = amstrad_mouse_poll; }