1 2; =============================================================== 3; Sep 2005, Apr 2014 4; =============================================================== 5; 6; void in_mouse_kempston_setpos(uint16_t x, uint16_t y) 7; 8; Set the mouse coordinate. 9; 10; =============================================================== 11 12SECTION code_clib 13SECTION code_input 14 15PUBLIC asm_in_mouse_kempston_setpos 16 17EXTERN __input_kempston_mouse_x, __input_kempston_mouse_y 18EXTERN __input_kempston_mouse_rawx, __input_kempston_mouse_rawy 19 20asm_in_mouse_kempston_setpos: 21 22 ; enter : de = x 23 ; bc = y 24 ; 25 ; uses : af, bc, de 26 27 ; zero out any existing deltas 28 29 ld a,$fb 30 in a,($df) 31 ld (__input_kempston_mouse_rawx),a 32 33 ld a,$ff 34 in a,($df) 35 ld (__input_kempston_mouse_rawy),a 36 37 ; boundary check 38 39test_x: 40 41 inc d 42 dec d 43 jr z, test_y 44 45adjust_x: 46 47 ld de,$00ff 48 49test_y: 50 51 inc b 52 djnz adjust_y 53 54 ld a,c 55 cp 192 56 jr c, set_xy 57 58adjust_y: 59 60 ld bc,191 61 62set_xy: 63 64 ld (__input_kempston_mouse_x),de 65 ld (__input_kempston_mouse_y),bc 66 67 ret 68