mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 20:30:56 +11:00
Compare commits
5 Commits
67f689260f
...
6d9f96aee6
Author | SHA1 | Date | |
---|---|---|---|
|
6d9f96aee6 | ||
|
a4190f9984 | ||
|
2026113480 | ||
|
9c37471780 | ||
|
418af5f626 |
@ -19,7 +19,7 @@
|
|||||||
; *** Code ***
|
; *** Code ***
|
||||||
|
|
||||||
kbdInit:
|
kbdInit:
|
||||||
xor a
|
ld a, 1 ; begin with A-Lock on
|
||||||
ld (KBD_MODS), a
|
ld (KBD_MODS), a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -84,13 +84,16 @@ kbdGetC:
|
|||||||
jr z, .loop ; yes? unsupported. loop.
|
jr z, .loop ; yes? unsupported. loop.
|
||||||
call .debounce
|
call .debounce
|
||||||
cp KBD_KEY_ALPHA
|
cp KBD_KEY_ALPHA
|
||||||
jr c, .end ; A < 0x80? valid char, return it.
|
jr c, .result ; A < 0x80? valid char, return it.
|
||||||
jr z, .handleAlpha
|
jr z, .handleAlpha
|
||||||
cp KBD_KEY_2ND
|
cp KBD_KEY_2ND
|
||||||
jr z, .handle2nd
|
jr z, .handle2nd
|
||||||
jp .loop
|
jp .loop
|
||||||
.handleAlpha:
|
.handleAlpha:
|
||||||
set 0, c
|
; 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
|
||||||
bit 1, c ; 2nd set?
|
bit 1, c ; 2nd set?
|
||||||
jp z, .loop ; unset? loop
|
jp z, .loop ; unset? loop
|
||||||
; we've just hit Alpha with 2nd set. Toggle A-Lock and set Alpha to
|
; we've just hit Alpha with 2nd set. Toggle A-Lock and set Alpha to
|
||||||
@ -101,9 +104,22 @@ kbdGetC:
|
|||||||
ld c, a
|
ld c, a
|
||||||
jp .loop
|
jp .loop
|
||||||
.handle2nd:
|
.handle2nd:
|
||||||
set 1, c
|
; toggle 2ND bit in C
|
||||||
|
ld a, 2 ; mask for 2ND
|
||||||
|
xor c
|
||||||
|
ld c, a
|
||||||
jp .loop
|
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:
|
.end:
|
||||||
pop hl
|
pop hl
|
||||||
pop bc
|
pop bc
|
||||||
@ -120,13 +136,20 @@ kbdGetC:
|
|||||||
ret
|
ret
|
||||||
.debounce:
|
.debounce:
|
||||||
; wait until all keys are de-pressed
|
; 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 af ; --> lvl 1
|
||||||
|
push bc ; --> lvl 2
|
||||||
|
.pressed:
|
||||||
|
ld b, 64
|
||||||
.wait:
|
.wait:
|
||||||
xor a
|
xor a
|
||||||
call .get
|
call .get
|
||||||
inc a ; if a was 0xff, will become 0 (nz test)
|
inc a ; if a was 0xff, will become 0 (nz test)
|
||||||
jr nz, .wait ; non-zero? something is pressed
|
jr nz, .pressed ; non-zero? something is pressed
|
||||||
|
djnz .wait
|
||||||
|
|
||||||
|
pop bc ; <-- lvl 2
|
||||||
pop af ; <-- lvl 1
|
pop af ; <-- lvl 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -144,9 +167,9 @@ kbdGetC:
|
|||||||
; alpha table. same as .dtbl, for when we're in alpha mode.
|
; alpha table. same as .dtbl, for when we're in alpha mode.
|
||||||
.atbl:
|
.atbl:
|
||||||
.db 0xfe, 0, 0, 0, 0, 0, 0, 0, 0
|
.db 0xfe, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
.db 0xfd, 0x0d, '"' ,'W' ,'R', 'M', 'H', 0, 0
|
.db 0xfd, 0x0d, '"' ,'w' ,'r', 'm', 'h', 0, 0
|
||||||
.db 0xfb, '?', 0, 'V', 'Q', 'L', 'G', 0, 0
|
.db 0xfb, '?', 0, 'v', 'q', 'l', 'g', 0, 0
|
||||||
.db 0xf7, ':', 'Z', 'U', 'P', 'K', 'F', 'C', 0
|
.db 0xf7, ':', 'z', 'u', 'p', 'k', 'f', 'c', 0
|
||||||
.db 0xef, ' ', 'Y', 'T', 'O', 'J', 'E', 'B', 0
|
.db 0xef, ' ', 'y', 't', 'o', 'j', 'e', 'b', 0
|
||||||
.db 0xdf, 0, 'X', 'S', 'N', 'I', 'D', 'A', KBD_KEY_ALPHA
|
.db 0xdf, 0, 'x', 's', 'n', 'i', 'd', 'a', KBD_KEY_ALPHA
|
||||||
.db 0xbf, 0, 0, 0, 0, 0, KBD_KEY_2ND, 0, 0x7f
|
.db 0xbf, 0, 0, 0, 0, 0, KBD_KEY_2ND, 0, 0x7f
|
||||||
|
@ -153,13 +153,6 @@ lcdSendGlyph:
|
|||||||
ld a, (LCD_CURCOL)
|
ld a, (LCD_CURCOL)
|
||||||
call lcdSetCol
|
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
|
ld b, FNT_HEIGHT
|
||||||
.loop:
|
.loop:
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
@ -167,6 +160,14 @@ lcdSendGlyph:
|
|||||||
call lcdData
|
call lcdData
|
||||||
djnz .loop
|
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 hl
|
||||||
pop bc
|
pop bc
|
||||||
pop af
|
pop af
|
||||||
@ -240,6 +241,8 @@ lcdClrScr:
|
|||||||
lcdPutC:
|
lcdPutC:
|
||||||
cp ASCII_LF
|
cp ASCII_LF
|
||||||
jp z, lcdLinefeed
|
jp z, lcdLinefeed
|
||||||
|
cp ASCII_BS
|
||||||
|
jr z, .bs
|
||||||
push hl
|
push hl
|
||||||
call fntGet
|
call fntGet
|
||||||
jr nz, .end
|
jr nz, .end
|
||||||
@ -247,3 +250,11 @@ lcdPutC:
|
|||||||
.end:
|
.end:
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
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
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# TI-84+
|
# TI-84+
|
||||||
|
|
||||||
**This is a work-in-progress, this is far from complete.**
|
**This is a work-in-progress**
|
||||||
|
|
||||||
## Recipe
|
## 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
|
key yet. This key is mapped to F12 in the emulator. Once you press it, the
|
||||||
Collapse OS prompt will appear.
|
Collapse OS prompt will appear.
|
||||||
|
|
||||||
**WIP: the keyboard does nothing else than halting the CPU for now.**
|
See z80e's `KEYBINDINGS.md` file for details.
|
||||||
|
|
||||||
## Upload to the calculator
|
## Upload to the calculator
|
||||||
|
|
||||||
@ -51,6 +51,29 @@ Press "1" to continue.
|
|||||||
|
|
||||||
When this is done, you can press the ON button to see Collapse OS' prompt!
|
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/
|
[knightos]: https://knightos.org/
|
||||||
[z80e]: https://github.com/KnightOS/z80e
|
[z80e]: https://github.com/KnightOS/z80e
|
||||||
[mktiupgrade]: https://github.com/KnightOS/mktiupgrade
|
[mktiupgrade]: https://github.com/KnightOS/mktiupgrade
|
||||||
|
Loading…
Reference in New Issue
Block a user