{{htmlmetatags>metatag-robots=() metatag-title=(SYS | ugBASIC User Manual) metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum) metatag-description=(Manual page for SYS) metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png) metatag-og:title=(SYS | ugBASIC User Manual) metatag-og:description=(Manual page for SYS) }} ====== ugBASIC User Manual ====== ===== SYS ✓ ===== ===== SYNTAX ===== SYS address _ [ WITH REG(r1)=v1[, REG(r2)=v2 [, ... ] ] ] _ [ RETURN x1=REG(r1)[, x2=REG(r2)[, ... ] ] ] _ [ ON target1[, target2[, ... ] ] ] ==== PURPOSE ==== 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. ==== EXAMPLE ==== SYS #49142 SYS indirizzo SYS indirizzo WITH REG(A)=42 RETURN y=REG(B) ON CPUZ80 See also the following example files: * ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/extern_example_01.bas|extern_example_01.bas]]'' ==== ABBREVIATION ==== Sy ==== AVAILABLE ON ==== * * Atari (400/800) * Atari XL/XE * Commodore 128 (MOS 8502) * Commodore 128 (Zilog Z80) * Commodore 64 * Commodore 64+REU * TRS-80 Color Computer * TRS-80 Color Computer 3 * ColecoVision * Amstrad CPC 664 * Dragon 32 * Dragon 64 * Thomson MO5 * Thomson MO5 * Olivetti Prodest PC128 * Commodore PLUS/4 * SEGA SC-3000 * SEGA SG-1000 * * VG-5000 * Commodore VIC-20 * ZX Spectrum 48 ==== SEE ALSO ==== [[EXEC]] ==== ANY PROBLEM? ==== If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON SYS|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY ===== [[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]