> On 25 Jun 2015, at 12:21, Wolfgang Lenerz <w...@wlenerz.com> wrote:
> 
> Hi,
>> 
>> I have in the past tried at disassemble Qlib and Turbo complied
>> programmes, but quite hard when they are not written in an assembler.
> 
> Yup! I very dimly remember that there even was (one or several?)
> program(s) that used compiled basic progs as part of the copy protection.
> 
>> Could Turbo compiled code be de-compiled and the resultant object code
>> be then run through a Turbo re-translator to reconstruct the SuperBasic
>> source code, as source code to Turbo is available and we know how the
>> Turbo libraries work (maybe)?
> 
> Probably George Gwilt is best suited to answer that.

Hmm! I seem to have forgotten most of what I knew.

> 
> I believe, though, that it won't be a trivial task.
> 
> In many cases I assume that the compiler uses some kind of template
> (i.e. for this instruction, use that code) and, when detecting these
> templates, you could reconstruct the source code for them.
> OTOH, think of all the possible ways of using PRINT…..

Parser_task analyses the SuperBASIC program and produces a list of calls to 
blocks of code, or templates, which do simple things like "print a comma" or 
"go to this procedure".

Codegen_task reads this intermediate code and produces the final executable 
program. By analysing the threaded code inside this it might be possible to 
reconstruct something like the intermediate code which was the output from 
Parser_task.

The next step would be to work back from that to a set of SuperBASIC 
instructions.

> 
> What about using external keywords bound into the program?

Either the keyword has to be present at runtime or its code has to have been 
loaded into the compiled program. In either case there may be difficulty in 
pinpointing what the keyword is so that it can form part of the decompiled 
program.

> 
>> This maybe good of great benefit to development programme to created
>> which could yield the source code of older programmes that do not run on
>> modern systems.
>> 
> 
> This presumes that the code generating engines stayed the same during
> the different versions of the compilers - is this a safe assumption to make?

The version of the Turbo Library used should be recorded in the compiled 
program.


> 
>> How would this affect copyrighted compiled programmes?
> 
> Good question. Generally speaking that kind of reverse engineering could
> get yuo into trouble.
> 
> 

George

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to