mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:18:06 +11:00
recipes/sms: Add pad-oriented character selection
This commit is contained in:
parent
2679172edf
commit
dd84c11905
@ -33,54 +33,16 @@ init:
|
|||||||
|
|
||||||
call padInit
|
call padInit
|
||||||
call vdpInit
|
call vdpInit
|
||||||
|
ld hl, padUpdateSel
|
||||||
|
ld (VDP_CHRSELHOOK), hl
|
||||||
|
|
||||||
ld hl, myGetC
|
ld hl, padGetC
|
||||||
ld de, vdpPutC
|
ld de, vdpPutC
|
||||||
call stdioInit
|
call stdioInit
|
||||||
call shellInit
|
call shellInit
|
||||||
|
ld hl, vdpShellLoopHook
|
||||||
|
ld (SHELL_LOOPHOOK), hl
|
||||||
jp shellLoop
|
jp shellLoop
|
||||||
|
|
||||||
myGetC:
|
|
||||||
; What we do here is simple. We go though all bits of port A controller
|
|
||||||
; increasing B each time. As soon as we get a hit, we display that
|
|
||||||
; letter. Pressed buttons go low.
|
|
||||||
call padStatusA
|
|
||||||
push bc
|
|
||||||
jr z, .nothing ; unchanged since last poll
|
|
||||||
ld b, 'A'
|
|
||||||
bit 5, a ; Port A Button C pressed
|
|
||||||
jr z, .something
|
|
||||||
inc b ; b
|
|
||||||
bit 4, a ; Port A Button B pressed
|
|
||||||
jr z, .something
|
|
||||||
inc b ; c
|
|
||||||
bit 3, a ; Port A Right pressed
|
|
||||||
jr z, .something
|
|
||||||
inc b ; d
|
|
||||||
bit 2, a ; Port A Left pressed
|
|
||||||
jr z, .something
|
|
||||||
inc b ; e
|
|
||||||
bit 1, a ; Port A Down pressed
|
|
||||||
jr z, .something
|
|
||||||
inc b ; f
|
|
||||||
bit 0, a ; Port A Up pressed
|
|
||||||
jr z, .something
|
|
||||||
inc b ; g
|
|
||||||
bit 6, a ; Port A Button A pressed
|
|
||||||
jr z, .something
|
|
||||||
inc b ; h
|
|
||||||
bit 7, a ; Port A Start pressed
|
|
||||||
jr z, .something
|
|
||||||
; nothing
|
|
||||||
.nothing:
|
|
||||||
pop bc
|
|
||||||
xor a
|
|
||||||
jp unsetZ
|
|
||||||
.something:
|
|
||||||
ld a, b
|
|
||||||
pop bc
|
|
||||||
cp a ; ensure Z
|
|
||||||
ret
|
|
||||||
|
|
||||||
.fill 0x7ff0-$
|
.fill 0x7ff0-$
|
||||||
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
||||||
|
Loading…
Reference in New Issue
Block a user