Copyright (c) 2012-2016 Hyperion Entertainment and contributors.

AmigaOS Manual: Control Sequences

From AmigaOS Documentation Wiki
Revision as of 13:09, 31 December 2017 by Janne Peräaho (Talk | contribs) (Graphic Rendition Control Sequences)

Jump to: navigation, search

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 Undo Shift Out 0E
Shift Out Set MSB of each character before displaying 0F
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
Faint On Faint (secondary color) 9B 32 6D
Faint Off / Boldface Off Return to normal text color. This will also turn boldface off. 9B 32 32 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
Cursor On Show cursor 9B 20 70
Cursor Off Hide cursor 9B 30 20 70
Slow Blink On  ?  ?
Slow Blink Off  ?  ?
Fast Blink On  ?  ?
Fast Blink Off  ?  ?
Reverse Video On 9B 37 6D
Reverse Video Off 9B 32 37 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  ?  ?
Reset Character Color  ?  ?
Set Cell Color  ?  ?
Reset Cell Color  ?  ?
Set Background Color  ?  ?

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 ''