Copyright (c) Hyperion Entertainment and contributors.
AmigaOS Manual: Control Sequences
Revision as of 16:44, 5 January 2018 by Janne Peräaho (talk | contribs) (→Graphic Rendition Control Sequences)
If an item is enclosed in square brackets, it is optional and may be omitted. For example, for Insert [N] Characters the value for N is shown as optional. The console device responds to such optional items by treating the value of N as 1 if it is not specified. The value of N or M is always a decimal number, having one or more ASCII digits to express its value.
Console Control Sequences
Command | Comment | Sequence of Characters (in Hexadecimal Form) |
---|---|---|
Bell | Flash the display | 07 |
Backspace | Move cursor left one column | 08 |
Horizontal Tab | Move cursor right one tab stop | 09 |
Line Feed | Move cursor down one text line | 0A |
Vertical Tab | Move cursor up one text line | 0B |
Form Feed | Clear the console’s window | 0C |
Carriage Return | Move cursor to the first column | 0D |
Shift In | Use ASCII graphic characters | 0E |
Shift Out | Use ECMA 94 Latin 1 graphic characters | 0F |
Esc | Escape | 1B |
Index | Move the active position down one line | 84 |
Next Line | Go to the beginning of the next line | 85 |
Horizontal Tabulation | Set a tab at the active cursor position | 88 |
Reverse Index | Move the active position up one line | 8D |
Reset to defaults | Reset console to Initial State | 1B 63 |
Insert [N] Characters | Insert one or more spaces, shifting the remainder of the line to the right | 9B [N] 40 |
Cursor Up [N] Positions | Move cursor up [N] character positions. Default is 1. | 9B [N] 41 |
Cursor Down [N] Positions | Move cursor down [N] character positions. Default is 1. | 9B [N] 42 |
Cursor Forward [N] Positions | Move cursor forward [N] character positions. Default is 1. | 9B [N] 43 |
Cursor Backward [N] Positions | Move cursor backward [N] character positions. Default is 1. | 9B [N] 44 |
Set Cursor Position | Where [N] is row, [M] is column, and semicolon (hex 3B) must be present as a separator, or if row is left out, so the console device can tell that the number after the semicolon actually represents the column number. | 9B [N] [3B M] 48 |
Cursor Horizontal Tabulation | Move cursor forward [N] tab positions. | 9B [N] 49 |
Cursor Next Line [N] | Move cursor [N] lines down. Cursor column is set to 1. | 9B [N] 45 |
Cursor Preceding Line [N] | Move cursor [N] lines up. Cursor column is set to 1. | 9B [N] 46 |
Erase in Display | Clear at end of the display starting from the current cursor position. | 9B 4A |
Erase in Line | Clear at the end of the line starting from the current cursor position. | 9B 4B |
Insert Line | Insert a line above the line containing the cursor. | 9B 4C |
Delete Line | Remove the current line, move all lines up one position to fill gap, and blank the bottom line. | 9B 4D |
Delete Character [N] | Delete the character that the cursor is sitting on and [N] characters to the right of the cursor. | 9B [N] 50 |
Scroll up [N] Lines | Remove line(s) from the top of the console window, move all other lines up, and blank [N] bottom lines. | 9B [N] 53 |
Scroll down [N] Lines | Remove line(s) from the bottom of the console window, move all other lines down, and blank [N] top lines. | 9B [N] 54 |
Cursor Tabulation Control | Controls the cursor tabulation: when [N] = 0, set tab; when [N] = 2, clear tab; and when [N] = 5, clear all tabs. | 9B [N] 57 |
Cursor Backward Tabulation | Move cursor backward [N] tab positions. | 9B [N] 5A |
Set Line Feed Mode | Cause Line Feed to respond as Return + Line Feed. | 9B 32 30 68 |
Reset Newline Mode | Cause Line Feed to respond only as Line Feed. | 9B 32 30 6C |
Enable Scroll | Enable scrolling. This is the default setting. | 9B 3E 31 68 |
Disable Scroll | Disable scrolling | 9B 3E 31 6C |
Autowrap On | Enable word wrapping. This is the default setting. | 9B 3F 37 68 |
Autowrap Off | Disable word wrapping | 9B 3F 37 6C |
Set Page Length to N | In character raster lines, causes console to recalculate, using current font, how many text lines will fit on the page | 9B N 74 |
Set Line Length to N | In character positions, using current font, how many characters should be placed on each line | 9B N 75 |
Set Left Offset to N | In raster columns, how far from the left of the window should the text begin | 9B N 78 |
Set Top Offset to N | In raster lines, how far from the top of the window’s RastPort should the topmost line of the character begin | 9B N 79 |
Graphic Rendition Control Sequences
Command | Comment | Sequence of Characters (in Hexadecimal Form) |
---|---|---|
Plain Text | Plain text | 9B 30 6D |
Boldface On | Bolded | 9B 31 6D |
Italic On | Italics | 9B 33 6D |
Italic Off | Italics off | 9B 32 33 6D |
Underscore On | Underlined | 9B 34 6D |
Underscore Off | Underlined off | 9B 32 34 6D |
Strike-Through On | 9B 39 6D | |
Strike-Through Off | 9B 32 39 6D | |
Reverse Video On | 9B 37 6D | |
Reverse Video Off | 9B 32 37 6D | |
Faint On | Faint (secondary text color) | 9B 32 6D |
Faint Off / Boldface Off | Return to normal text color. This will also turn boldface off. | 9B 32 32 6D |
Concealed On | Enter concealed mode. In the concealed mode chracters are not printed. | 9B 38 6D |
Concealed Off | Exit concealed mode | 9B 32 38 6D |
Set Character Color | Select color 0 | 9B 33 30 6D |
Select color 1 | 9B 33 31 6D | |
Select color 2 | 9B 33 32 6D | |
Select color 3 | 9B 33 33 6D | |
Select color 4 | 9B 33 34 6D | |
Select color 5 | 9B 33 35 6D | |
Select color 6 | 9B 33 36 6D | |
Select color 7 | 9B 33 37 6D | |
Select default color | 9B 33 39 6D | |
Set Character Cell Color | Select color 0 | 9B 34 30 6D |
Select color 1 | 9B 34 31 6D | |
Select color 2 | 9B 34 32 6D | |
Select color 3 | 9B 34 33 6D | |
Select color 4 | 9B 34 34 6D | |
Select color 5 | 9B 34 35 6D | |
Select color 6 | 9B 34 36 6D | |
Select color 7 | 9B 34 37 6D | |
Select default color | 9B 34 39 6D | |
Set Background Color | Select color 0 | 9B 3E 30 6D |
Select color 1 | 9B 3E 31 6D | |
Select color 2 | 9B 3E 32 6D | |
Select color 3 | 9B 3E 33 6D | |
Select color 4 | 9B 3E 34 6D | |
Select color 5 | 9B 3E 35 6D | |
Select color 6 | 9B 3E 36 6D | |
Select color 7 | 9B 3E 37 6D |
Examples
Flash the screen:
SAY '07'x
Clear the console window:
SAY '0c'x
Display a progress indicator utilizing the Vertical Tab:
SAY '' DO index = 0 TO 100 BY 5 SAY '0b'x || 'Processing: ' || index || '%' ADDRESS command 'Wait 1' END
Print the same phrase using 7 different text styles:
/* VARIABLES */ phrase = 'The quick brown fox jumps over a lazy dog' cs_clear = '0c'x cs_plain = '9b306d'x cs_bold_on = '9b316d'x cs_bold_off = '9b32326d'x cs_italic_on = '9b336d'x cs_italic_off = '9b32336d'x cs_strike_on = '9b396d'x cs_strike_off = '9b32396d'x cs_underscore_on = '9b346d'x cs_underscore_off = '9b32346d'x cs_faint_on = '9b326d'x cs_faint_off = cs_bold_off cs_reverse_on = '9b376d'x cs_reverse_off = '9b32376d'x /* Test text styles */ SAY cs_clear || cs_plain || 'Plain' SAY cs_plain || phrase SAY '' SAY cs_plain || 'Bold' SAY cs_bold_on || phrase || cs_bold_off SAY '' SAY cs_plain || 'Italic' SAY cs_italic_on || phrase || cs_italic_off SAY '' SAY cs_plain || 'Strike-through' SAY cs_strike_on || phrase || cs_strike_off SAY '' SAY cs_plain || 'Underscore' SAY cs_underscore_on || phrase || cs_underscore_off SAY '' SAY cs_plain || 'Faint' SAY cs_faint_on || phrase || cs_faint_off SAY '' SAY cs_plain || 'Reverse Video' SAY cs_reverse_on || phrase || cs_reverse_off SAY ''
Test console color features:
/* VARIABLES */ phrase = 'The quick brown fox jumps over a lazy dog' cs_clear = '0c'x cs_defchcolor = '9b33396d'x /* Character colors */ cs_chcolor.0 = '9b33306d'x cs_chcolor.1 = '9b33316d'x cs_chcolor.2 = '9b33326d'x cs_chcolor.3 = '9b33336d'x cs_chcolor.4 = '9b33346d'x cs_chcolor.5 = '9b33356d'x cs_chcolor.6 = '9b33366d'x cs_chcolor.7 = '9b33376d'x cs_defcccolor = '9b34396d'x /* Character cell colors */ cs_cccolor.0 = '9b34306d'x cs_cccolor.1 = '9b34316d'x cs_cccolor.2 = '9b34326d'x cs_cccolor.3 = '9b34336d'x cs_cccolor.4 = '9b34346d'x cs_cccolor.5 = '9b34356d'x cs_cccolor.6 = '9b34366d'x cs_cccolor.7 = '9b34376d'x cs_bgcolor.0 = '9b3e306d'x /* Background colors */ cs_bgcolor.1 = '9b3e316d'x cs_bgcolor.2 = '9b3e326d'x cs_bgcolor.3 = '9b3e336d'x cs_bgcolor.4 = '9b3e346d'x cs_bgcolor.5 = '9b3e356d'x cs_bgcolor.6 = '9b3e366d'x cs_bgcolor.7 = '9b3e376d'x SAY cs_clear || '--- Character Color ---' DO color = 0 TO 7 SAY cs_defchcolor || color || ': ' || cs_chcolor.color || phrase || cs_defchcolor END SAY '' SAY '--- Character Cell Color ---' DO color = 0 TO 7 SAY cs_defcccolor || color || ': ' || cs_cccolor.color || phrase || cs_defcccolor END SAY '' SAY '--- Background Color ---' SAY '' SAY 'Press enter to change the background color.' SAY '' DO color = 0 TO 7 SAY color || ':' END SAY COPIES( '0b'x, 8 + 1 ) DO color = 0 TO 7 OPTIONS PROMPT cs_defchcolor || cs_defcccolor || color || ': ' PARSE PULL key SAY '0b'x || color || ': Using background color ' || color || '.' || cs_bgcolor.color END SAY '' OPTIONS PROMPT '' OPTIONS PROMPT cs_defchcolor || cs_defcccolor || 'Press enter to exit.' PARSE PULL key SAY cs_bgcolor.0