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

340 USR user subroutine Purpose The USR function provides the user with a means of calling sections of machine code program which are designed to return one value. When the machine code section is called the computer sets the processor’s A, X and Y registers to the least significant bytes of A%, X% and Y%. The carry flag (C) is set to the least significant bit of C%. On return from the machine code section, an integer number is generated from the four registers P, Y, X, A (most significant byte to least significant byte). Again it must be emphasised that USR returns a result while CALL does not.

Therefore you must either assign the result to a variable, eg Registers=USR(&3000) or print the result, eg PRINT USR(&3000) Each individual register may be obtained as follows: 10 DIM registers 3 20 !registers = USR(address) After these two lines are executed, Accumulator = registers?0 X = registers?1 Y = registers?2 Flags = registers?3 Examples 1400 R=USR(&3000) 670 result%=USR(plot5) Description A function allowing machine code to return directly a value for problems which do not require the flexibility of CALL .