SQMSQmulator and zip files

Helpful tips and guides, also new users can ask for help here.
Post Reply
dlsa
ROM Dongle
Posts: 10
Joined: Thu Nov 03, 2022 7:26 pm

SQMSQmulator and zip files

Post by dlsa »

Hello,

I downloaded SMSQmulator to my mac, and am able to run it and map directories as NFA drives.
I then proceeded to download the unzip532_bas from dylwin's site. Also downloaded a zip of a game (198-adventure.zip) as a test zip.
I did

Code: Select all

lrun nfa1_unzip532_bas
and following the instructions wrote the executable to

Code: Select all

nfa3_unzip532
.
I then do

Code: Select all

exec nfa3_unzip532,nfa1_198-adventure_zip
and get as a response "invalid parameter"

I really don't know how to use unzip in this platform. Is there any documentation on it, that could help ?


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: SQMSQmulator and zip files

Post by dilwyn »

Use SFA or WIN drives instead. NFA is Native File Access (host OS) - it doesn't understand QL executable file headers (just like unzipping direct to a Windows format drive) and just loses them. Hence the bad parameter error. See section 4 and 5 of SMSQmulator manual.


User avatar
pjw
QL Wafer Drive
Posts: 1316
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: SQMSQmulator and zip files

Post by pjw »

Apart from the explanations above you need to use the correct separator for the command line parameter, which is a semicolon. Furthermore, the command line needs to be wrapped in quotes. Thus the correct invocation would be:

Code: Select all

exec sfa3_unzip532; "nfa1_198-adventure_zip"
Rather a lot of caveats, I know, but the complexities are not there for frivolous reasons.


Per
dont be happy. worry
- ?
dlsa
ROM Dongle
Posts: 10
Joined: Thu Nov 03, 2022 7:26 pm

Re: SQMSQmulator and zip files

Post by dlsa »

If I use SFA drives, how do I transfer files between the Host OS and the emulator ?


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: SQMSQmulator and zip files

Post by dilwyn »

