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

DVItext1: Add rudimentary terminal code handling #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jepler
Copy link
Member

@jepler jepler commented May 27, 2023

The following are handled:

ESC [ K               ; clear to end of line
ESC [ 2 J             ; clear screen
ESC [ count D         ; cursor backwards (default = 1)
x08                   ; cursor backwards 1 (ctrl-H)
ESC [ row ; column H  ; position cursor
ESC [ attr m          ; 0 = normal, 1 = inverse
ESC ] ; ... x1B x5c   ; sets title (ignored)
x07                   ; bell (flashes screen) (ctrl-G)

"ESC[ m" is used by RunCPM to set some characters to bold, implemented here as reverse video. The rest are the ones implemented in CircuitPython terminalio and so probably represent a minimal useful collection of codes.

Bell is used by RunCPM for instance when backspacing on an empty input line. The flash is similar to the visual bell used in some terminal applications.

The 1bit_text demo is enhanced so that as soon as a character is printed to the Serial connection, it switches to typewriter mode. This can be used to test escape code handling.

The following are handled:
```
ESC [ K               ; clear to end of line
ESC [ 2 J             ; clear screen
ESC [ count D         ; cursor backwards (default = 1)
x08                   ; cursor backwards 1 (ctrl-H)
ESC [ row ; column H  ; position cursor
ESC [ attr m          ; 0 = normal, 1 = inverse
ESC ] ; ... x1B x5c   ; sets title (ignored)
x07                   ; bell (flashes screen)
```

"ESC[ m" is used by RunCPM to set some characters to bold, implemented
here as reverse video. The rest are the ones implemented in
CircuitPython terminalio and so probably represent a minimal useful
collection of codes.

Bell is used by RunCPM for instance when backspacing on an empty input
line. The flash is similar to the visual bell used in some terminal
applications.

The 1bit_text demo is enhanced so that as soon as a character is printed
to the Serial connection, it switches to typewriter mode. This can be
used to test escape code handling.
@jepler
Copy link
Member Author

jepler commented May 27, 2023

An alternative approach would be to make the base class NOT handle complex codes and allow derived classes or encapsulating classes to do so. In the CP/M emulator, having ADM-3 terminal emulation may be more useful.

@PaintYourDragon
Copy link

Leaning toward the alternative approach thoughts. Rather than tying DVItext1 to a specific terminal implementation (which then makes others problematic), maybe one can register a terminal-specific callback function that write() then uses as a filter on output. Or, if doing derived classes, something that works with multiple inheritance to combine a terminal type and a display type (idea here is that we might eventually have a DVItext4 or something, to handle color output, I just haven’t gotten the Round Tuit yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants