In and Out of Machine Language

Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n8 (Volume 2, Issue 8)
Date: August 1981
Pages: 5

You usually talk to your computer in BASIC, whose commands are the keywords on your keyboard. But when you use machine language (ML) programs, you have no keys to press directly. So we need to tell the machine to RUN a ML program, and to tell it to STOP.

USR(X) and USR X, on the 4K and 8K ROM respectively, are BASIC commands you can type on your keyboard that tell the computer to RUN a ML program. X, called the argument of the command, is the address of the first ML command in the program. USR tells the ZX80 to go to the address X and execute ML until told to stop. Put your USR call at the end of a BASIC program POKEing ML commands (see Beginners’ Loading ML Programs, this issue).

But once you transfer computer control to a ML program, it will never come back unless a RETURN statement in the ML program tells it to. This command sends the computer back to BASIC. In decimal ML programs, this command is 201 (C9 in hex). Check that this is the last command in any ML program you run, or you’ll have to pull the plug to get your machine out of ML.