Atari

From Free Pascal wiki
Revision as of 20:45, 8 October 2016 by Chain-Q (talk | contribs) (Atari TOS, initial information)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page is about the Atari TOS version of Free Pascal, which means Motorola 680x0 CPU based Atari systems running TOS and compatibles. Currently, Atari TOS is only supported as a cross-compilation target. The RTL support is currently minimal and lacks functionality to run the compiler itself on Atari TOS.

Identification

To identify Atari TOS during compile-time, use {$IFDEF ATARI}.

SysCalls

Introduction to SysCalls

Free Pascal supports generating Atari TOS-style system calls, also know as traps. It's not required to use inline assembly to do system calls. However, you must declare every function you're going to use in the following way:

function gemdos_fwrite(handle: smallint; count: longint; buf: pointer): longint; syscall 1 64;

Note the syscall modifier in the function declaration. The first argument to the syscall modifier is the trap number to call, and the second one is the trap opcode. All syscall parameters are passed on the stack and they're word (2 byte) aligned. For further examples, see rtl/atari/gemdos.inc in the RTL source.

Linker

For Atari, some versions of GNU ld linker available online is known to be problematic when working together with Free Pascal. It's recommended to use vlink by Frank Wille, while compiling to Atari TOS with FPC. Specifying -XV argument enables vlink for cross compilers. vlink is open source, and it is available here. Binaries are available as part of the vbcc compiler package.