Difference between revisions of "ANSI Support"
(Created page with "As of v0.4 of the kernel, the PUTC function now supports printing to the EVID expansion card and ANSI style control sequences. = Printing to the EVID Screen = If the EVID ca...") |
(→ANSI Escape Codes) |
||
Line 37: | Line 37: | ||
| CSI ''n'' P || DCH || Deletes ''n'' (default: 1) characters starting at the cursor. | | CSI ''n'' P || DCH || Deletes ''n'' (default: 1) characters starting at the cursor. | ||
|- | |- | ||
− | | CSI ''n'' h || SM || Sets | + | | CSI ''n'' h || SM || Sets terminal modes (see table below). |
|- | |- | ||
− | | CSI ''n'' l || RM || Resets | + | | CSI ''n'' l || RM || Resets terminal modes (see table below). |
|- | |- | ||
| CSI ''n'' m || SGR || Sets the appearance of the characters to be printed next (see table below). | | CSI ''n'' m || SGR || Sets the appearance of the characters to be printed next (see table below). |
Latest revision as of 20:37, 31 May 2021
As of v0.4 of the kernel, the PUTC function now supports printing to the EVID expansion card and ANSI style control sequences.
Printing to the EVID Screen
If the EVID card is installed, the EVID screen is available on channel #4. To print text to the EVID screen, use the SETOUT kernel routine to set the channel to 4 and then call PUTC or any routine that uses PUTC to print. The characters will be printed to the EVID screen. To go back to printing to the main screen, use SETOUT to set the channel to 0.
Note that the EVID screen and the main screen are completely independent. They can be used at different resolutions and with different border sizes. Also they have independent cursors and terminal state (e.g. current printing color).
ANSI Escape Codes
PUTC will do some elementary interpretation of ANSI or VT style escape codes to control the screen. The codes can be used with either screen. The following escape sequences are supported:
Escape | Name | Purpose |
---|---|---|
CSI n @ | ICH | Inserts n (default: 1) blank characters, starting at the cursor. |
CSI n A | CUU | Move the cursor up n (default: 1) rows. |
CSI n B | CUD | Move the cursor down n (default: 1) rows. |
CSI n C | CUF | Move the cursor forward n (default: 1) positions. |
CSI n D | CUB | Move the cursor back n (default: 1) positions. |
CSI n;m H | CUP | Move the cursor to position (n, m) on the screen... home position of (1, 1) if no parameters provided. |
CSI n J | ED | Erase part or all of the screen, based on n. If n is 0 or missing, clear from the cursor to the end of the screen. If n is 1, erase from the beginning of the screen to the cursor. If n is 2, erase the entire screen. |
CSI n K | EL | Erase part or all of the current line, based on n. If n is 0 or missing, clear from the cursor to the end of the line. If n is 1, erase from the beginning of the line to the cursor. If n is 2, erase the entire line. |
CSI n P | DCH | Deletes n (default: 1) characters starting at the cursor. |
CSI n h | SM | Sets terminal modes (see table below). |
CSI n l | RM | Resets terminal modes (see table below). |
CSI n m | SGR | Sets the appearance of the characters to be printed next (see table below). |
SGR Support
The support for the standard SGR codes is somewhat limited in the Foenix kernel, due to limitations in the text mode screen. Here are the codes the kernel supports:
Code | Purpose |
---|---|
1 | Set the foreground to high intensity |
2 | Go back to normal intensity |
7 | Enable reversed text |
22 | Go back to normal intensity |
27 | Stop inverting the colors |
30..37 | Set the foreground color |
39 | Restore the default foreground color |
40..47 | Set the background color |
49 | Restore the default background color |
Mode Support
There are only two modes that can be set or reset:
- 25 will show (set) or hide (reset) the cursor.
- 28 will enable (set) or disable (reset) the processing of the PAUSE/BREAK key.
If processing is disabled, the TESTBREAK kernel routine will not return if the PAUSE/BREAK key has been pressed. The key will be ignored until re-enabled.