MBASIC decompiler? - CP/M

This is a discussion on MBASIC decompiler? - CP/M ; Just curious, did/does such a thing exist?
I've got a CP/M .COM file which I believe is BASCOM generated --
running 'strings' over it reveals the line "ALREADY MODIFIED MBASIC
5.21 INTERPRETER" and the initial output when you run it ...

MBASIC decompiler?

Just curious, did/does such a thing exist?

I've got a CP/M .COM file which I believe is BASCOM generated --
running 'strings' over it reveals the line "ALREADY MODIFIED MBASIC
5.21 INTERPRETER" and the initial output when you run it includes what
appears to be the original BASIC source file name and the string
"COMPILED VERSION".

Is there a tool to recover a reasonable facsimile of the original
BASIC source?

Thanks.

Re: MBASIC decompiler?

d_cymbal wrote:
> Just curious, did/does such a thing exist?
>
> I've got a CP/M .COM file which I believe is BASCOM generated --
> running 'strings' over it reveals the line "ALREADY MODIFIED MBASIC
> 5.21 INTERPRETER" and the initial output when you run it includes what
> appears to be the original BASIC source file name and the string
> "COMPILED VERSION".
>
> Is there a tool to recover a reasonable facsimile of the original
> BASIC source?

I guess no. If the result of the compilation was a kind of "p-code",
then it might be more possible, but I guess it's a real hard work to get
a usable BASIC sourcecode back if machine code is generated.

Re: MBASIC decompiler?

On Jan 8, 3:52 pm, "Peter Dassow (remove the NOSPAM. for direct
answer)" wrote:
> d_cymbal wrote:
> > Just curious, did/does such a thing exist?
>
> > I've got a CP/M .COM file which I believe is BASCOM generated --
> > running 'strings' over it reveals the line "ALREADY MODIFIED MBASIC
> > 5.21 INTERPRETER" and the initial output when you run it includes what
> > appears to be the original BASIC source file name and the string
> > "COMPILED VERSION".
>
> > Is there a tool to recover a reasonable facsimile of the original
> > BASIC source?
>
> I guess no. If the result of the compilation was a kind of "p-code",
> then it might be more possible, but I guess it's a real hard work to get
> a usable BASIC sourcecode back if machine code is generated.
>
> --
> * Tryhttp://www.z80.eufor CP/M computer and software infos.

Hi
I believe it is just pcode type stuff. I've written simple
decompilers
in the past for similar compiled BASICs. Typically the line numbers
are
in binary. One can run a few experiments, creating compiled code
with known operations. One then analyses the result and matches
the codes generated to the source.
One can then write a simple decompiler that just does a large case
statement or table lookup. It sounds like a lot of work but it isn't
too hard.
Dwight

Re: MBASIC decompiler?

From what I can tell, BASCOM actually compiles the target to Z80
code. I thought perhaps that BRUN.COM acted as a p-code vm but this
does not seem to be the case? I see the generated BASIC COM open
BRUN.COM and read it, perhaps it acts more along the line of a library
that provides the runtime environment in this case?

On Jan 9, 1:23 pm, "dkel...@hotmail.com" wrote:
> Hi
> I believe it is just pcode type stuff. I've written simple
> decompilers
> in the past for similar compiled BASICs. Typically the line numbers
> are
> in binary. One can run a few experiments, creating compiled code
> with known operations. One then analyses the result and matches
> the codes generated to the source.
> One can then write a simple decompiler that just does a large case
> statement or table lookup. It sounds like a lot of work but it isn't
> too hard.
> Dwight

Re: MBASIC decompiler?

d_cymbal wrote: ** and top-posted. Fixed this one **
> "dkel...@hotmail.com" wrote:
>
>> I believe it is just pcode type stuff. I've written simple
>> decompilers in the past for similar compiled BASICs. Typically
>> the line numbers are in binary. One can run a few experiments,
>> creating compiled code with known operations. One then analyses
>> the result and matches the codes generated to the source. One
>> can then write a simple decompiler that just does a large case
>> statement or table lookup. It sounds like a lot of work but it
>> isn't too hard.
>
> From what I can tell, BASCOM actually compiles the target to Z80
> code. I thought perhaps that BRUN.COM acted as a p-code vm but
> this does not seem to be the case? I see the generated BASIC
> COM open BRUN.COM and read it, perhaps it acts more along the
> line of a library that provides the runtime environment in this
> case?

Please do not top-post. Your answer belongs after (or intermixed
with) the quoted material to which you reply, after snipping all
irrelevant material. I fixed this one. See the following links: