Recent

Author Topic: How to compile for spectrum?  (Read 2315 times)

Learner

  • Newbie
  • Posts: 2
How to compile for spectrum?
« on: September 13, 2023, 02:08:47 pm »
On the wiki is a large complicated Make file for linux.

Can someone please tell me what command line arguments/options to use to compile for zx spectrum?

I tried compiling the latest FPC from Git. Then I did 'fpd -it ' to see what available targets there are. But z80 or spectrum were not on there.

af0815

  • Hero Member
  • *****
  • Posts: 1359
Re: How to compile for spectrum?
« Reply #1 on: September 13, 2023, 02:31:55 pm »
« Last Edit: September 13, 2023, 02:35:53 pm by af0815 »
regards
Andreas

TRon

  • Hero Member
  • *****
  • Posts: 3176
Re: How to compile for spectrum?
« Reply #2 on: September 14, 2023, 06:35:05 am »
On the wiki is a large complicated Make file for linux.
Large and complicated ? Link please ?

You are required to make both the trunk compiler because that adds support for the target and then create the cross-compiler for your target.

I tried compiling the latest FPC from Git. Then I did 'fpd -it ' to see what available targets there are. But z80 or spectrum were not on there.
z80 and spectrum are two different things (cpu vs 'os').

Code: [Select]
$> fpc -Pz80 -it
Embedded
zxspectrum
MSXDOS
amstradcpc

and you can compile with:
Code: [Select]
fpc -Pz80 -Tzxspectrum helloworld.pas
« Last Edit: September 14, 2023, 06:40:29 am by TRon »
All software is open source (as long as you can read assembler)

Learner

  • Newbie
  • Posts: 2
Re: How to compile for spectrum?
« Reply #3 on: September 15, 2023, 02:59:53 pm »
ok for the latest version from GIT it says 'illegal processor' for Z80

so can someone just tell me how to get the 'trunk' version. As I am not a GIT expert.

here is the large and complicated Make file from the wiki:
https://wiki.freepascal.org/Z80#ZX_Spectrum

TRon

  • Hero Member
  • *****
  • Posts: 3176
Re: How to compile for spectrum?
« Reply #4 on: September 15, 2023, 04:09:03 pm »
ok for the latest version from GIT it says 'illegal processor' for Z80
Results as shown in my reply is based on git (when I posted, plusminus 10 minutes)

Quote
so can someone just tell me how to get the 'trunk' version. As I am not a GIT expert.
Do you have a working FPC 3.2.2 compiler that is able to compile from a terminal/command window ?


Quote
here is the large and complicated Make file from the wiki:
https://wiki.freepascal.org/Z80#ZX_Spectrum
That is not considered long and complicated but bare minimum that is necessary (you can omit the options that you don't use/need to save a few lines).

step 1: https://wiki.freepascal.org/Installing_the_Free_Pascal_Compiler#Downloading_FPC_sources_from_Git_or_zip
step 2: https://wiki.freepascal.org/Installing_the_Free_Pascal_Compiler#Compiling_the_FPC_source.2C_using_preinstalled_FPC

then follow the steps as in your link (minus the cloning as you already have done that in step 1). The rest of that article in your provided link is for creating the cross-compiler. Make sure to install to the same INSTALL_PREFIX directory as used in step 2

Before you can compile the cross compiler you need to make sure you have a working fpc.cfg file that is setup for the trunk compiler (so all paths should point to your INSTALL_PREFIX directory (or somewhere below that directory)).

If you want detailed instructions (do express that if wanted) and in case coming from me then you would have to wait a couple of hours for me to be able to get home.

Note that I do not know if the cross compiler is actually able to create a working executable for zx-spectrum and/or if other dependencies are required (zx-spectrum support /is/ experimental, so I have no idea).
All software is open source (as long as you can read assembler)

 

TinyPortal © 2005-2018