Difference between revisions of "Sinclair QL"
m (stack size change) |
(Added simple build instructions.) |
||
Line 42: | Line 42: | ||
Please make sure you use '''vlink''' version 0.16c or newer. Earlier versions were not tested with Free Pascal and the Sinclair QL target. | Please make sure you use '''vlink''' version 0.16c or newer. Earlier versions were not tested with Free Pascal and the Sinclair QL target. | ||
+ | |||
+ | ==Building== | ||
+ | |||
+ | To build a Sinclair QL cross-compiler, follow these steps: | ||
+ | |||
+ | # Install the latest stable FPC version for your host platform. This will be used as the startup compiler. | ||
+ | # Check out FPC SVN trunk into a directory. | ||
+ | # Make sure you have the binaries '''vasmm68k_std''' and '''vlink''' in the '''PATH'''. ''(See above.)'' | ||
+ | # Go to the trunk's main directory and execute the following commands: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | make clean OS_TARGET=sinclairql CPU_TARGET=m68k | ||
+ | make crossall OS_TARGET=sinclairql CPU_TARGET=m68k BINUTILSPREFIX= | ||
+ | make crossinstall OS_TARGET=sinclairql CPU_TARGET=m68k BINUTILSPREFIX= INSTALL_PREFIX="<path/to/install>" | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | If you did everything right, you will find a working Sinclair QL cross-compiler with the pre-built RTL and Packages units in the install path you've specified. If you plan to rebuild FPC often, you might want to put the above commands in a script for easy rebuilding. | ||
+ | |||
+ | Now, lets create a default '''fpc.cfg''' for Sinclair QL cross compiling. Create a file called '''<path/to/install>/lib/fpc/etc/fpc.cfg'''. ''(Note: this is the path on Unix systems. Free Pascal on other platforms might expect a different path.)'' Put the following lines into that file, and fix up the paths: | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | #IFDEF CPUM68K | ||
+ | -Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET | ||
+ | -Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET/* | ||
+ | #IFDEF SINCLAIRQL | ||
+ | -FD</path/to/vasm-and-vlink> | ||
+ | #ENDIF | ||
+ | #ENDIF | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Optionally add '''<path/to/install>/lib/fpc/3.3.1/''' directory to the '''PATH''', so you'll have direct access to the cross-compiler. ''(Note: this is the path on Unix systems. Free Pascal on other platforms the '''ppcross68k''' compiler binary might be in a different path.)'' If everything went right, you now should be able to build Sinclair QL executables with: | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | ppcross68k -Tsinclairql <source.pas> | ||
+ | </syntaxhighlight> | ||
+ | |||
[[Category:Operating Systems and Platforms]] | [[Category:Operating Systems and Platforms]] |
Revision as of 13:54, 19 November 2020
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, however, there are no plans to support these due to their extreme rarity.
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 8 KiB, which is quite small for a Pascal program. For more complex programs you'll probably need to increase this.
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.
Building
To build a Sinclair QL cross-compiler, follow these steps:
- Install the latest stable FPC version for your host platform. This will be used as the startup compiler.
- Check out FPC SVN trunk into a directory.
- Make sure you have the binaries vasmm68k_std and vlink in the PATH. (See above.)
- Go to the trunk's main directory and execute the following commands:
make clean OS_TARGET=sinclairql CPU_TARGET=m68k
make crossall OS_TARGET=sinclairql CPU_TARGET=m68k BINUTILSPREFIX=
make crossinstall OS_TARGET=sinclairql CPU_TARGET=m68k BINUTILSPREFIX= INSTALL_PREFIX="<path/to/install>"
If you did everything right, you will find a working Sinclair QL cross-compiler with the pre-built RTL and Packages units in the install path you've specified. If you plan to rebuild FPC often, you might want to put the above commands in a script for easy rebuilding.
Now, lets create a default fpc.cfg for Sinclair QL cross compiling. Create a file called <path/to/install>/lib/fpc/etc/fpc.cfg. (Note: this is the path on Unix systems. Free Pascal on other platforms might expect a different path.) Put the following lines into that file, and fix up the paths:
#IFDEF CPUM68K
-Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET
-Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET/*
#IFDEF SINCLAIRQL
-FD</path/to/vasm-and-vlink>
#ENDIF
#ENDIF
Optionally add <path/to/install>/lib/fpc/3.3.1/ directory to the PATH, so you'll have direct access to the cross-compiler. (Note: this is the path on Unix systems. Free Pascal on other platforms the ppcross68k compiler binary might be in a different path.) If everything went right, you now should be able to build Sinclair QL executables with:
ppcross68k -Tsinclairql <source.pas>