SuperCharge Decompiler

Anything QL Software or Programming Related.
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

SuperCharge Decompiler

Post by Martin_Head »

This is a walk through on how to use my SuperCharge decompiler.

This is not a full release of the Decompiler, as it is still a work in progress, and it doesn't know how to handle all commands.

This worked, walk through shows you the steps involved in generating a BASIC program from a SuperCharged executable.

Before unzipping the sample file, rename it sample_zip, and unzip in QDOS to retain the executable file header
Attachments
Documents.zip
Libre office and PDF documents
(719.99 KiB) Downloaded 211 times
sample.zip
Rename to sample_zip and unzip in QDOS
(148.67 KiB) Downloaded 215 times


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Post by Martin_Head »

Something went a bit wrong with the first upload. The DisCharge_bas program got corrupted.

Here is another go...

This is a slightly updated version of DisCharge_bas that now knows about, code array indexs

53, == (string)
183, colour stipples (triple)

plus a few other bug fixes

As before rename and unzip in QDOS
Attachments
sample2.zip
Unzip in QDOS
(152.94 KiB) Downloaded 191 times


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: SuperCharge Decompiler

Post by NormanDunbar »

Hi Martin,

this is a very interesting project. Unfortunately, as far as I know, I don't have any Supercharged programs to try it out on, after the demo, even though I purchased Supercharge many years ago.

Sadly my floppy collection, built up over many years, died, or was found to be dead, a little while back. None of my originals or backups would spin in the drive. :(

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Post by Martin_Head »

Rich Mellor suggested a few programs for me to try. Mostly still commercial, but Nucleon Programmers Assistant by Pyramide, and Concept 3D graphics drawing. Are available from Dilwyn Jones web site, if you fancy having a go.

So far, apart from the original Tridim, I have been using 3D Slime, and Type22 to teach the decompiler. While 3D Slime produces a BASIC program that mostly looks good, it has one or two oddities. And Type22 is just about to produce it's first full decompile.


RWAP
RWAP Master
Posts: 2834
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: SuperCharge Decompiler

Post by RWAP »

It might be silly - but how about trying to decompile SuperCharge itself? I believe it self-compiled originally.....

There is also a selection of programs on the Sinclair QL Homepage:
CadQL.zip on http://www.dilwyn.me.uk/graphics/index.html
Caxton on http://www.dilwyn.me.uk/label/index.html

Probably several others too...
These have the benefit of including the original BASIC source, so can be useful to compare the output with the original


RWAP
RWAP Master
Posts: 2834
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: SuperCharge Decompiler

Post by RWAP »

There is also the loading program for PAWN (cracked version) :D


QLObi
ROM Dongle
Posts: 46
Joined: Wed Mar 20, 2013 9:15 pm
Location: Germany Köln

Re: SuperCharge Decompiler

Post by QLObi »

Good work !
I like to test for OMEGA. This game contains a bug, so i like to find that.
More intréssting is a decompiler for Qliberated files. is there anything around ?

Detlef


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: SuperCharge Decompiler

Post by Martin_Head »

While working on the decompiler, I have noticed that SuperCharge seems to treat '==' (almost equals) for integers and floats the same as '='. '==' for strings is not a problem.

Is '=' and '==' for integers and floats any different in SuperBASIC? I can't see the point of '==' for numbers, either they are the same, or they are not.

So would it be safe to convert what was a '==' into a '=' for numbers.


RWAP
RWAP Master
Posts: 2834
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: SuperCharge Decompiler

Post by RWAP »

I thought there was a slight difference when you got to tiny differences between numbers (eg 0==0.0000000001) but I can't prove it in q-emulator....


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: SuperCharge Decompiler

Post by NormanDunbar »

From Jan Jones:

The equivalence (= =) or ‘almost equal’ operator has a greater tolerance. Here X = = Y will be true if | X-Y | < = | Y* 1E-7 | where | X-Y | means the absolute, or positive, value of X-Y.

Note : it may not be immediately obvious that no value will ever be = = zero. If in the above equation, Y is zero, the check reduces to | x | < = 0, clearly impossible when x is a non-zero number. If you make X zero instead of Y, the test becomes | Y | < = | Y* 1E-7 |, which is also somewhat infeasible. To test for a quantity being very close to zero, add 1 to both sides eg, (X + 1) = = 1.

HTH

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply