Sharp Pocket Computer Resources
Internal character code of the PC-1251

Internal character code of the PC-1251

The PC-1251 uses no standard ASCII code, it uses it's own code, mixed up with the basic tokens. See the tables below (characters marked white are createable with the keyboard).
 
 
L\H 0 1 2 3 4 5 6 7
0 Str.end Ins.mark Ins.mark ( 0 Space P  ~ 
1 Japan Space Space ) 1 A Q  ~ 
2 Japan " " > 2 B R  ~ 
3 Japan ? ? < 3 C S  ~ 
4 Japan ! ! = 4 D T  ~ 
5 Japan # # + 5 E U  ~ 
6 Japan % % - 6 F V  ~ 
7 Japan ¥ ¥ * 7 G W  ~ 
8 Japan $ $ / 8 H X  ~ 
9 Japan Pi Pi ^ 9 I Y  ~ 
A Japan Sqrt Sqrt Japan . J Z  ~ 
B Japan , , Japan Exp K  ~   ~ 
C Japan ; ; Japan Cur.blk L  ~   ~ 
D Japan : : Japan ~ M  ~  ASC
E Japan @ @ Japan _ N  ~  VAL
F Japan & & Japan Space O  ~  LEN

 
8 9 A B C D E F H/L
 ~  TO SIN RUN GRAD IF   0%*!=T 0
AND STEP COS NEW PRINT FOR Jap.Tok Jap.Tok 1
>= THEN TAN MEM INPUT LET W Crash 2
<= RANDOM ASN LIST RADIAN REM     3
<>  ~  ACS CONT DEGREE END Crash Jap.Tok 4
OR WAIT ATN DEBUG CLEAR NEXT   Crash 5
NOT ERROR EXP CSAVE  ~  STOP Jap.Tok   6
SQR  ~  LN CLOAD  ~  GOTO Crash Jap.Tok 7
CHR$  ~  LOG MERGE  ~  GOSUB     8
COM$ KEY INT TRON CALL CHAIN I Crash 9
INKEY$  ~  ABS TROFF DIM PAUSE Jap.Tok % A
STR$ SETCOM SGN PASS DATA BEEP Crash   B
LEFT$  ~  DEG LLIST ON AREAD Japan   C
RIGHT$  ~  DMS PI OFF USING Japan ASC D
MID$ ROM RND OUTSTAT POKE RETURN Crash VAL E
 ~  LPRINT PEEK INSTAT READ RESTORE   LEN F

Hints if you want to build a converter:

  • The characters A - Z and 0 - 9 may be converted to ASCII code by calculating Sharp code minus sixteen.
  • All other characters must be converted with a table, I can't see any conversion system here.
  • The characters Pi, Sqrt and Exp may be a problem, because there is no equivalent code in ASCII.
  • The BASIC functions ASC and CHR$ are handling the ASCII code, not the Sharp code.
Edgar Pühringer
last modified: 2009-10-14