tomm / fab-agon-emulator

Agon Light, Agon Light 2, Agon Console8 Emulator for Linux, Windows, any system with libSDL
GNU General Public License v3.0
87 stars 19 forks source link

sysvar_mouseX & sysvar_mouseY return random values #27

Closed DjPoke closed 11 months ago

DjPoke commented 11 months ago

Hi, sysvar_mouseX & sysvar_mouseY return random values on the 0.9.2 emulator version.

; get mouse data
; outputs:
; de: x
; hl: y
; a: buttons
get_mouse:  
    ; get the mouse position
    vdu 23
    vdu 0
    vdu $89
    vdu 0

    ; moscall to get data
    moscall mos_sysvars

    ; get mouse data
    ld de,$000000
    ld hl,$000000
    ld e,(ix+sysvar_mouseX)
    ld d,(ix+sysvar_mouseX+1)
    ld l,(ix+sysvar_mouseY)
    ld h,(ix+sysvar_mouseY+1)
    ld a,(ix+sysvar_mouseButtons)

    ret