Taking things a little step further, here's a short SuperBASIC program to remove the native file format header from QemuLator files (and probably other emulator native files which use this format, but that's untested).
Appendix II of the QemuLator manual says that executable programs saved on a Windows native file format hard disk puts a preamble of 30 or 44 bytes at the start of the file, to hold the QDOS file header parts that Windows cannot store.
No idea if this applies to Mac versions of QemuLator sorry - never used it.
A preamble of 30 bytes indicates a standard QL executable program (i.e. something you can start with EXEC or similar commands). A preamble of 44 byte length indicates that this is an executable program, but with microdrive sector information (e.g. for protected MDV programs). My program does not try to handle this.
The reason I wrote this was that people keep sending me zipped programs which were zipped in Windows from the QemuLator directories direct using something like WinZip or 7-zip, rather than copying them to QDOS media such as floppy discs in the emulator first to automatically strip away these headers before zipping on QL. What happens when people then try to execute them is that they give the dreaded "bad parameter" error when they try to EXEC it, which is a dead giveaway for "no executable file header".
You can usually tell by viewing the file - it will have something like "]!QDOS File Header" (without the quotes) right at the beginning. Note that QPC2 versions 5 and later are special in this respect. They understand QemuLator file headers and all this is often unnecessary if QPC2 copies them to QDOS format media such as floppy discs, when it might remove the header by itself. But if I didn't spot this when the software was sent to me for my website (and QPC2 v5 and later which I use tends to hide it from us) the program goes on the website and is unusable by any system other than ones which understand QemuLator headered files.
If you have a QemuLator format executable and run it through this program, it'll turn it back into a QL format executable.
My program deqemu_bas needs Toolkit 2 - ALCHP, RECHP, FLEN, FTYP and REPORT. If the REPORT command causes problems on an early QDOS ROM version (I suspect it might on version AH or JM), replace it with something like PRINT"Oops, error occurred."
This is no different to other programs that do this, just that it's written in BASIC so that you can see how it works and adapt to your own needs (or fix any bugs I left in it, apologies if I did!).
Code: Select all
100 REMark DeQemu_bas (Remove QemuLator native header)
110 CLS : CLS #0
120 REPeat program
130 PRINT \'DE-QEMULATE EXECUTABLE FILE'
140 INPUT 'Filename QemuLator native program'\'> ';ip$
150 IF ip$ = ''THEN EXIT program
160 :
170 fl = FLEN(\ip$) : REMark file length
180 IF fl < 30 THEN
190 PRINT'Not loaded - unsuitable file.'
200 PAUSE 100 : NEXT program
210 END IF
220 :
230 base = ALCHP(fl)
240 IF base < 0 THEN
250 REPORT #1,base
260 PAUSE 100 : NEXT program
270 END IF
280 LBYTES ip$,base
290 :
300 qemu$ = ''
310 FOR a=base TO base+17:qemu$=qemu$&CHR$(PEEK(a))
320 IF NOT (qemu$ = ']!QDOS File Header') THEN
330 PRINT'Not a QemuLator native file.'
340 RECHP base : PAUSE 100 : NEXT program
350 END IF
360 :
370 IF PEEK(base+21) <> 1 THEN
380 PRINT'Not an executable file.'
390 RECHP base : PAUSE 100 : NEXT program
400 END IF
410 :
420 IF PEEK(base+19) = 44 THEN
430 PRINT 'Program contains microdrive sector header.'
440 PRINT 'Unsuitable for conversion without loss of this data.'
450 RECHP base : PAUSE 100 : NEXT program
460 END IF
470 :
480 INPUT 'Save as filename > ';op$
490 IF op$ = '' THEN RECHP base : NEXT program
500 :
510 dspace = PEEK_L(base+22) : REMark get dataspace
520 PRINT'Program length=';fl-30;' Dataspace=';dspace
530 SEXEC op$,base+30,fl-30,dspace
540 PRINT op$!"saved."
550 RECHP base
560 END REPeat program
570 PRINT'Program finished.'