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

378 39 Indirection operators Indirection operators are not normally available on personal computers. They enable the user to read and write to memory in a far more flexible way than by using PEEK and POKE. They are intended for programmers using the computer’s assembler or programmers wishing to create their own data structures. There are three indirection operators: Name Purpose Number of bytes affected ? query Byte indirection operator 1 ! shriek Word indirection operator 4 dollar String indirection operator 1 to 256 For the sake of illustration let us play with the memory around location &2000 (that is 2000 hex – an appreciation of hex numbers is essential.

If you don’t understand hex then you will not need to use indirection operators). Let us set the variable M to &2000 M= &2000 ?M means the contents of memory location M , so to set the contents of &2000 to 40 we write ?M = 40 and to print the contents of memory location &2000 we write PRINT ?M Those familiar with other dialects of BASIC will realise that Y=PEEK(X) becomes Y=?X and POKE X,Y becomes ?X=Y The query operator acts on one byte of memory only. The word indirection operator (shriek) acts on four successive bytes. For example !M=&12345678 would set location &2000=&78 &2001=&56 &2002=&34 &2003=&12