Edit this page

Escape codes


KEY
        ESC    char 27 ($1B).
        #      (sometimes optional) number in decimal.

action                    ANSI       Open Firmware

clear screen              ESC[2J     ESC[J
home cursor               ESC[H      none, use move: ESC[11;12H
clear to end of line      ESC[K      same
move up # lines           ESC[#A     same
move down # lines         ESC[#B     same
move right # lines        ESC[#C     same
move left # lines         ESC[#D     same
move to row/col #/#       ESC[#;#H   ESC[#1;#2H
reset colors/attributes   ESC[0m     same
set bold on               ESC[1m     might work
inverse video             ?          ESC[7m
forground color           ESC[3#m
background color          ESC[4#m

foreground color, background color and bold can be combined like so:

ESC[3#;4#;1m

Here are the colors:

ANSI        Open Firmware
0: black    black
1: red      blue
2: green    green
3: yellow   cyan
4: blue     red
5: magenta  magenta
6: cyan     yellow (kinda orange if you ask me)
7: white    white

Note: above are the default Open Firmware colors on my machine. It is quite easy to change the palette. I may add a couple lines to my bootmenu to make the the Open Firmware colors the same as Linux. Also note that PearPC uses the ANSI colors.

The ; is a seperator, and the fields are optional. m is a terminator. So you could set just the foreground color like this:

ESC[3#m

See Also:

Open Firmware

herkforth docs

Edit this page · home ·