ASCII

From BeebWiki
Revision as of 17:52, 12 November 2017 by Jgharston (talk | contribs) (Slight formatting change.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ASCII, the American Standard Code for Information Interchange, is a 7-bit character set used in the BBC Micro series.

It includes a set of control codes for data transmission which were not relevant to the BBC Micro's display and so were reused as VDU commands.

The BBC Micro series supports 8-bit characters and so the higher order characters (values 128 to 255) are user definable in all MODEs except MODE 7. RISC OS predefines the set to ISO Latin 1 which is an 8-bit character set.

There are some differences between standard ASCII and the BBC Micro's two character sets. In MODEs 0 to 6 the backtick (`) is replaced with a pound sign (£) and the vertical bar (|) is broken (¦). On the other hand MODE 7 is a Teletext mode, whose character set is mostly ASCII with a few replaced and relocated characters. OSWRCH translates three of the ASCII characters to their Teletext equivalents before storing them in the MODE 7 screen memory.

In BASIC, ASC returns the ASCII value of a character. CHR$ creates a character from its ASCII value, and VDU prints characters by value.

Standard ASCII character set
00 10 20 30 40 50 60 70
00 NUL DLE   (Space) 0 @ P ` p
01 SOH DC1  ! 1 A Q a q
02 STX DC2 " 2 B R b r
03 ETX DC3 # 3 C S c s
04 EOT DC4 $ 4 D T d t
05 ENQ NAK  % 5 E U e u
06 ACK SYN & 6 F V f v
07 BEL ETB ' 7 G W g w
08 BS CAN ( 8 H X h x
09 HT EM ) 9 I Y i y
0A LF SUB *  : J Z j z
0B VT ESC +  ; K [ k {
0C FF FS , < L \ l |
0D CR GS - = M ] m }
0E SO RS . > N ^ n ~
0F SI US /  ? O _ o DEL
Differences in standard ASCII and BBC character sets
ASCII value (hex) (decimal) Standard character In MODES 0 to 6 In MODE 7 Teletext value (hex)
23 35 # # # 5F
5B 91 [ [ 5B
5C 92 \ \ ½ 5C
5D 93 ] ] 5D
5E 94 ^ ^ 5E
5F 95 _ _ 60
60 96 ` £ £ 23
7B 123 { { ¼ 7B
7C 124 | ¦ 7C
7D 125 } } ¾ 7D
7E 126 ~ ~ ÷ 7E

-- beardo 22:32, 7 November 2007 (UTC)