or 0c0h   ;; AY control select register.
        out (c),a
        out (c),a ;; BUG. This should set AY control Should be out (c),c to 0 to also be compatible with Plus.
        inc b
        ld a,092h 
        out (c),a
        push bc
        ld bc,0f649h ;; AY control read from register and select keyboard line 9 (joystick)
        out (c),c
        out (c),c ;; BUG? No need to do this twice.
        ld (0a410h),hl ;; detected 'position' or 'ffff' for not detected
        pop bc
        ;; BUG: For compatibility with Plus this should set AY control to 0 via Port F6xx.
        ld a,082h
        out (c),a
        dec b
        out (c),c;; Set AY control inactive.
        ei
        ret
        ld a,h
        ld c,l
        ld b,010h;; 16 bits.
        ld hl,00000h
l9cdbh:
        ld a,l
        ld c,h
        ld b,010h;; 16 bits
        ld hl,00000h
l9cf5h: