Skip to content

Implement a Terminal Emulator #41

Closed

Description

@thejpster

The Terminal Emulator will interpret ANSI sequences and draw on the text buffer appropriately.

If the serial terminal is enabled, they are passed straight through.

The OS will also handle "raw" and "cooked" mode. Cooked mode only supplies a line to the application after Enter is pressed. Line editing (backspace, etc) is done before they application sees the string. Raw mode supplies each character as it is received (as UTF-8 encoded bytes), backspace and all. You can use an I/O Control (ioctl) to change modes. The raw/cooked is in the OS and will work with either terminal (VGA/KB or Serial).

Function Keys and other special characters would be sent to the application as ANSI strings.

Note to self: need to have a timeout ioctl so you can make read calls timeout if nothing has been received otherwise you could lock a program up, and it can't do anything whilst waiting for keys.

Examples of programs using raw mode:

  • games like snake or tetris
  • a full screen editor

Our VGA/KB based terminal should work like a common serial terminal, like pyserial's microcom, or like PuTTY with its default configuration.

Activity

  1. thejpster commented on May 24, 2023

    @thejpster
    MemberAuthor

    Reminder that the console-traits crate exists.

  2. thejpster commented on May 24, 2023

    @thejpster
    MemberAuthor

    Also, what happens if you have serial and VGA terminals and the application asks for the screen size? Who responds? Both? Only serial? What if serial isn't connected?

    Maybe you can only pick one, but you can hold V on startup for VGA mode, or blast S over serial for serial mode. But I guess that involves getting the UART working.

  3. tingox commented on Jul 4, 2023

    @tingox

    One way to handle this (not necessarily a good way) is to assign the terminal with first input as console or "active" terminal. If you want to use both (but not simultaneously) you just update the console attribute whenever you get input from one of them.

  4. thejpster commented on Jul 5, 2023

    @thejpster
    MemberAuthor

    That's a really interesting idea. Thanks!

  5. thejpster commented on Jul 13, 2023

    @thejpster
    MemberAuthor
  6. thejpster commented on Jul 15, 2023

    @thejpster
    MemberAuthor

    Started in #55

  7. thejpster commented on Jul 17, 2023

    @thejpster
    MemberAuthor

    Need to think any how to share this Virtual Terminal object with the Application callbacks.

  8. thejpster commented on Jul 20, 2023

    @thejpster
    MemberAuthor

    Wrote a refcell that uses the bios to provide a critical section. Used this for standard input and for console output.

    ANSI decoder handles colours, cursor on/off, and basic position updates, so that's enough for this ticket.

  9. jonathanpallant commented on Jul 21, 2023

    @jonathanpallant
    Contributor

    Done in v0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions