Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed terminal code to work bidirectional and added it to the menu #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jacgoudsmit
Copy link

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant