<!-- PDF page 77 -->

Three *control codes* that are used with screen output, are those with codes **6**, **8** and **13:**

**CHR$ 6** prints spaces in exactly the same way as a *comma* does in a **PRINT** statement; for instance:

```
PRINT 1; CHR$ 6;2
```

does the same as:

```
PRINT 1,2
```

Obviously this is not a very clear way of using it. A more subtle way is to say:

```
a$="1"+CHR$ 6+"2"
PRINT a$
```

**CHR$ 8** is *backspace*: it moves the print position back *one* place – try:

```
PRINT "1234";CHR$ 8;"5"
```

which prints up:

```
1235
```

as **5** takes the place of **4** from the string printed in the first part of the **PRINT** statement.\
**CHR$ 13** is *carriage return*: it moves the print position on to the beginning of the next line.

Effectively:

```
PRINT "1234";CHR$ 13;"5678"
```

is the same as:

```
PRINT "1234":PRINT "5678"
```

It may not be immediately apparent why you wouldn't do the latter but it's possible also to do:

```
a$="1234"+CHR$ 13+ "5678"
PRINT a$
```

In which case you can see the usefulness of a single *carriage return* character.

The screen also uses *control codes* **16** to **23**; these are explained in *Chapters 13 and 14. All the control codes* are listed in *Appendix A*.

Using the codes for the characters we can extend the concept of *alphabetical ordering* to cover strings containing any characters, not just letters. If instead of thinking in terms of the usual alphabet of 26 letters we use the extended alphabet of 256 characters, in the same order as their codes, then the principle is exactly the same. For instance, these strings are in their ZX Spectrum Next alphabetical order: (Notice the rather odd feature that lower case letters come after all the capitals: so **a** comes after **Z**; also, spaces *matter*.)

```
CHR$ 3+"ZOOLOGICAL GARDENS"
CHR$ 8+"AARDVARK HUNTING"
"   AAAARGH!"
"(Parenthetical remark)"
"100"
"129.95 inc. VAT"
"AASVOGEL"
"Aardvark"
"PRINT"
"Zoo"
```

