mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-24 05:48:06 +11:00
sms/pad: handle return properly
That is, send current chr selection, and then, send LF.
This commit is contained in:
parent
9c87734499
commit
f41508725d
@ -35,11 +35,10 @@
|
|||||||
.equ PAD_SELCLASS PAD_GETCSTAT+1
|
.equ PAD_SELCLASS PAD_GETCSTAT+1
|
||||||
; Current selected character
|
; Current selected character
|
||||||
.equ PAD_SELCHR PAD_SELCLASS+1
|
.equ PAD_SELCHR PAD_SELCLASS+1
|
||||||
; Whether current sel is "new", that is, that its value has never been fetched
|
; When non-zero, will be the next char returned in GetC. So far, only used for
|
||||||
; though padUpdateSel. This flag is set when "avancing" in GetC and also on
|
; LF that is feeded when Start is pressed.
|
||||||
; module init.
|
.equ PAD_NEXTCHR PAD_SELCHR+1
|
||||||
.equ PAD_SELNEW PAD_SELCHR+1
|
.equ PAD_RAMEND PAD_NEXTCHR+1
|
||||||
.equ PAD_RAMEND PAD_SELNEW+1
|
|
||||||
|
|
||||||
; *** Code ***
|
; *** Code ***
|
||||||
|
|
||||||
@ -47,9 +46,9 @@ padInit:
|
|||||||
ld a, 0xff
|
ld a, 0xff
|
||||||
ld (PAD_SELSTAT), a
|
ld (PAD_SELSTAT), a
|
||||||
ld (PAD_GETCSTAT), a
|
ld (PAD_GETCSTAT), a
|
||||||
ld (PAD_SELNEW), a
|
|
||||||
xor a
|
xor a
|
||||||
ld (PAD_SELCLASS), a
|
ld (PAD_SELCLASS), a
|
||||||
|
ld (PAD_NEXTCHR), a
|
||||||
ld a, 'a'
|
ld a, 'a'
|
||||||
ld (PAD_SELCHR), a
|
ld (PAD_SELCHR), a
|
||||||
ret
|
ret
|
||||||
@ -84,17 +83,6 @@ padStatus:
|
|||||||
; From a pad status in A, update current char selection and return it.
|
; From a pad status in A, update current char selection and return it.
|
||||||
; Returns the same Z as padStatus: set if unchanged, unset if changed
|
; Returns the same Z as padStatus: set if unchanged, unset if changed
|
||||||
padUpdateSel:
|
padUpdateSel:
|
||||||
; special case: when selnew is set, always return current sel and
|
|
||||||
; disable selnew
|
|
||||||
ld a, (PAD_SELNEW)
|
|
||||||
or a
|
|
||||||
jr z, .notnew
|
|
||||||
; selection is new, return it
|
|
||||||
xor a
|
|
||||||
ld (PAD_SELNEW), a
|
|
||||||
ld a, (PAD_SELCHR)
|
|
||||||
jp unsetZ
|
|
||||||
.notnew:
|
|
||||||
call padStatus
|
call padStatus
|
||||||
push hl
|
push hl
|
||||||
ld hl, PAD_SELSTAT
|
ld hl, PAD_SELSTAT
|
||||||
@ -136,6 +124,9 @@ padUpdateSel:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
padGetC:
|
padGetC:
|
||||||
|
ld a, (PAD_NEXTCHR)
|
||||||
|
or a
|
||||||
|
jr nz, .nextchr
|
||||||
call padStatus
|
call padStatus
|
||||||
push hl
|
push hl
|
||||||
ld hl, PAD_GETCSTAT
|
ld hl, PAD_GETCSTAT
|
||||||
@ -150,9 +141,11 @@ padGetC:
|
|||||||
bit PAD_START, a
|
bit PAD_START, a
|
||||||
jr z, .return
|
jr z, .return
|
||||||
jp unsetZ
|
jp unsetZ
|
||||||
|
.return:
|
||||||
|
ld a, ASCII_LF
|
||||||
|
ld (PAD_NEXTCHR), a
|
||||||
|
; continue to .advance
|
||||||
.advance:
|
.advance:
|
||||||
ld a, 1
|
|
||||||
ld (PAD_SELNEW), a
|
|
||||||
ld a, (PAD_SELCHR)
|
ld a, (PAD_SELCHR)
|
||||||
cp a
|
cp a
|
||||||
ret
|
ret
|
||||||
@ -160,7 +153,11 @@ padGetC:
|
|||||||
ld a, ASCII_BS
|
ld a, ASCII_BS
|
||||||
cp a
|
cp a
|
||||||
ret
|
ret
|
||||||
.return:
|
.nextchr:
|
||||||
ld a, ASCII_LF
|
; We have a "next char", return it and clear it.
|
||||||
cp a
|
cp a ; ensure Z
|
||||||
|
push af
|
||||||
|
xor a
|
||||||
|
ld (PAD_NEXTCHR), a
|
||||||
|
pop af
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user