Self booting disk for plus 3 with loader

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
DarwinNE
Drutt
Posts: 47
Joined: Sun Mar 01, 2020 4:34 pm
Location: Grenoble - France
Contact:

Self booting disk for plus 3 with loader

Post by DarwinNE »

Dear all,
I have recently published a text adventure game for the ZX Spectrum 48K called The Queen's Footsteps: https://spectrumcomputing.co.uk/entry/3 ... _Footsteps

The game is in three parts and can be loaded from a tap file or audio from a cassette.
Someone requested a version for the Plus 3 in a floppy disk. I thought it was a nice idea.

I use the z88dk compiler as my game is written in C. There is a wonderful option of the compiler that allows to create a bootable disk, showing a loading screen:

https://github.com/z88dk/z88dk/wiki/Pla ... ble-3-disc

That works perfectly with my program, apart the detail that I have to choose between three executables, so I need to write a loader that allows to choose which part of the game one wants to play. With the Amstrad CPC 6128 I did this with a BASIC program that shows a picture and loads the chosen file, I was thinking to do something similar for the Spectrum, but I only have a classic 48K machine and I never used (or seen in person) a +3.

Do you think that would be a reasonable approach? Where would you suggest to start reading documentation for writing such a loader?

Cheers,
D.
User avatar
TomD
Manic Miner
Posts: 413
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Self booting disk for plus 3 with loader

Post by TomD »

As for the CPC you just need a simple basic program, all you need to do is name it DISK and it will autorun when you press Loader on the main menu.

The following is a simple loader, just adapt it so you can load each part:

Code: Select all

10 CLEAR xxxx
20 LOAD "screen" SCREEN$
30 LOAD "code" CODE
40 PAUSE 100
50 RANDOMIZE USR xxxx
Insert a blank disk and in +3 basic save this as

Code: Select all

SAVE "DISK" LINE 10
and it will autorun.

The PAUSE 100 at the end is to ensure the drive motor has stopped before the game is launched

There is also a ton of info in the ZX Spectrum +3 manual which you can find here https://spectrumcomputing.co.uk/index.p ... id=2000448 this also covers machine code loaders using the ROM.

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
DarwinNE
Drutt
Posts: 47
Joined: Sun Mar 01, 2020 4:34 pm
Location: Grenoble - France
Contact:

Re: Self booting disk for plus 3 with loader

Post by DarwinNE »

Thank you very much! That's exactly what I was looking for.
DarwinNE
Drutt
Posts: 47
Joined: Sun Mar 01, 2020 4:34 pm
Location: Grenoble - France
Contact:

Re: Self booting disk for plus 3 with loader

Post by DarwinNE »

Well, things do not seem to go as smoothly as expected. I still have some maybe trivial questions...

I suspect the culprit is the disk image tool I am using, i.e. iDSK that I successfully used for the Amstrad. I can extract working files from a disk image, but if I put them again in another disk image, the basic loader can not load them correctly anymore:

Image

Is there a Spectrum +3 reliable disk management tool that can be compiled and run from the command line on an Unix system?

By the way, is there a way on the Spectrum side to know which kind of files is each one listed by the CAT command? (i.e. basic, code, screen, ...)
+3code

Re: Self booting disk for plus 3 with loader

Post by +3code »

DarwinNE wrote: Sun Jul 19, 2020 11:12 pm By the way, is there a way on the Spectrum side to know which kind of files is each one listed by the CAT command? (i.e. basic, code, screen, ...)
Look "Catalogo ampliado": https://proyectobasiczx.wordpress.com/r ... 80/mh-170/

Or that other:
https://spectrumcomputing.co.uk/entry/2 ... trum/CatDB
DarwinNE
Drutt
Posts: 47
Joined: Sun Mar 01, 2020 4:34 pm
Location: Grenoble - France
Contact:

Re: Self booting disk for plus 3 with loader

Post by DarwinNE »

Thank you +3code, Catalogo Ampliado worked very well. The issue is clear:

Image

QUEENS1.BIN and ZXQUEENS.BIN should be identical. It seems that when I wrote QUEENS1.BIN on the disk image, the attribute "code" was lost. Is there a way to set it correctly, preferably with iDSK or even on the Spectrum side? A hint about where I can find information about it in the documentation may be enough, I have the sources of iDSK and I can try to patch it to fit to my needs, after all...

EDIT: Oh yes, looking at the disk image, I think I see what happens! iDSK adds a wrong header! Now, to solve the issue, I just have to configure iDSK so that no header is added (it should be feasible).
DarwinNE
Drutt
Posts: 47
Joined: Sun Mar 01, 2020 4:34 pm
Location: Grenoble - France
Contact:

Re: Self booting disk for plus 3 with loader

Post by DarwinNE »

I was able to solve the issue, patching iDSK so that it does not include the AMSDOS header. Thank you to everybody for the very useful help!

The result can be downloaded here: http://davbucci.chez-alice.fr/index.php ... ge=English

(it's the ZX Spectrum +3 version)

It seems that the load/save code still does not work, I am trying to see if there is a limitation associated to the z88dk compiler or if I overlooked something.
User avatar
TomD
Manic Miner
Posts: 413
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: Self booting disk for plus 3 with loader

Post by TomD »

DarwinNE wrote: Mon Jul 20, 2020 9:56 am I was able to solve the issue, patching iDSK so that it does not include the AMSDOS header. Thank you to everybody for the very useful help!

The result can be downloaded here: http://davbucci.chez-alice.fr/index.php ... ge=English

(it's the ZX Spectrum +3 version)

It seems that the load/save code still does not work, I am trying to see if there is a limitation associated to the z88dk compiler or if I overlooked something.
Just one small change, you do need to add a pause before the randomize usr statement otherwise the drive motor just keeps running.

TomDD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
DarwinNE
Drutt
Posts: 47
Joined: Sun Mar 01, 2020 4:34 pm
Location: Grenoble - France
Contact:

Re: Self booting disk for plus 3 with loader

Post by DarwinNE »

TomD wrote: Mon Jul 20, 2020 1:00 pmJust one small change, you do need to add a pause before the randomize usr statement otherwise the drive motor just keeps running.
Thank you! I forgot that detail, it should be corrected, now.
DarwinNE
Drutt
Posts: 47
Joined: Sun Mar 01, 2020 4:34 pm
Location: Grenoble - France
Contact:

Re: Self booting disk for plus 3 with loader

Post by DarwinNE »

DarwinNE wrote: Mon Jul 20, 2020 9:56 amIt seems that the load/save code still does not work, I am trying to see if there is a limitation associated to the z88dk compiler or if I overlooked something.
It turned out that I was using wrong compile options. Now the +3 version can load and save on the disk 8-)
Post Reply