Difference between revisions of "ASCII"

From BeebWiki
Jump to: navigation, search
m (1 revision)
m (Slight formatting change.)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
[[Category:Display]]
 
[[Category:Display]]
'''ASCII''', the '''A'''merican '''S'''tandard '''C'''ode for '''I'''nformation '''I'''nterchange, is a 7-bit character set used in the BBC Micro series.
+
'''ASCII''', the '''A'''merican '''S'''tandard '''C'''ode for
 +
'''I'''nformation '''I'''nterchange, 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 <code>[[VDU]]</code> commands.
+
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
 +
<code>[[VDU]]</code> commands.
  
The BBC Micro series supports 8-bit characters and so the higher order characters (values 128 to 255) are user definable in all <code>MODE</code>s except <code>MODE 7</code>. RISC OS predefines the set to ISO Latin 1 which is an 8-bit character set.
+
The BBC Micro series supports 8-bit characters and so the higher order
 +
characters (values 128 to 255) are user definable in all <code>MODE</code>s
 +
except <code>MODE 7</code>. 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 <code>[[MODE]]</code>s 0 to 6 the backtick (`) is replaced with a pound sign (&pound;) and the vertical bar (&#124;) is broken (&brvbar;). On the other hand <code>[[MODE 7]]</code> 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 <code>MODE 7</code> screen memory.
+
There are some differences between standard ASCII and the BBC Micro's two
 +
character sets. In <code>[[MODE]]</code>s 0 to 6 the backtick (`) is
 +
replaced with a pound sign (&pound;) and the vertical bar (&#124;) is broken
 +
(&brvbar;). On the other hand <code>[[MODE 7]]</code> 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 <code>MODE 7</code> screen
 +
memory.
  
In BASIC, <code>[[ASC]]</code> returns the ASCII value of a character. <code>[[CHR$]]</code> creates a character from its ASCII value, and <code>[[VDU]]</code> prints characters by value.
+
In BASIC, <code>[[ASC]]</code> returns the ASCII value of a character.
 +
<code>[[CHR$]]</code> creates a character from its ASCII value, and
 +
<code>[[VDU]]</code> prints characters by value.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 35: Line 51:
 
|- style="text-align:center;vertical-align:top"
 
|- style="text-align:center;vertical-align:top"
 
! 06
 
! 06
| [[VDU 6|ACK]] || [[VDU 22|SYN]] || &amp; || 6 || F || V || f || v
+
| [[VDU 6|ACK]] || [[VDU 22|SYN]] || & || 6 || F || V || f || v
 
|- style="text-align:center;vertical-align:top"
 
|- style="text-align:center;vertical-align:top"
 
! 07
 
! 07
Line 53: Line 69:
 
|- style="text-align:center;vertical-align:top"
 
|- style="text-align:center;vertical-align:top"
 
! 0C
 
! 0C
| [[VDU 12|FF]] || [[VDU 28|FS]]  || , || &lt; || L || \ || l
+
| [[VDU 12|FF]] || [[VDU 28|FS]]  || , || < || L || \ || l
 
| &#124;
 
| &#124;
 
|- style="text-align:center;vertical-align:top"
 
|- style="text-align:center;vertical-align:top"
Line 60: Line 76:
 
|- style="text-align:center;vertical-align:top"
 
|- style="text-align:center;vertical-align:top"
 
! 0E
 
! 0E
| [[VDU 14|SO]] || [[VDU 30|RS]]  || . || &gt; || N || ^ || n || ~
+
| [[VDU 14|SO]] || [[VDU 30|RS]]  || . || > || N || ^ || n || ~
 
|- style="text-align:center;vertical-align:top"
 
|- style="text-align:center;vertical-align:top"
 
! 0F
 
! 0F

Latest revision as of 16:52, 12 November 2017

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)