OK: Try again. The Forum times out while typing a very long reply so I lost the first attempt on pressing SUBMIT and the draft doesn't seem to be there. Luckily I've had this experience before and copied and pasted the text into an editor just in case it happens with the new Forum software and it did. :(

Oh boy, the issues of zip/unzip, loss of headers and native format drives keeps getting answered and the same old questions keep on getting asked over and over. File Transfer is without doubt the single hardest issue facing someone new to QL, so it is well worth the struggle to master early on, it will stand you in good stead later. After a while it becomes instinct and you are able to do it without thinking almost (well, unless your name is Dilwyn, when all you need is a new brain occasionally).

First of all, learn the differences between the type of QL drives, which will help you understand what's going on.

Native format drives do not understand QL executable headers at all and simply lose them. Do not try to unzip QL executable files on these at all, doomed to failure from the word go unless you know how to repair QL executables.

SFA is a type of native drive where the program files are modified to hold the executable files headers as part of a modified file, usually by making the file bigger to hold a copy of the header, but it depends on the emulator (QLay and QL2K do this in a completely different way, for example). This creates its own problems, in that if you later want to copy of move files to QDOS format medias, this extra information has to be removed, although if done within the emulator, the emulator will usually try to sort it out invisibly to you.

The third type is QXL.WIN, a type of container file, where a "QDOS" file environment (a single large Windows file on a PC for example) is maintained to allow the executables to be free of the constraints of native host format media.

By understanding where QL executable file headers cannot be handled, you will be halfway to understanding how to work around this. Executable files, put simply, are QL programs which are started with EXEC, EXEC_W or equivalent commands in Toolkit 2 and SMSQ based emulators. This does not apply to data files such as documents and spreadsheets and QL BASIC programs (which are plain text files to all intents and purposes and do not have an executable header to lose!). Trying to EXEC a program which has been in a native host media format goes into bad parameter condition as you've seen, header lost. QDOS and SMSQ just do not have a meaningful error code for when this happens, so it uses the closest, "bad parameter" or "invalid parameter".

Understanding this, what you have to do is move the zipped file into a "QL" environment and do the unzipping there so that the file headers are preserved.

If you do not already have an Unzip program in the SFA or QXL.WIN environments, you are faced with what looks like a catch-22 situation whereby you cannot get Unzip into that environment because it is itself an executable program.

There are two ways around this.
(1) Use Jonathan Hudson 's Unzip SFX (Self Extracter to create an Unzip in a "QL" format drive so working around the problem).
(2) Use my Unzip_bas created with my Job2Bas utility. What this has done is convert UNZIP to a BASIC program (which is not affected by the loss of headers issue by being downloaded to a native format drive and transferred to QL.

Both are described on the Unzip part of the PC-QL Transfer page on my website - http://www.dilwyn.me.uk/gen/pcqlxfer/index.html . This page does not explicitly deal with SMSQmulator's NFA and SFS drives, but the same principles apply.

So, if you are downloading zipped files from the web, have both a NFA plus an SFA or QXL.WIN drive set up. Put the downloaded zip file into an NFA drive and COPY to the SFA (or a QXL.WIN) drive and do the unzipping part there, or do the Unzip build from SFX or Unzip_bas there to prevent loss of execuatble file headers. Note the SMSQmulator manual warnings about mixing files and separator characters on some drives (I don't have a copy of SMSQmulator installed here to be able to provide step by step guides on doing all this, sorry).

Note one thing - the Unzip SFX is a rather old program. It doesn't always work on all modern systems. Using the Unzip_bas created by Job2Bas works on all systems (well, as long as there is enough free memory) AFAIK.

If you haven't already got yourself Unzip, Unzip_bas, or the SFX, get them from http://www.dilwyn.me.uk/arch/index.html - the Unzip_bas is under Job2Bas on the page. If possible, I'd use v5.32 or later of Unzip. Some versions need something called Environment Variables (a set of extensions usually called ENV_BIN or similar), but they will work without these, possibly giving an error message triggered by the absence which can be ignored.

You can do the same with the Unzip SFX or the Unzip_bas programs. Both will safely survive being on an NFA drive while being moved to a "QL" environment so that you can rebuild to QL executable once safely inside a "QL" environment.

The file transfer page I mentioned above goes on to explain simple use of the Unzip program once available in your "QL" environment. As Per pointed out, the commands have to be type out EXACTLY right - a space in the wrong place, or mixing up commas and semi-colons, for example, can make it not work.

Hope this helps.


Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: SQMSQmulator and zip files

Post by Derek_Stewart »

dlsa wrote: Thu Nov 24, 2022 9:48 am If I use SFA drives, how do I transfer files between the Host OS and the emulator ?
You can define the SFA device in the SMSQmulator Devices menu.

This can map SFAx device to a native directory in the Linux or Windows file system

Just copy the required file to that directory and SMSQmulator will add or remove QDOS file headers with the SFA device, transparently.

Read the SMSQmulator mznual for more details.


Regards,

Derek
dlsa
ROM Dongle
Posts: 10
Joined: Thu Nov 03, 2022 7:26 pm

Re: SQMSQmulator and zip files

Post by dlsa »

I managed to run the unzip532_bas and turn it into an executable in a SFA drive.
Then to make a test, I got the 198-adventure_zip and tried to unzip it with the command :

Code: Select all

exec sfa1_unzip532; sfa1_adv_zip
The adv_zip is the renamed 198-adventure_zip when I copied it from a NFA drive to a SFA drive.
The command produced messages in a window :
Image
After I said yes to replacing, it gave another error now of disk full.
What may be the problem ? The software is unsuitable for the configuration under which the emulator is running ?

Thanks,
Regards


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: SQMSQmulator and zip files

Post by dilwyn »

At this point, we call for the help of Vanpeebles - 198adventure is his game!

Basically, I think path names are too long for a "QL" system, where the limit on length of directory+filename is usually 36 characters (or 41 if you include the 5 character drive name as well). Unzip tries to truncate the long names, but as you've seen this can sometimes cause problems. I have a feeling it might have been zipped on a QemuLator system.

Don't know enough about this game to be able to help in this case I'm afraid (even though he's put my name in the boot file!)

Looking at the zip file on my site, it seems to have a floppy disc image as part of the zip file. I don't know if SMSQmulator can handle .IMG image files - if it can, using the floppy disc image file may be possible without needing to bother with this zip.

What I have tried to do, and I can't guarantee it'll work as I don't have SMSQmulator installed, is to make a "regular" zip file of the game on my QPC2 for you to try, attached here.

As it seems to have screen image files, you may find it only works in 512x256 QL colour modes (i.e. screen/system variables at fixed QL addresses) - again, I can't be sure as I haven't read the extensive manuals. Speaking of which, the documentation seems to be PDF, JPG etc, so you may be able to unzip that part on the host machine and read it without having to transfer that part to the emulator.

I think this is about as far as I can go with this game due to lack of familiarity with it, sorry.
Attachments
198ad.zip
(54.38 KiB) Downloaded 128 times


User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: SQMSQmulator and zip files

Post by tofro »

A typical reason for this problem is when you try to extract a file into a directory that already has a sufficiently long name - In contrary to other systems that restrict file name length for file names only, QDOS actually has a historical restriction on path names (i.e. the overall path name counts into the acceptable path name length of 41 characters.

Extract your zip file into a directory with less characters in the name (or, in the root directory of your drive), and you should be fine.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Post Reply