[NTLK] Newt/64 and Newton Script internals

Matthias Melcher m.melcher at robowerk.de
Thu Jun 11 15:21:18 EDT 2020


Aaaah well, continuing a little bit my monolog.

I updated Newt/64 a lot more, and it can now take a NewtonScript package and convert it into a readable text file, which can then be compiled again to create a new package.

New feature is the complete dump of the ByteCode that is inside the functions. ByteCode is not yet NEwtonScript, but it is quite readable for small portions of code, so for example:

buttonClickScript:
	func()
       		begin
       			SetTime(time() - 60 * 24);
	       	end,

in bytecode looks like this:

                            buttonClickScript: {
                                class: $\s0003,
                                instructions: MakeBinaryFromBC( [
                                    instructions:
                                    /*   0: 18      */ bc:Push(0), // Time
                                    /*   1: 28      */ bc:CallGlobal(0),
                                    /*   2: 27 1680 */ bc:PushConst(5760), // 1440
                                    /*   5: C1      */ bc:Subtract(),
                                    /*   6: 19      */ bc:Push(1), // SetTime
                                    /*   7: 29      */ bc:CallGlobal(1),
                                    /*   8: 02      */ bc:Ret() 
                                ] ),
                                literals: [
                                    literals:
                                    'Time,
                                    'SetTime
                                ],
                                argFrame: NIL,
                                numArgs: 0,
                                DebuggerInfo: NIL
                            },


Admittedly, this is cryptic, but it is still relatively easy to find and modify code. I am working of getting newt/64 to output the original NewtonScript source code next.

> On Jun 5, 2020, at 00:41, Matthias Melcher <m.melcher at robowerk.de> wrote:
> 
> Even though this is the usual extreme geekyness you expect from me, here are some gory details on newt/64 and NewtonScript packages.




More information about the NewtonTalk mailing list