This is an old revision of the document!
Running an Assembler program from BASIC using SYS
A Basic program can call Assembler code using the SYS command. See the description of the SYS Basic command. Before calling the specified address, SYS “loads” the accumulator, the X and the Y index register, and the status register with the bytes stored at addresses 780–783/$030C–$030F: From BASIC, one can set up parameters and data here, to be processed by the machine language routine.
This typically leads to games using a Basic stub to call the game assembler code. This leads to a typical line like this:
1984 SYS 2084
The hexdump shows:
>C:0800 00 0c 08 c0 07 9e 20 32 30 38 34 00 00 00 00 00 ...... 2084.....
At $0801 is the pointer to the next Basic line the following two byte are the little endian number $07c0 which is the line number 1984 the follows $9e which is the Basic token for SYS. After that we have a space and the number 2084 in PETSCII.