Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileCALL addr[(x,y$,...)] addr: avar (at least 32-bit, ideally integer-type: adr%) x: iexp y: sexp Assembler or C subroutines can also be called with the instruction CALL, where 'addr' is the address of the assembler program, which must end with an RTS instruction. It is possible to pass a parameter list to the routine. When the CALL is made, the return address is found at the top of the stack followed by the number of parameters given as a 16-bit word, and finally the address, as a 32-bit longword, of the parameter list. All parameters will be put into memory as long (32-bit) words. Strings may also be passed to the subroutine, in which case it will be the address of the string which is found in the parameter list. Stack structure: (sp) --> Return address 4(sp) --> Number of parameters (16-bit) 6(sp) --> Address of the parameters (32-bit) Example: CALL addr%(a&,b&) To locate the parameters: lea 6(sp),a0 (a0) --> a& (4 bytes) 4(a0) --> b& (4 bytes) Memo: This command is broken in the editor, but works compiled. For compiler options see section 'Register Saving'. Registers a3 to a7 must remain unchanged.