QLiberator decompiler

Anything QL Software or Programming Related.
Martin_Head
Super Gold Card
Posts: 530
Joined: Tue Dec 17, 2013 1:17 pm

QLiberator decompiler

Postby Martin_Head » Sat Nov 16, 2019 11:01 am

I have started this thread to carry on from this thread https://qlforum.co.uk/viewtopic.php?f=3&t=3019&start=10

I have got the decompiler to the point where I am starting to throw real programs at it. It's still got a few problems to sort out, but it seems to be mostly going.

I thought I would ask if there are any programs, That there is a real interest in seeing decompiled. If I am going to put the effort into trying to decompile something, It might as well be something that there is interest in.

At the moment I am trying to decompile Disk Mate 5, as someone inquired about it when I was working on the Turbo decompiler. But it's a bit of a beast. Almost 3000 lines of SuperBACSIC.


Derek_Stewart
QL Wafer Drive
Posts: 1899
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: QLiberator decompiler

Postby Derek_Stewart » Sat Nov 16, 2019 1:21 pm

Hi Martin,

I think that me that enquired about Diskmate 5.

I have been trying to re-write it from the useage.

I have extracted most of the Easypointer screen, but not got a working programme yet.


Regards,

Derek
User avatar
pjw
Super Gold Card
Posts: 690
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QLiberator decompiler

Postby pjw » Sat Nov 16, 2019 4:59 pm

Martin_Head wrote:I thought I would ask if there are any programs, That there is a real interest in seeing decompiled. If I am going to put the effort into trying to decompile something, It might as well be something that there is interest in.
The real biggie is Q-Liberator itself! Any chance of that?


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb
User avatar
RalfR
Gold Card
Posts: 444
Joined: Fri Jun 15, 2018 8:58 pm

Re: QLiberator decompiler

Postby RalfR » Sat Nov 16, 2019 8:59 pm

Perhaps you try to recompile sedit_63 Screen Eiditor from Dilwyns site, as I have lost the the source from a damaged HD. That would be useful, The ASM code included is here, if you need it,


Martin_Head
Super Gold Card
Posts: 530
Joined: Tue Dec 17, 2013 1:17 pm

Re: QLiberator decompiler

Postby Martin_Head » Mon Nov 18, 2019 10:02 am

Derek_Stewart wrote:Hi Martin,

I think that me that enquired about Diskmate 5.

I have been trying to re-write it from the useage.

I have extracted most of the Easypointer screen, but not got a working programme yet.

If you want I could upload the current decompilation. It's got some problems (especially SEL..ON) and would take a lot of work to get into something that would load and run.

I have started looking at the generated code to improve the decompilers output.

PJW wrote:The real biggie is Q-Liberator itself! Any chance of that?

I'm plucking up the courage for that. I would like to get the decompiler a bit more sorted out first.

Ralf R. wrote:Perhaps you try to recompile sedit_63 Screen Eiditor from Dilwyns site, as I have lost the the source from a damaged HD. That would be useful, The ASM code included is here, if you need it,

I will download it and have a look.

I may also try QL Menu Generator that was suggested in the previous thread.

I won't promise to do all suggestions, but it gives me some different programs to try.


User avatar
mk79
Super Gold Card
Posts: 642
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: QLiberator decompiler

Postby mk79 » Mon Nov 18, 2019 2:45 pm

First of all, great project! In how far did you analyze the runtime yet? I started putting it into my IDA Pro some months ago, but ran out of time.

Cheers, Marcel


Martin_Head
Super Gold Card
Posts: 530
Joined: Tue Dec 17, 2013 1:17 pm

Re: QLiberator decompiler

Postby Martin_Head » Tue Nov 19, 2019 11:01 am

mk79 wrote:First of all, great project! In how far did you analyze the runtime yet? I started putting it into my IDA Pro some months ago, but ran out of time.

Cheers, Marcel

Only a little. Most things I can work out by compiling test programs, then examining the results.

I have found the 'interpreter loop' that reads the encoded SuperBASIC program, and calls the appropriate subroutines from a table.

I have not got around to calculating all the offsets in the table to the actual subroutine locations. There are about two hundred of them.


User avatar
RalfR
Gold Card
Posts: 444
Joined: Fri Jun 15, 2018 8:58 pm

Re: QLiberator decompiler

Postby RalfR » Tue Nov 19, 2019 5:31 pm

Martin_Head wrote:I have found the 'interpreter loop' that reads the encoded SuperBASIC program, and calls the appropriate subroutines from a table

This seems to be quite similar to SMSQ/E (for my sense, can be wrong).


Martin_Head
Super Gold Card
Posts: 530
Joined: Tue Dec 17, 2013 1:17 pm

Re: QLiberator decompiler

Postby Martin_Head » Tue Dec 03, 2019 4:23 pm

Ralf R. wrote:Perhaps you try to recompile sedit_63 Screen Eiditor from Dilwyns site, as I have lost the the source from a damaged HD. That would be useful, The ASM code included is here, if you need it,
I have been working on this.

The decompiled program has quite a few GO TO's in it. Did the original have GO TO's ? I have attached a floppy disk image file of the current tidied up decompiled version, and the raw output from the decompiler.

This is NOT a finished working version, just something to play with. It will easily crash out to Basic. Some the procedure calls have picked up the wrong names for the Procedure definitions e.g. a call to ProcFun10891 should be ProcFun10890

Run the BOOT file in the image, This will add the SuperBASIC extensions that I have extracted from the compiled version. And load the decompiled sedit program.

You can then RUN it.

Note you will need a larger than normal screen, see the original text file on the image.

You can type, and use some of the menus OK.

I don't know if I will have time to debug it further before Christmas, So I thought I would post it now, even though it's barely working.
Attachments
sedit_img.zip
(95.4 KiB) Downloaded 45 times


User avatar
RalfR
Gold Card
Posts: 444
Joined: Fri Jun 15, 2018 8:58 pm

Re: QLiberator decompiler

Postby RalfR » Wed Dec 04, 2019 10:35 am

Hi Martin,

my code looks interesting :), thank you. I have a few GOTOs in my code but not so much as in the recompiled code and just within a few PROCs. Seems I had better compiled with VARs ON to get a proper nametable for recompiling.

Seems, you had to add a BP.INIT to my(!) inbuilt extensions, as there weren't any.

Thank you!



Who is online

Users browsing this forum: No registered users and 12 guests