DEF USR¶
Syntax¶
Versions: Extended, Disk
Purpose¶
To specify the starting address of an assembly language subroutine.
Remarks¶
<digit>may be any digit from 0 to 9. The digit corresponds to the number of the USR routine whose address is being specified.- If
<digit>is omitted, DEF USR0 is assumed. - The value of
<integer expression>is the starting address of the USR routine. - Any number of DEF USR statements may appear in a program to redefine subroutine starting addresses, thus allowing access to as many subroutines as necessary.
- See Appendix C, Assembly Language Subroutines, in the original MBASIC documentation for details on writing assembly language routines.
Example¶
This example defines USR routine 0 to start at memory location 24000, then calls it with a calculated parameter.
Implementation Note¶
⚠️ Not Implemented: This feature defines the starting address of assembly language subroutines and is not implemented in this Python-based interpreter.
Behavior: Statement is parsed but no operation is performed
Why: Cannot execute machine code from a Python interpreter. DEF USR was used to specify memory addresses where hand-written assembly language routines were loaded for performance-critical operations or hardware access.
Alternative: Use DEF FN to define custom functions in BASIC instead of assembly language subroutines.
Historical Reference: The documentation above is preserved from the original MBASIC 5.21 manual for historical reference.