-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput_raw.z80
28 lines (25 loc) · 876 Bytes
/
input_raw.z80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
; raw keyboard read routine (based on a bugfixed version from the sam technical manual)
; It just checks all key bits and writes directly into "keyb_buffer" for another routine
; to process (see input.z80)
get_input_raw:
; keyscan routine from sam technical manual
ld hl, keyb_buffer
ld b, %11111110 ; a8 selected
@loop: ld c, HIKEY
in a,(c)
and 224
ld (hl), a
ld c, LOKEY
in a,(c)
and 31
or (hl)
ld (hl),a
inc hl
scf
rl b ; bug in Sam technical manual - it says RLC B here, which is incorrect
jr c, @loop
in a,(c)
and 31
ld (hl),a
ret
keyb_buffer: defs 9