[NTLK] Geek Alert: NewtonOS

Ronnie Simon ronnie_simon at me.com
Wed Sep 3 13:19:04 EDT 2014


Matthias 
             Genial !

Ronnie Simon
On 3 Sep 2014, at 19:16, Matthias Melcher <mm at matthiasm.com> wrote:

> 
> Geek alert, part n of m.
> 
> I added soe funny code to the SVN repository today. The code itself is completely independent of Einstein or NewtonOS, but it uses functions from inside NewtonOS, which were automatically translated from ARM to pseudo-C.
> 
> But let me explain (since you made it all the way to this line).
> 
> .../src/Newt/NewtSim.cp is the main entry point of a new tiny program named NewtSim which simply puts four strings into a queue, then retrieves and prints them, then removes them one-by-one from the queue.
> 
> This sure sounds boring - there is a C++ template for doing just that - so why do I write home about that?
> 
> Well, NewtSim uses part of the NewtonOS to achieve this. The NewtonOS class is called "TSingleQContainer" and is implemented in the developer ROM starting at 0x001E2BBC. It was originally written in C++ and compiled into ARM code. 
> 
> Einstein has a builtin assembly code Monitor which converts ARM code back into Pseudo-C++. The resulting code is ugly and possibly inefficient, but it can be compiled again (for example, into Intel code), and - and that is the important part - works just like the original C++ code.
> 
> The translation for these six functions was fully automatic. The same pseudo-C code now works for Einstein, just as it works for NewtSim. It's the exact same source code, but it created entirely different machine code for each case.
> 
> And since you have been following me for a while, you know that this means we can translate the entire ROM into Pseudo-C and back into native code - in theory at least. I will continue my mission, awaiting the obstacles ahead. I am now attacking the TInterpreter class.
> 
> - Matthias
> ----------------------------------------------------------------------
> 
> The NewtonTalk Mailing List   http://newtontalk.net/
> The Official Newton FAQ       http://splorp.com/newton/faq/
> The Newton Glossary           http://splorp.com/newton/glossary/




More information about the NewtonTalk mailing list