recipes/sms: plug shell in!
Now this is getting eminently exciting!
This commit is contained in:
parent
404dbd0ddd
commit
bd003829e8
@ -8,58 +8,79 @@
|
|||||||
.fill 0x66-$
|
.fill 0x66-$
|
||||||
retn
|
retn
|
||||||
|
|
||||||
|
#include "err.h"
|
||||||
|
#include "core.asm"
|
||||||
|
#include "parse.asm"
|
||||||
|
|
||||||
.equ PAD_RAMSTART RAMSTART
|
.equ PAD_RAMSTART RAMSTART
|
||||||
#include "sms/pad.asm"
|
#include "sms/pad.asm"
|
||||||
|
|
||||||
.equ VDP_RAMSTART PAD_RAMEND
|
.equ VDP_RAMSTART PAD_RAMEND
|
||||||
#include "sms/vdp.asm"
|
#include "sms/vdp.asm"
|
||||||
|
|
||||||
|
.equ STDIO_RAMSTART VDP_RAMEND
|
||||||
|
#include "stdio.asm"
|
||||||
|
|
||||||
|
.equ SHELL_RAMSTART STDIO_RAMEND
|
||||||
|
.equ SHELL_EXTRA_CMD_COUNT 0
|
||||||
|
#include "shell.asm"
|
||||||
|
|
||||||
init:
|
init:
|
||||||
di
|
di
|
||||||
im 1
|
im 1
|
||||||
|
|
||||||
ld sp, RAMEND
|
ld sp, RAMEND
|
||||||
|
|
||||||
|
call padInit
|
||||||
call vdpInit
|
call vdpInit
|
||||||
|
|
||||||
|
ld hl, myGetC
|
||||||
|
ld de, vdpPutC
|
||||||
|
call stdioInit
|
||||||
|
call shellInit
|
||||||
|
jp shellLoop
|
||||||
|
|
||||||
mainloop:
|
myGetC:
|
||||||
; What we do here is simple. We go though all bits of port A controller
|
; 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
|
; increasing B each time. As soon as we get a hit, we display that
|
||||||
; letter. Pressed buttons go low.
|
; letter. Pressed buttons go low.
|
||||||
call padStatusA
|
call padStatusA
|
||||||
jr z, mainloop ; unchanged since last poll
|
push bc
|
||||||
|
jr z, .nothing ; unchanged since last poll
|
||||||
ld b, 'A'
|
ld b, 'A'
|
||||||
bit 5, a ; Port A Button C pressed
|
bit 5, a ; Port A Button C pressed
|
||||||
jr z, updateLetter
|
jr z, .something
|
||||||
inc b ; b
|
inc b ; b
|
||||||
bit 4, a ; Port A Button B pressed
|
bit 4, a ; Port A Button B pressed
|
||||||
jr z, updateLetter
|
jr z, .something
|
||||||
inc b ; c
|
inc b ; c
|
||||||
bit 3, a ; Port A Right pressed
|
bit 3, a ; Port A Right pressed
|
||||||
jr z, updateLetter
|
jr z, .something
|
||||||
inc b ; d
|
inc b ; d
|
||||||
bit 2, a ; Port A Left pressed
|
bit 2, a ; Port A Left pressed
|
||||||
jr z, updateLetter
|
jr z, .something
|
||||||
inc b ; e
|
inc b ; e
|
||||||
bit 1, a ; Port A Down pressed
|
bit 1, a ; Port A Down pressed
|
||||||
jr z, updateLetter
|
jr z, .something
|
||||||
inc b ; f
|
inc b ; f
|
||||||
bit 0, a ; Port A Up pressed
|
bit 0, a ; Port A Up pressed
|
||||||
jr z, updateLetter
|
jr z, .something
|
||||||
inc b ; g
|
inc b ; g
|
||||||
bit 6, a ; Port A Button A pressed
|
bit 6, a ; Port A Button A pressed
|
||||||
jr z, updateLetter
|
jr z, .something
|
||||||
inc b ; h
|
inc b ; h
|
||||||
bit 7, a ; Port A Start pressed
|
bit 7, a ; Port A Start pressed
|
||||||
jr z, updateLetter ; when start is pressed, print all letters
|
jr z, .something
|
||||||
jr mainloop
|
; nothing
|
||||||
|
.nothing:
|
||||||
; Prints letter in B
|
pop bc
|
||||||
updateLetter:
|
xor a
|
||||||
|
jp unsetZ
|
||||||
|
.something:
|
||||||
ld a, b
|
ld a, b
|
||||||
call vdpPutC
|
pop bc
|
||||||
jr mainloop
|
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