DPEEK aRead word2 from memory (double PEEK) – See Chapter 23
USR3 aExecute Machine Code routine – See Chapter 25
USR$ aExecute Machine Code routine – See Chapter 25
BIN nSynonym for @n, specifying binary values
RND nGenerates pseudo-random value in range 0 to n–1
(equivalent to floating-point INT (RND*n) )
BANK b PEEK oRead byte at offset o from bank b – See Chapter 23
BANK b DPEEK oRead word at offset o from bank b (double PEEK) – See Chapter 23
BANK b USR oExecute Machine Code routine at offset o in bank b – See Chapters 23 and 25
BANK b USR$ oExecute Machine Code routine at offset o in bank b – See Chapters 23 and 25

These are written by including a % sign in front of them like all integer expressions. For example to read from hardware port 254:

%a = % IN 254

Or to check what speed your ZX Spectrum Next is running (masking the speed bits of NextREG 7) you could give :

PRINT %REG 7 & BIN 00000011

Randomly read a byte from the ROM:

%a=%RND 16384:PRINT %a,% PEEK a

Exercise

  1. Use the function FN sq(x)=x*x to test SQR. You should find that:

    FN sq(SQR x)=x

    if you substitute any positive number for x, and:

    SQR FN s(x)=ABS x

    whether x is positive or negative (Why the ABS?)

  2. Write functions FN RIGHT$ and FN MID$

2 A word in standard computer terminology is a two-byte (ie. 16 bit) value. 32 bit values (two-word) are called Long Words. 3: USR and USR$ are very special functions as they also act like commands but using a function syntax


ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.