SYS address _ [ WITH REG(r1)=v1[, REG(r2)=v2 [, ... ] ] ] _ [ RETURN x1=REG(r1)[, x2=REG(r2)[, ... ] ] ] _ [ ON target1[, target2[, ... ] ] ]
This command allows you to start the execution of a subroutine, written directly in machine language, starting from the indicated address. It must be noted that this jump is intended as a return: any assembly instruction that returns from execution will continue the execution of the program from the next ugBASIC line.
Moreover, it is possible to communicate with the machine code. This is made possible by indicating, at the same time as the call, the population of specific input registers and the recovery of values from specific output registers.
The extended syntax allow the specification of r1
, r2
, .. as the various
processor registers, v1
, v2
, .. are the values passed in the various
registers and x1
, x2
, .. are the variables that will receive the
execution result from the various registers. Since the registers are different
from CPU to CPU, it can be useful to add the ON
target specification.
SYS #49142 SYS indirizzo SYS indirizzo WITH REG(A)=42 RETURN y=REG(B) ON CPUZ80
See also the following example files:
Sy
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!