P8SCII

P8SCII is PICO-8's character set. It has 256 codes, consisting of 16 control codes and 240 printable characters (letters, numbers, symbols).

For detailed information about control codes, see P8SCII Control Codes.

## P8SCII reference

### Control codes

Control codes describe effects that occur during printing of strings via the print() function. Typically, you specify a control code in a string literal with an escape sequence. Code strings can also be calculated by number with chr(). Except for cursor position, foreground color, and audio in progress, effects are reset at the end of the print() function call.

Some codes accept parameters as characters after the control code. See P8SCII Control Codes for more details.

### Symbols and Japanese punctuation

Characters 16-31 are symbols useful as icons or Japanese punctuation.

These can be typed by entering one of the Japanese modes (Ctrl+J/Ctrl+K) then pressing the key in the Entry column

### ASCII characters

Printable characters 32-127 match the ASCII standard.

Within PICO-8, English letters in the range 65-90 print in *lowercase* (small caps), while letters in the range 97-122 print in *uppercase*.

Lowercase letters (small caps) can be typed in puny font mode (Ctrl+P).

### Typeable symbols

Characters 127-153 and 254-255 are graphical symbols proprietary to PICO-8.

Symbols in the range 128-153 can be entered in the PICO-8 editor by holding the Shift key and pressing a letter key, assigned in alphabetical order. Many symbols have intuitive assignments. For example, the Up, Down, Right, Left, X, and O keypad symbols are assigned to Shift-U, Shift-D, Shift-R, Shift-L, Shift-X, and Shift-O, respectively.

**Tip:** The btn() and btnp() functions accept the keypad symbols as an argument, as an alternative to the key code. Use the corresponding symbol as if it were a variable name, without string quotes:

```
if btn(❎) then
  jump()
end

```

When printed, characters 128-255 are eight pixels wide. Characters 16-127 print as four pixels wide.

**Note:** PICO-8 uses variation selector 16 (U+FE0F) with the Unicode emoji symbols for Down key (⬇️), Left key (⬅️), O key (🅾️), Right key (➡️), and Up key (⬆️). Not all emoji-capable displays show an emoji variant glyph for Black Rightwards Arrow (U+27A1), but PICO-8 uses the variation selector anyway. The variation selector is *not* used with X key (U+274E).

### Hiragana

Characters 154-203 are the Japanese Hiragana alphabet, and characters 204-253 are the Japanese Katakana alphabet. Japanese characters appear in order, followed by the four digraph indicators.

Japanese diacritics and punctuation can be found in characters 24-31.

Hiragana characters can be typed by entering Hiragana mode (Ctrl+J) and then typing out the character's sound, as seen in the table below.

### Katakana

Characters 204-253 are the Japanese Katakana alphabet. Japanese characters appear in order, followed by the four digraph indicators.

Japanese diacritics and punctuation can be found in characters 24-31.

Katakana characters can be typed by entering Katakana mode (Ctrl+K) and then typing out the character's sound, as seen in the table below.

### Remaining symbols

The final two characters in the P8SCII set offer two more symbols.

These can be typed by entering one of the Japanese modes (Ctrl+J/Ctrl+K) then pressing the key in the Entry column

## Using PS8SCII codes

All characters and codes can appear in string literals using either typed characters or escape sequences. Some codes have special escape sequences, such as `\n` for a newline code. All codes can be entered via their number using an escape sequence such as `\0xxx`, where `xxx` is the number in decimal.

```
print("press ❎ to jump\npress 🅾️ to use an item")

price = 729
print("cost: " .. chr(26) .. tostr(price))

```

The chr() function takes a number and returns a one-character string with the corresponding P8SCII character. The ord() function takes a one-character string and returns the P8SCII code for that character as a number.

All printable characters have an equivalent symbol in the Unicode character set. You can type a printable character in the PICO-8 editor by entering the corresponding symbol or by pasting it from the clipboard. PICO-8 uses the Unicode equivalent when saving to a .p8 file, printing to the console via printh(), or copying to the clipboard.

**Note:** The P8SCII value is *not* the same as the Unicode value! The character sets overlap in the ASCII range (32-126), with uppercase and lowercase swapped. Otherwise, a P8SCII printable character maps to a Unicode character with the same meaning (as for Japanese letters) or a pictographic equivalent (as for symbols).