most jelenleg ezzel a rutinnal működik, lehet mozgatni a kurzort az egérrel:
org 08d1h
; di
; in a, (0b4h)
; and 0xaa
; ld b, a
; neg
; and b
; bit 5, a
; ret z
; DI
;VSYNCWAIT1: IN A,(0B4H)
; AND 10H
; JR Z,VSYNCWAIT1
;VSYNCWAIT2: IN A,(0B4H)
; AND 10H
; JR NZ,VSYNCWAIT2
LD C,4
READ_LOOP_1: LD H,L
LD L,D
LD D,E
LD E,01H
LD A,02H ;RTS low
READ_LOOP_2: OUT (0B7H),A
LD B,17 ;25.6 us at 10 MHz without wait states
M_WAIT_LOOP: DJNZ M_WAIT_LOOP
LD B,4
READ_LOOP_3: LD A,B
OUT (0B5H),A
IN A,(0B6H)
RRA ;data is read from K column
RRA
RL E
DJNZ READ_LOOP_3
LD A,B ;RTS high
JR NC,READ_LOOP_2
DEC C
JR NZ,READ_LOOP_1
; OUT (0B5H),A ;A = 0
; IN A,(0B6H)
; CPL
; AND 06H ;bit 0 = left button,
; RRA ;bit 1 = right button
; push af ; save button state
ld b, h
ld c, l
ld hl, (015eh)
ld de, (0160h)
xor a
ld (01eeh), a ; A = 0
ld a, b
or a
jr z, .l2 ; no horizontal movement
jp p, .l1
neg
.l1: ld (09c1h), a
ld a, b
or a
push bc
call p, 09efh ; left
call m, 0a03h ; right
pop bc
.l2: ld a, c
or a
jr z, .l4 ; no vertical movement
jp p, .l3
neg
.l3: ld (09c1h), a
ld a, c
or a
call m, 09d5h ; down
call p, 09bfh ; up
.l4: ld (015ah), hl
ld (015ch), de
; ei
; pop af
; bit 0, a
; jr nz, 096ah
ret
end
de abban a pillanatban, hogy kikommnetelem az egérbill. figyelést, összeomlik