1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-03 00:40:57 +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 *** ; *** Code ***
kbdInit: kbdInit:
ld a, 1 ; begin with A-Lock on xor a
ld (KBD_MODS), a ld (KBD_MODS), a
ret ret
@ -84,16 +84,13 @@ 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, .result ; A < 0x80? valid char, return it. jr c, .end ; 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:
; Toggle Alpha bit in C. Also, if 2ND bit is set, toggle A-Lock mod. set 0, c
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
@ -104,22 +101,9 @@ kbdGetC:
ld c, a ld c, a
jp .loop jp .loop
.handle2nd: .handle2nd:
; toggle 2ND bit in C set 1, 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
@ -136,20 +120,13 @@ 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, .pressed ; non-zero? something is pressed jr nz, .wait ; non-zero? something is pressed
djnz .wait
pop bc ; <-- lvl 2
pop af ; <-- lvl 1 pop af ; <-- lvl 1
ret ret
@ -167,9 +144,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

View File

@ -153,6 +153,13 @@ 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)
@ -160,14 +167,6 @@ 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
@ -241,8 +240,6 @@ 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
@ -250,11 +247,3 @@ 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

View File

@ -1,6 +1,6 @@
# TI-84+ # TI-84+
**This is a work-in-progress** **This is a work-in-progress, this is far from complete.**
## 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.
See z80e's `KEYBINDINGS.md` file for details. **WIP: the keyboard does nothing else than halting the CPU for now.**
## Upload to the calculator ## 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! 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