Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

180 ASC American Standard Code (ASCII) Purpose There are two commonly used methods of talking about characters (things like A, B, 5, ?, and so on). Obviously they are single characters! So we can say D$="H" - meaning put the letter H into the box in the computer labelled D$. The computer understands this but it doesn’t actually put an H into the box, Instead it stores a number which represents the letter H (in fact the number is 72). Every character has a unique corresponding number called its ASCII code. (ASCII stands for American Standard Code for Information Interchange.

The abbreviation ASCII rhymes with ‘Laski’.) Sometimes it is convenient to find out what number corresponds to a particular character - that is its ASCII code. You can look it up at the back of this book or you can say to the computer PRINT ASC("H") The function ASC gives the ASCII value of the first letter in the string. Thus PRINT ASC("Good") gives 71, the ASCII value of ‘G’. The reverse process of generating a one-character string from a given ASCII value is performed by the function CHR$ . 25 X=ASC("Today") Examples would put the ASCII value of ‘T’ which is 84 into the variable X.

650 value5=ASC(A$) Description A function returning the ASCII character value of the first character of the argument string. If the string is null (empty) then -1 will be returned. Syntax = ASC ( ) Associated keywords CHR$ , STR$ , VAL