MSX Characters and Control Codes
This page was last modified 20:02, 14 July 2022 by Mars2000you. Based on work by Hope-hunter and Gdx and others.

Contents

General description

This page covers the MSX character set. The character set depends on the region the machine was sold in. e.g. a Japanese machine will have a Japanese character set. The bits 0-3 at address 002Bh in Main-ROM are supposed to indicate the region of MSX character set but this has not been respected by non-Japanese manufacturers.

Some software is dependant on the correct character set, and will show incorrect characters when run on an MSX from another region. Examples are Japanese software using Hiragana, Katakana from its character set, which show as various other characters on European machines. Or European software using characters such as accented letters or math symbols which are replaced by Japanese writing characters on a Japanese machine.

Control codes

The MSX can perform an action by simultaneously pressing the "CTRL" key with another. These actions can be detected during a reading of the keyboard but also performed in text mode by sending the codes to the display. Here is the list of available actions with the corresponding codes (these codes are common to all MSXs):

Code Keys Effect
1 CTRL A - GRAPH Displays an extended graphic character: CTRL+A+CHAR code [64-95] prints the graphic
char code [00-31]. Works with the PRINT instruction and also in the MSX-BASIC interface.
2 CTRL B Moves the cursor to the previous word (not applicable to PRINT instruction)
3 CTRL C Cancels process in MSX-DOS.
5 CTRL E Deletes from the cursor to the end of command line (not applicable to PRINT instruction)
(a command line can be more than one line on the screen, as it can contain 255 characters)
6 CTRL F Moves the cursor forward to the next word (not applicable to PRINT instruction)
7 CTRL G - BEEP Produces a simple 'BEEP' PSG sound
8 CTRL H - BS BACK SPACE: clears a character and pulls to left the cursor and also all the command line.
(PRINT instruction only moves cursor to the left)
9 CTRL I - TAB TAB key (tabulation)
Ah (10) CTRL J - LF Descends the cursor of a line. Generally used on text files and output terminals after the
RETURN command to complete the "new line" process by moving the cursor to next line.
Bh (11) CTRL K - HOME HOME key. Places the cursor at top left.
Ch (12) CTRL L - CLS CLS key on MSX. Clears the entire screen.
Dh (13) CTRL M - RET Execute instruction. In MSX-BASIC interface, it also moves the cursor to a new line,
however the PRINT instruction, and output terminals generally only returns cursor
to the initial position on left.
Eh (14) CTRL N Moves the cursor to the line end (not applicable to PRINT instruction)
Clears output to printer in MSX-DOS
Fh (15) CTRL O
10h (16) CTRL P In MSX-DOS, changes the output from the screen to printer.
11h (17) CTRL Q In MSX-DOS, resumes from a pause.
12h (18) CTRL R - INSERT INSERT key. Switch to insert/overwrite text mode. (not applicable to PRINT instruction)
13h (19) CTRL S Pause in MSX-DOS
14h (20) CTRL T
15h (21) CTRL U Clears the command line where the cursor is located (not applicable to PRINT instruction)
(a command line can be more than one line on the screen, as it can contain 255 characters)
18h (24) CTRL X - SELECT SELECT key.
19h (25) CTRL Y
1Ah (26) CTRL Z
1Bh (27) ESC ESC key. Used to send command using characters in sequence.
(applicable to the PRINT instruction but not for the MSX-BASIC user interface)
1Ch (28) → RIGHT Moves the cursor to the right
1Dh (29) ← LEFT Moves the cursor to the left
1Eh (30) ↑ UP Moves the cursor up
1Fh (31) ↓ DOWN Moves the cursor down
7Fh (127) DELETE DELETE key. Deletes the character on the cursor and pull all the command line to left.
(The PRINT instruction differently deletes, as it doesn't pull the line and moves one step to left)


Escape codes

The MSX can also perform an action by simultaneously pressing the "ESC" key with another. This actions can be carried out in text mode by sending the codes to the display as for the control codes. These codes are compatible with VT-52 or HEATH-19 terminals. Below is the list (these codes are common to all MSXs):

Codes Keys Effect
1Bh+41h (27+65) ESC+A Moves cursor up
1Bh+42h (27+66) ESC+B Moves cursor down
1Bh+43h (27+67) ESC+C Moves the cursor to the right
1Bh+44h (27+68) ESC+D Moves the cursor to the left
1Bh+45h (27+69) ESC+E Clears the screen and moves the cursor to the top-left
1Bh+48h (27+72) ESC+H Places the cursor at top-left (like Home key)
1Bh+4Ah (27+74) ESC+J Clears from cursor positon to the end of screen
1Bh+4Bh (27+75) ESC+K Deletes from cursor to the end of line (single line)
1Bh+4Ch (27+76) ESC+L Inserts a blank line: scroll down the lines below the cursor.
1Bh+4Dh (27+77) ESC+M Removes a line: scroll up the lines bellow the cursor. Returns cursor to the left
1Bh+59h+x+y
(27+89+x+y)
ESC+Y+
(x+32)+(y+32)
Sets cursor coordinates (similar to LOCATE X,Y instruction).
The next character after ESC+Y specifies the column (X: 20h + value).
The following character specifies the row (Y: 20h + value).
1Bh+6Ah (27+106) ESC+j Clears the screen and moves the cursor home (it seems similar to ESC+E)
1Bh+6Ch (27+108) ESC+l Clears a line and keep cursor at the same position (it doesn't scroll)
1Bh+78h+34h (27+120+52) ESC+x+"4" Cursor appears in full size (MSX default)
1Bh+78h+35h (27+120+53) ESC+x+"5" Hides the cursor (similiar to LOCATE ,,0 instruction) (default on MSX reset)
1Bh+79h+34h (27+121+52) ESC+y+"4" Cursor appears in half size (like on insert mode)
1Bh+79h+35h (27+121+53) ESC+y+"5" Shows the cursor (similar to LOCATE ,,1 instruction)


Note: You can cancel an ESC sending sequence just sending another ESC character.

Arabian codes

Arabic MSXs have two character sets, when the CTRL key is pressed while the MSX is booting up to its "beep", the MSX starts with the Hand-ROM with an international character set.

Arabian codes


















  • Control codes are in blue. These are ignored by PRINT instruction in graphic modes.
  • The characters 20h to 7Fh are coded 7-bit ASCII.
  • Green characters are characters specific to Arabic MSX.
  • 8Eh-9Fh codes can be empty characters.
  • Characters from A0h are displayed by default with black background color in SCREEN1 on MSX1.
  • Arabic MSX does not have extended graphic characters.

Note: We will appreciate any help to explain the complet coding of Arabic characters.

International codes

This covers the English USA/International/UK, Germanic and French character sets.

International codes




















  • Control codes are in blue. These are ignored by PRINT instruction in graphic modes.
  • The characters 20h to 7Fh are coded 7-bit ASCII.
  • Green characters are characters specific to Western MSX.
  • The last character (FFh) is the cursor.
  • The bottom table, with two rows (orange characters), are extended graphic characters. To display them in text modes, each must be preceded by the control code 01h. They are also specific to Western MSX and Russian MSX. Shapes of theses characters are located on the first 32 characters. MSX font page if you need info about the International Font.

Brazilian codes

Brazilian with ROM v1.0

Early versions of the Sharp HB-8000 and Gradiente Expert XP-800 computers had character sets, while based on the international character set, were created by their respective companies and different from each other. This caused problems for both software developers and printer manufacturers.

Compared with the international character set, the changes can be found in the tables from 84h - 8Fh. Other characters are the same as the international table.

In addition, since both manufacturers created the additional symbols themselves they used a different font style.

Gradiente v1.0

Brazilian with ROM v1.1

This issue was mostly resolved when Sharp and Gradiente issued a recall to replace, for free, the original 1.0 ROMs with a new 1.1 ROM and also replaced some key caps on the keyboard. Newer Sharp HB-8000 and newer Gradiente computers shipped with these newer ROMs. These newer ROMs comply with the "Brazilian ASCII" specification, or BRASCII.

Some differences however remain:

  • Each manufacturer retained different font styles for the Brazilan characters
  • The only difference is the character at 9Eh, where on the Gradiente ROM they provided the "Cz" currency character for the short lived Brazilian "Cruzados", and on the Sharp HotBit ROM they provided instead the Spanish Peseta "Pt" currency symbol like the international character set.
Sharp HB-8000 v1.1

Sharp HotBit with ROM v1.2

The only difference here is that Sharp replaced the "Pt" symbol with the "Cz" symbol, similar to the v1.1.

Sharp HotHit 1.2 ROM

Japanese

The first 128 characters are the same characters as the ASCII code, except the character "\" (5Ch) which has been replaced by the "¥" character of the Microsoft 8-bit JIS code.

Japanese codes




















  • The above list is for MSX2+ and MSX Turbo R. MSX and MSX2 have differences in Hiragana. It has been modified to allow display on SCREEN 0.
  • Control codes are in blue. These are ignored by PRINT instruction in graphic modes.
  • The characters 20h to 7Fh are coded 7-bit ASCII.
  • Green Hiragana and Purple Katakana are characters that come from the 8 bit JIS code.
  • The last character (FFh) is the cursor.
  • The bottom table, with two rows (orange characters), are extended graphic characters. To display them in text modes, each must be preceded by the control code 01h. They are also specific to Japanese MSX. Shapes of theses characters are located on the first 32 characters. MSX font page if you need info about the Japanese Fonts.

Korean codes

The first 128 characters are the same characters as the ASCII code, except the character "\" (5Ch) which has been replaced by the character "₩".

The next characters appear in a rather specific way. A Korean character (Hangul) is composed of 2 or 3 letters but takes the place of four 8x8 characters (two above and two below) on the screen.

Note: We will appreciate any help to explain the coding of Korean characters.

Russian codes

The first 128 characters, up to 7Fh, are identical to the International character set, including the extended character set.

The range from 80h onward is different. The upper range includes some of the same drawing characters as in the international set but at different locations, and it obviously includes Russian specific characters.

Russian codes






















  • 80h-BEh contain relocated characters from the International character set (C0h-FEh)
  • BFh-FEh contain Russian specific characters
  • FFh is the cursor
  • The bottom two rows (orange characters), are extended graphic characters. To display them in text modes, each must be preceded by the control code 01h. These are the same as found on the International character set. Shapes of theses characters are located on the first 32 characters. MSX font page if you need info about the Russian Font.

The Russian character set is mostly compliant with KOI8-R, except that on MSX the letters «Ъ», «Ё» and «ё» are missing.

Detection

Here is an example of how to detect the character set and various other MSX regional settings from BASIC.

This is a translated version of a program called MSX TYPE from the Dutch MSX Computer Magazine issue 3.

10 REM MSX TYPE
20 REM
30 REM MSX Computer Magazine
40 REM issue 3
50 REM
60 CLS: LOCATE 10,0: PRINT "MSX COMPUTER TYPE"
70 LOCATE 6,5: PRINT "CHARACTER SET: ";
80 I=PEEK(&H2B) AND 15
90 IF I=0 THEN PRINT "JAPANESE"
100 IF I=1 THEN PRINT "INTERNATIONAL"
110 IF I=2 THEN PRINT "KOREAN"
120 LOCATE 10,7: PRINT "DATE TYPE: ";
130 I=(PEEK(&H2B) AND 112)/16
140 IF I=0 THEN PRINT "YEAR-MONTH-DAY"
150 IF I=1 THEN PRINT "MONTH-DAY-YEAR"
160 IF I=2 THEN PRINT "DAY-MONTH-YEAR"
170 LOCATE 0,9: PRINT "INTERRUPT FREQUENCY: ";
180 I=(PEEK(&H2B) AND 128)/128
190 IF I=0 THEN PRINT "60 HERTZ"
200 IF I=1 THEN PRINT "50 HERTZ"
210 LOCATE 11,11: PRINT "KEYBOARD: ";
220 I3=PEEK(&H2D) AND 15
230 IF I3=0 THEN PRINT "JAPANESE"
240 IF I3=1 THEN PRINT "INTERNATIONAL"
250 IF I3=2 THEN PRINT "FRENCH"
260 IF I3=3 THEN PRINT "ENGLISH"
270 IF I3=4 THEN PRINT "DIN"
280 LOCATE 14,13: PRINT "BASIC: ";
290 I=(PEEK(&H2D) AND 240)/16
300 IF I=0 THEN PRINT "JAPANESE"
310 IF I=1 THEN PRINT "INTERNATIONAL"

Note the above is not foolproof. Arabic, Brazilian and Russian MSX computers will claim to have an International or Japanese character set, keyboard and basic.

Links