Loading ZX Spectrum 48k BASIC program into NEXT BASIC

The Speccy's spritely young offspring. Discuss everything from FPGA to ZX
Post Reply
Martin Page
Drutt
Posts: 18
Joined: Mon Oct 31, 2022 11:04 am

Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by Martin Page »

For a start I'm only using a CSPECT emulator on my PC - in fact I've only just installed it and not really familiar with it yet. I'm hoping to get a proper NEXT or N-GO at some time in the future. My question is: is it possible to load a program written in 48k Spectrum BASIC into NEXT BASIC? The reason is I'd like to use a NEXT BASIC RUN AT command at a certain place in the program to speed up reading of DATA etc.

Also regarding the RUN AT command, do I understand from the manual that RUN AT (0 to 3) commands can be placed at various points of the program to slow down or speed up certain actions by the program?

Cheers, Martin.
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by flatduckrecords »

Martin Page wrote: Fri Feb 02, 2024 3:48 pm is it possible to load a program written in 48k Spectrum BASIC into NEXT BASIC
Yes, there are a few ways!

If you are working with a .tap file onto which your BASIC program has been saved, you can use the following:

Code: Select all

.tapein filename.tap
LOAD"t:"
MERGE""
The LOAD line tells NextZXOS to load from tape instead of drive C. You can then LOAD or MERGE from the virtual tape file.

If instead you are working with a BASIC listing in text format (i.e. typed-in, in plain text, on PC or Mac etc) you can convert that text file to a tokenised runnable BASIC file using:

Code: Select all

.txt2bas filename.txt
…which will output filename.bas that you can load from the Next browser.
Martin Page wrote: Fri Feb 02, 2024 3:48 pm Also regarding the RUN AT command, do I understand from the manual that RUN AT (0 to 3) commands can be placed at various points of the program to slow down or speed up certain actions by the program?
I assume so but maybe someone else can confirm that?
User avatar
Seven.FFF
Manic Miner
Posts: 744
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by Seven.FFF »

flatduckrecords wrote: Fri Feb 02, 2024 4:43 pm I assume so but maybe someone else can confirm that?
Yes, you can use RUN AT 0 to 3 as many times as you like, at any points in your program.

This goes for asm too, where you can do nextreg 7,0 to 3. The nextreg is also readable, and it is common for programs to read and save the current value, change it, then restore it later. In, for example, dot commands that might get run from BASIC at one speed, but inside the dot command you might still want to do everything at 28MHz.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
Martin Page
Drutt
Posts: 18
Joined: Mon Oct 31, 2022 11:04 am

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by Martin Page »

Many thanks for the replies from flatduckrecords and Seven.FFF.

Seven... that is great news as it will speed up my game Return to Long Shadows' - the game set up and map drawing at RUN AT 3 will stop folks from having to wait while the 48k BASIC plods through these parts of the program.

flatduck... I've typed in .tapein RETURNLS.TAP but I'm getting the error message: No such file or dir 0:1. It's probably that the RETURNLS.TAP file is in the wrong place. I've got it in two different file locations: in the C drive and also the CSPECT folder.

Cheers, Martin.
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by flatduckrecords »

Martin Page wrote: Sat Feb 03, 2024 11:46 am I've typed in .tapein RETURNLS.TAP but I'm getting the error message: No such file or dir 0:1. It's probably that the RETURNLS.TAP file is in the wrong place. I've got it in two different file locations: in the C drive and also the CSPECT folder.
If you have a copy of the file on the C drive*, you can navigate to the correct directory using .cd, for example:

Code: Select all

.cd /games/Classic48
You can also find the directory using the Browser, press BREAK and then go into Next BASIC.

To see a list of the files that BASIC can see in the current directory, use:

Code: Select all

.ls
or

Code: Select all

CAT
Hopefully RETURNLS.TAP will be listed and you'll now be able to use .tapein

* I'm not sure if CSpect has another way of importing files, but you can copy files to/from the virtual SD card using HDFMonkey.
Martin Page
Drutt
Posts: 18
Joined: Mon Oct 31, 2022 11:04 am

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by Martin Page »

Flatduck... I think we're talking at cross purposes here. Going through the processes that you mentioned, I can see that the NEXT has a directory structure like Windows, i.e. C drive, etc. My problem is that my TAP file is on my PC's C drive, not on the NEXT C drive. I'm guessing that the NEXT's game files, etc. may well be on the virtual SD card file, cspect-next-2gb. If I'm correct (may not be!), I have to somehow get my RETURNLS.TAP file on to there. I guess this is where HDFMonkey comes in to play. I've had a look at the website but not downloaded anything yet - I'm in the dark at the moment as to how to get my file onto the NEXT C drive. I'm guessing that if I had a real NEXT or clone, I'd just be copying my game file from my PC to the NEXT's SD card via the PC's SD card reader slot...

Incidentally, I created the RETURNLS.TAP file via my DivMMC Enjoy plugged into my Spectrum +3.

Cheers, Martin.
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by flatduckrecords »

Martin Page wrote: Sat Feb 03, 2024 1:17 pm If I'm correct (may not be!), I have to somehow get my RETURNLS.TAP file on to there. I guess this is where HDFMonkey comes in to play.
Exactly right! Something like this:

Code: Select all

 hdfmonkey put cspect-next-2gb.img RETERNLS.TAP
Martin Page wrote: Sat Feb 03, 2024 1:17 pmIncidentally, I created the RETURNLS.TAP file via my DivMMC Enjoy plugged into my Spectrum +3.
You can also use .tapein on esxDOS, if you wanted to! It works similarly. (No need for LOAD “t:” though since Plus3DOS isn’t active).
Martin Page
Drutt
Posts: 18
Joined: Mon Oct 31, 2022 11:04 am

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by Martin Page »

Thank you but I'm at a loss as to where I'm supposed to input this line of code. I've had a look at HDMonkey and also signed up and got a GitHub desktop. I've even started a 'repository' (if indeed that was the right thing to do) and loaded RETURNLS.TAP in there. I was unable to load in the virtual SD card because the file size was (way) over 25mb! As I said, I'm probably in the wrong place altogether. I'm sure I'm so near but so far... :cry:

Regards, Martin.
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Loading ZX Spectrum 48k BASIC program into NEXT BASIC

Post by flatduckrecords »

Ah, I think what you’ve downloaded is the HDFMonky source code, not the compiled application. You can download a Windows executable from https://uto.speccy.org/ Scroll down to the heading “Other Stuff”.

(You won’t need the repository and/or GitHub Desktop unless you want to compile the program yourself).

The line of code I gave above is meant for the command line, if you’re not familiar with that then do be very careful! (And certainly don’t type in anything someone on the Internet tells you to!)

This may be the trickiest aspect of using CSpect. If you search the forum you see a few threads discussing HDFMonkey.

There is also “HDFMGooey”. I can’t find a working link to it but tracking that down could be a better choice.
Post Reply