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

54 How numbers and letters are stored in the computer’s memory Each memory location in the computer can be used to store any number between, and including, 0 and 255, and yet some way has to be found to store letters and also very large numbers. A number of codes are used in the computer in much the same way that different groups of people have used different codes to count. Thus the number 1984 can be written as MCMLXXXIV in Roman numerals or 1984 in decimal Arabic numerals or 7C0 in hexadecimal Arabic or 11111000000 in binary The need to transmit and store letters has produced another set of codes.

The letter ‘J’ is coded in various ways thus in Morse 10001010 in ASCII binary 4A in ASCII hexadecimal 74 in ASCII decimal The ASCII (American Standard Code for Information Interchange) is by far the most common code used by computers to represent characters. A complete code table is given in Appendix C. When you tell the computer A$ = "HELLO" it stores the ASCII codes for the letters in the word HELLO in successive memory locations. The fact that they are stored as ASCII codes is really irrelevant as far as the user is concerned, it just works.

However, there are times when the user needs to know about the ASCII codes and two functions are provided to convert between characters and ASCII codes. The function ASC converts a character into its ASCII code. Thus PRINT ASC("J") would print 74. The reverse function, of converting an ASCII code into a character, is performed by CHR$ . Thus PRINT CHR$(74) would print the letter J . In fact, one quite often needs to use PRINT CHR$ , so there is a further shortened version of that statement. It is VDU ; VDU 74 would also print the letter J .