Next Previous Contents

## 3.9 _sys

> Function

>   Call a subroutine passing register values.

> Header

>   `6502.h`

> Declaration

>   `void __fastcall__ _sys (struct regs* r);`

> Description

>   The function will call the subroutine at the address specified in the `pc` member of the passed `regs` structure. All registers and the CPU flags are set to the values given in the `regs` structure. On return from the subroutine, the new values of the registers and flags are stored back overwriting the old values.

> Limits

>   - Bits 4 and 5 of the flags value in the `regs` structure are ignored when calling the subroutine (they are unchanged from their current values).
>   - The function is only available as fastcall function, so it may only be used in presence of a prototype.
> Availability

>   cc65

> Example

>   None.

Next Previous Contents