User Tools

Site Tools


ugbasic:user:kw:exec
Translations of this page:


ugBASIC User Manual

EXEC ✓

SYNTAX

   EXEC 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

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

See also the following example files:

ABBREVIATION

 E#

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

SYS

ANY PROBLEM?

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!

POWERED BY