aboutsummaryrefslogtreecommitdiff
path: root/src/ubox/ubox_select_ctl.z80
blob: e313061b27b72192d63c1bb6e84c44e5a35e3927 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.globl _ubox_select_ctl

GTTRIG = 0x00d8

_ubox_select_ctl::
	ld b, #3
loop:
	ld a, b
	dec a
	push bc
	call GTTRIG
	pop bc
	or a
	jr nz, trigger
	djnz loop

	; 2nd button

	ld b, #4
	ld a, b
	push bc
	call GTTRIG
	pop bc
	or a
	jr nz, trigger_b

	dec b
	ld a, b
	push bc
	call GTTRIG
	pop bc
	or a
	jr nz, trigger_b

	ld a, #0xff
	ret
trigger_b:
	dec b
trigger:
	dec b
	ld a, b
	ret