Changed terminal code to work bidirectional and added it to the menu#25
Open
jacgoudsmit wants to merge 3 commits into
Open
Changed terminal code to work bidirectional and added it to the menu#25jacgoudsmit wants to merge 3 commits into
jacgoudsmit wants to merge 3 commits into
Conversation
I didn't need the dependencies on the libraries that he added so I had to commit this without merging.
The keyboard can now be used to enter all 127 ASCII character codes.
Also made the Enter key work like it works on most terminals (it sends a Carriage Return, not a Line Feed)
Added caps-lock functionality
Details:
- Previously Lshift-6 entered a space, this is now a single quote as "advertised" on the solder mask
- Previously ENTER issued a Line Feed, now it issues a Carriage Return. This make the badge work more like a terminal.
- When using Rshift, the following keys generate a different ASCII code than when using Lshift:
Key Lshift Rshift
1 ! `
6 ' ^
9 ( [
0 ) ]
- " _ (as previously implemented)
. < {
. > }
/ ? \
= + ~
; : |
- There is now a new table in hw.c which is used when both Lshift and Rshift are held down:
Key ASCII Reason
2 0 Ctrl+@ and @ is shift+2
A-Z 1-26 Ctrll+A to Ctrl+Z
9 27 Ctrl+[ and [ is Rshift+9
/ 28 Ctrl+\ and \ is Rshift+/
0 29 Ctrl+] and ] is Rshift+0
6 30 Ctrl+^ and ^ is Rshift+6
= 31 Ctrl+? but ? is Rshift+/ but Lshift+Rshift+/ is already taken
- Added Caps-Lock handling to the keyb_tasks function: a static variable keeps track of whether caps lock is enabled or disabled. When you hit Lshift+Rshift, caps lock is toggled on or off and the red LED is updated. Whenever Caps Lock is on, upper case letters are translated to lower case and vice versa but non-alphabetical keys are not affected.
- Updated the Help text in badge.c to reflect all the changes above.
- Changed the menu function so it accepts Carriage Return as well as Line Feed to end the input.
- Removed the Pro Tip from the Zork startup screen since it's no longer necessary: Zork expects Carriage Returns at the end of the input
- Changed the Tiny Basic interpreter to translate Carriage Returns from the keyboard to Newlines. This seemed the easiest thing to do because it echoes input characters directly to the output and probably expects lines to end with line feeds too.
I tested all the subprograms briefly to make sure that the change from Line Feed to Carriage Return didn't cause any trouble. I found no problems. The Caps Lock functionality makes it easier to write BASIC programs too, in both of the BASIC interpreters.
I even tried the Sargon chess program that's part of CP/M and it also likes the Carriage Return just fine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added the terminal module back to the project (I had to rename the two functions so they wouldn't clash with the user_program_init and user_program_loop functions in the empty sample module).
Then I added code to flush the serial port at initialization time and pump bytes back and forth between (1) keyboard and UART transmitter and (2) UART receiver and "stdio" output to the screen.
I added the terminal program to the main menu as option 7 and pushed the "user program" option to number 8.
This really is a minor change, the relevant changes in the terminal loop and the change to the main menu are probably less than 20 lines. The reason why it looks so daunting is that the list of source files and object files got changed, which causes big daunting-looking diffs. It should be trivial to merge this.