View difference between Paste ID: u5FudCHp and ibQmztwP
SHOW: | | - or go back to the newest paste.
1
getkey:
2-
;;Returns L,B,A=0, z flag set if no key is pressed
2+
;;Returns A=scan code, or A=0 and z flag set if no key is pressed
3-
;;22cc+60G+24R
3+
    ld bc,$BF01
4-
;;R is on [1,8]
4+
    ld a,$40
5-
;;G is on [1,7]
5+
6-
;;avg: 370cc
6+
    sub $8
7-
;;24 bytes
7+
    ret z
8-
    ld bc,$FE01
8+
9-
    xor a
9+
    sra b
10
    in h,(c)
11
    jp pe,loop
12-
    add a,$20
12+
loop2:
13-
    sla b
13+
    add hl,hl
14
    ret nc
15-
    in l,(c)
15+
    dec a
16-
    inc l
16+
    jr loop2