On 26.11.18 21:59, Chris Burrows wrote:
On Monday, November 26, 2018 at 11:51:44 PM UTC+10:30, Josef Moellers wrote:
I assume that most of the compiler itself is running on top of the mcode
virtual machine, judging from these filenames: COMPILE.MCD, GENZ80.MCD
I'll see what I can find.
That is correct. COMPILE is the compiler and GENZ80 is the native code generator. Refer to Page 258 in the manual, 'Modules in Memory Management' for more information. If you don't already have a copy you can download it from:
www.cpcwiki.eu/imgs/6/64/Borland_Turbo_Modula_2.pdf
I'd be interested to hear about any progress that you make.
1st "Erfolgserlebnis" (sense of achievement):
1) The first 512 bytes in the m2.com are a jump table, unusually coded
as first 256 low bytes then 256 high bytes.
2) while most instructions have no arguments, some instructions do 'ave 'em.
3) DE is the m-code program-counter.
4) m2.com is mainly running m-code.
Having found the jump-table, I can now see what each instruction does.
NB I've used a combination of passive and active analysis:
A) a (mostly) dis-assembled m2.com (using a self-written disassembler
which follows jumps and calls and knows a dead-end when it sees one ;-)
and also allows me to specify entry-points for those cases where the
address is calculated.
B) Using Perl/Expect and a small helper to send/receive through the
serial line, I used a debugger to step through m2.com on my SB180FX.
This showed a "JP (HL)" at more or less regular intervals, the value of
the accumulator was the currently decoded instruction.
Josef
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)