Available on: all targets
See also: EXEC

SYS

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.

SYNTAX

 SYS address _
      [ WITH REG(r1)=v1[, REG(r2)=v2 [, ... ] ] ] _
      [ RETURN x1=REG(r1)[, x2=REG(r2)[, ... ] ] ] _
      [ ON target1[, target2[, ... ] ] ]


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

 SYS #49142
 SYS indirizzo
 SYS indirizzo WITH REG(A)=42 RETURN y=REG(B) ON CPUZ80


Used in:

ABBREVIATION: Sy

Join BASIC 10Liner Contest with ugBASIC!

An interesting competition is held at the beginning of each year: the BASIC 10Liner Contest. It is possible to use ugBASIC to participate in the next "BASIC10Liner" competition, in the following categories:

  • PUR-120 - A game in 10 lines of max 120 characters (w/abbrev.)
  • EXTREME-256 - A game in 10 lines of max 256 characters (w/abbrev.)
  • SCHAU - Any program in 10 lines of max 256 characters (w/abbrev.)
In order to reduce space you can use this abbreviation for this instruction:

SYS ↔ Sy

Any problem?

If you have found a problem with this keyword, if you think there is a bug or, more simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!

open an issue BACK TO KEYWORDS