summaryrefslogtreecommitdiff
path: root/src/ubox/ubox_select_ctl.z80
blob: 9685bec80b462c5887f4f3b7f6250f29ecf644d5 (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 l, #0xff
	ret
trigger_b:
	dec b
trigger:
	dec b
	ld l, b
	ret