summaryrefslogtreecommitdiff
path: root/src/ubox/ubox_select_ctl.z80
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2020-12-30 19:07:31 +0000
committerJuan J. Martinez <jjm@usebox.net>2020-12-30 19:23:41 +0000
commit2682bc5d1d864341aaeb42a449db73c3ecd16d70 (patch)
tree9116764364b4ee0ce7f6037305077807b57776de /src/ubox/ubox_select_ctl.z80
downloadubox-msx-lib-ca9b663c147340e92804979a96eee4113ab0b27f.tar.gz
ubox-msx-lib-ca9b663c147340e92804979a96eee4113ab0b27f.zip
Initial import1.0
Diffstat (limited to 'src/ubox/ubox_select_ctl.z80')
-rw-r--r--src/ubox/ubox_select_ctl.z8042
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ubox/ubox_select_ctl.z80 b/src/ubox/ubox_select_ctl.z80
new file mode 100644
index 0000000..9685bec
--- /dev/null
+++ b/src/ubox/ubox_select_ctl.z80
@@ -0,0 +1,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