1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-26 07:28:10 +11:00

Compare commits

..

No commits in common. "6d9f96aee6b263fe42ce09d6c962279b72e4719c" and "67f689260f9e5af493a7c1bc000ca0ce6e279258" have entirely different histories.

3 changed files with 21 additions and 78 deletions

View File

@ -19,7 +19,7 @@
; *** Code ***
kbdInit:
ld a, 1 ; begin with A-Lock on
xor a
ld (KBD_MODS), a
ret
@ -31,7 +31,7 @@ kbdInit:
; waitForKey only go through after two actual key presses (otherwise, the user
; doesn't have enough time to de-press the button before the next waitForKey
; routine registers the same key press as a second one).
;
;
; Sending 0xff to the port resets the keyboard, and then we have to send groups
; we want to "listen" to, with a 0 in the group bit. Thus, to know if *any* key
; is pressed, we send 0xff to reset the keypad, then 0x00 to select all groups,
@ -84,16 +84,13 @@ kbdGetC:
jr z, .loop ; yes? unsupported. loop.
call .debounce
cp KBD_KEY_ALPHA
jr c, .result ; A < 0x80? valid char, return it.
jr c, .end ; A < 0x80? valid char, return it.
jr z, .handleAlpha
cp KBD_KEY_2ND
jr z, .handle2nd
jp .loop
.handleAlpha:
; Toggle Alpha bit in C. Also, if 2ND bit is set, toggle A-Lock mod.
ld a, 1 ; mask for Alpha
xor c
ld c, a
set 0, c
bit 1, c ; 2nd set?
jp z, .loop ; unset? loop
; we've just hit Alpha with 2nd set. Toggle A-Lock and set Alpha to
@ -104,22 +101,9 @@ kbdGetC:
ld c, a
jp .loop
.handle2nd:
; toggle 2ND bit in C
ld a, 2 ; mask for 2ND
xor c
ld c, a
set 1, c
jp .loop
.result:
; We have our result in A, *almost* time to return it. One last thing:
; Are in in both Alpha and 2nd mode? If yes, then it means that we
; should return the upcase version of our letter (if it's a letter).
bit 0, c
jr z, .end ; nope
bit 1, c
jr z, .end ; nope
; yup, we have Alpha + 2nd. Upcase!
call upcase
.end:
pop hl
pop bc
@ -136,20 +120,13 @@ kbdGetC:
ret
.debounce:
; wait until all keys are de-pressed
; To avoid repeat keys, we require 64 subsequent polls to indicate all
; depressed keys
push af ; --> lvl 1
push bc ; --> lvl 2
.pressed:
ld b, 64
.wait:
xor a
call .get
inc a ; if a was 0xff, will become 0 (nz test)
jr nz, .pressed ; non-zero? something is pressed
djnz .wait
jr nz, .wait ; non-zero? something is pressed
pop bc ; <-- lvl 2
pop af ; <-- lvl 1
ret
@ -167,9 +144,9 @@ kbdGetC:
; alpha table. same as .dtbl, for when we're in alpha mode.
.atbl:
.db 0xfe, 0, 0, 0, 0, 0, 0, 0, 0
.db 0xfd, 0x0d, '"' ,'w' ,'r', 'm', 'h', 0, 0
.db 0xfb, '?', 0, 'v', 'q', 'l', 'g', 0, 0
.db 0xf7, ':', 'z', 'u', 'p', 'k', 'f', 'c', 0
.db 0xef, ' ', 'y', 't', 'o', 'j', 'e', 'b', 0
.db 0xdf, 0, 'x', 's', 'n', 'i', 'd', 'a', KBD_KEY_ALPHA
.db 0xfd, 0x0d, '"' ,'W' ,'R', 'M', 'H', 0, 0
.db 0xfb, '?', 0, 'V', 'Q', 'L', 'G', 0, 0
.db 0xf7, ':', 'Z', 'U', 'P', 'K', 'F', 'C', 0
.db 0xef, ' ', 'Y', 'T', 'O', 'J', 'E', 'B', 0
.db 0xdf, 0, 'X', 'S', 'N', 'I', 'D', 'A', KBD_KEY_ALPHA
.db 0xbf, 0, 0, 0, 0, 0, KBD_KEY_2ND, 0, 0x7f

View File

@ -153,6 +153,13 @@ lcdSendGlyph:
ld a, (LCD_CURCOL)
call lcdSetCol
; let's increase (and wrap) col now
inc a
ld (LCD_CURCOL), a
cp 16
jr nz, .skip
call lcdLinefeed
.skip:
ld b, FNT_HEIGHT
.loop:
ld a, (hl)
@ -160,14 +167,6 @@ lcdSendGlyph:
call lcdData
djnz .loop
; Increase column and wrap if necessary
ld a, (LCD_CURCOL)
inc a
ld (LCD_CURCOL), a
cp 16
jr nz, .skip
call lcdLinefeed
.skip:
pop hl
pop bc
pop af
@ -241,8 +240,6 @@ lcdClrScr:
lcdPutC:
cp ASCII_LF
jp z, lcdLinefeed
cp ASCII_BS
jr z, .bs
push hl
call fntGet
jr nz, .end
@ -250,11 +247,3 @@ lcdPutC:
.end:
pop hl
ret
.bs:
ld a, (LCD_CURCOL)
or a
ret z ; going back one line is too complicated.
; not implemented yet
dec a
ld (LCD_CURCOL), a
ret

View File

@ -1,6 +1,6 @@
# TI-84+
**This is a work-in-progress**
**This is a work-in-progress, this is far from complete.**
## Recipe
@ -25,7 +25,7 @@ You will start with a blank screen, it's normal, you haven't pressed the "ON"
key yet. This key is mapped to F12 in the emulator. Once you press it, the
Collapse OS prompt will appear.
See z80e's `KEYBINDINGS.md` file for details.
**WIP: the keyboard does nothing else than halting the CPU for now.**
## Upload to the calculator
@ -51,29 +51,6 @@ Press "1" to continue.
When this is done, you can press the ON button to see Collapse OS' prompt!
## Usage
The shell works like a normal shell, but with very tight screen space.
When pressing a "normal" key, it spits the symbol associated to it depending
on the current mode. In normal mode, it spits the digit/symbol. In Alpha mode,
it spits the letter. In Alpha+2nd, it spits the uppercase letter.
Special keys are Alpha and 2nd. Pressing them toggles the associated mode.
Alpha and 2nd mode don't persist for more than one character. After the
character is spit, mode reset to normal.
Pressing 2nd then Alpha will toggle the A-Lock mode, which is a persistent mode.
The A-Lock mode makes Alpha enabled all the time. While A-Lock mode is enabled,
you have to enable Alpha to spit a digit/symbol.
Simultaneous keypresses have undefined behavior. One of the keys will be
registered as pressed. Mode key don't work by simultaneously pressing them with
a "normal" key. The presses must be sequential.
Keys that aren't a digit, a letter, a symbol that is part of 7-bit ASCII or one
of the two mode key have no effect.
[knightos]: https://knightos.org/
[z80e]: https://github.com/KnightOS/z80e
[mktiupgrade]: https://github.com/KnightOS/mktiupgrade