decompilation

ZXNet echo conference «code.zx»

From Sergey Bilibin To All 5 February 2007

Hello, All Once upon a time, about 8 - 9 years ago, I wrote all kinds of programs and toys for yourself. I wrote them in BASIC using the Art Studio graphic editor and the Tobos compiler F.P. I recently copied all this stuff from tapes and would like to dig deeper into their works. in general the question is: Is it possible to somehow convert a program from machine code back to BASIC? if so, how? As an example, I’m posting a couple of my works :) File: game.rar http://zx.pk.ru/attachment.php?attachmentid=4547

From deathsoft To All 5 February 2007

Hello ZEman ZEm> is it possible to somehow convert the program from the machine code back to ZEm> BASIC? If there are no source BASIC files (from which Tobos FP obtained the machine code), then no way, but if they are in the images of the cassettes, then see the point below.

From deathsoft To All 5 February 2007

Hello ZEman Download this program (ZX-Blockeditor) http://home.arcor.de/clausjahn/spectrum/. Then rip out all the files from BASIC and code in the form of separate files, then they can be put into .trd/.scl

From Dmitry Malychev To All 6 February 2007

Hello Cyrax Inc. cyr> there is an expression: you can’t restore meat from cutlets and you can’t turn minced meat cyr> back... I messed it up a bit. :) This is a parody song about Scarecrow.

From Alexey Mikheev To All 6 February 2007

Hello ZEman ZEm> there are no source BASIC files, I deleted them a long time ago.. ZEm> so that means it’s impossible? ZEm> after all, the compiler converts from BASIC to machine code, why not ZEm> do the process in reverse? how the compiler translated the original BASIC program into machine code for the authors alone Tobos is known. There is an expression: you can’t restore meat from cutlets and you can’t mince turn back...

From Sergey Bilibin To All 6 February 2007

Hello deathsoft There are no original BASIC files, I deleted them a long time ago.. So that means it’s impossible? After all, the compiler converts from BASIC to machine code, why can’t it be done is the process in reverse?

From deathsoft To All 6 February 2007

Hello, goodboy goo> if it translated, why then do you need Tobos itself in memory for work goo> programs ? Most likely, procedures are used not from ROM, but from Tobos itself, the same thing concerns, for example, MegaBasic. It is possible that Tobos works like older versions of VisualBasic (before 5.0) on PC (compiles into byte code), and Tobos is required to execute this bytecode (essentially a virtual machine).

From goodboy To All 6 February 2007

Hello ZEman ZEm> after all, the compiler converts from BASIC to machine code it doesn’t translate anything into machine code, BASIC operators are translated into a tricky format which is transferred faster to ROM procedures, that’s all If I were translating, why then do I need Tobos itself in memory for the program to work?

From Stanislav Lomakin To All 6 February 2007

Hello, goodboy goo> it does not translate anything into machine code, BASIC operators are translated into goo> a tricky format that is transferred faster to ROM procedures, only goo> total goo> goo> if it translated, why then do you need Tobos itself in memory for work goo> programs ? That's how it is. but what kind of format is this, and how difficult is it to recover from it? basic, there is a big natural mystery :rolleyes; Although; in theory quite solvable

From deathsoft To All 7 February 2007

Hello, EARL Visual Basic 3 and 4 were completely decompiled, languages were also decompiled type Clipper (under DOS). Moreover, there were very good decompilers who restored the full source code.

From Dmitry Limonov To All 7 February 2007

Hello deathsoft dea> Most likely, procedures are used not from ROM, but from Tobos itself, dea> the same applies, for example, to MegaBasic. dea> dea> It is possible that Tobos works like older versions of VisualBasic (before dea> 5.0) on PC (compiles into byte code), and Tobos is required for dea> execution of this bytecode (essentially a virtual machine). Yes, it looks a lot like that. I somehow figured out this compiler when I wanted decompile the Tank war game to rewrite it a little and noticed that there indeed, all commands are represented as 16-bit handler addresses basek teams. Some of these commands are in the BASIC ROM, and some are rewritten and is located in the compiler itself. I don’t remember exactly now, but there is such an idea, that you can even restore variable names, which the compiler carefully saves at the beginning of the resulting code. Even designs like: ┌─- CODE ─── GOTO label └── CODE ─── where label is a variable that can be restored, because when the compiler encounters such a GOTO, then it saves all string norms in the form of addresses bytecodes of the resulting program, i.e. a special table is created for which you can restore even how many and what operators were in the line. :cool: