Sinclair QL

From Free Pascal wiki
Revision as of 00:30, 11 November 2020 by Chain-Q (talk | contribs) (Sinclair QL target, initial page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The Sinclair QL or QDOS port is an experimental "just for fun" m68k target. It targets the Sinclair QL line of computers from the mid-80s, and their operating system QDOS. This port is currently a cross-compiler only target. This is mostly due to hardware limitations of the original unexpanded platform. Later QL clones could run the compiler in theory.

The QL port was implemented by Karoly Balogh during #QLvember 2020, when various online retro communities and YouTubers were running Sinclair QL related projects.

Requirements

The compiled binaries - depending on the size - should be able to run on any Sinclair QL. Memory expansion for more complex programs is highly recommended.

Identification

To identify the Sinclair QL compile-time, use {$IFDEF SINCLAIRQL}.

Stack

The default stack size is set to 16 KiB.

CPU

The default CPU target for the Sinclair QL is the 68000. This is different from most other m68k targets where the default is the 68020.

Alignment

Record elements are aligned to WORD (2 bytes) on the Sinclair QL by default. Use the {$PACKRECORDS n} compiler directive, if you want to change the default aligment. For byte aligned records, a packed record is also possible. Free Pascal also has support for 68000/68008 special alignment requirements.

Assembler

The only supported assembler for the Sinclair QL port is vasm, which is also the default. The Sinclair QL uses the vasm-specific .vobj object format. This means using vasm also requires vlink as linker. vasm is open source, and it is available here. Only vasm versions 1.8 and newer were tested with the Sinclair QL port, older versions might not work.

Building vasm

Note that vasm for m68k needs to be built with the standard syntax module to work with Free Pascal. This is not the default, as most programmers and compilers prefer the Motorola syntax module. A vasm version with the standard syntax module can be built with the following command, issued in the root of the vasm source tree:

 make CPU=m68k SYNTAX=std

The resulting vasmm68k_std executable file is the assembler Free Pascal needs.

Linker

The Sinclair QL ports defaults to vlink by Frank Wille as the default linker, which is the only supported linker as well for this target. vlink is open source, and it is available here.

Please make sure you use vlink version 0.16c or newer. Earlier versions were not tested with Free Pascal and the Sinclair QL target.