|NewtOS: Memory «NTK» Sample PC SP Einstein Contribute|
Developing NewtonScript apps for the Apple MessagePad
NTK, Apple and the Newton Toolkit
When Apple relesased the Newton MessagePad, they made developers pay dearly for the NewtonScript developer kit. On top of at least one MessagePad (multiple MP's if you wanted to develop for multiple platforms) for around 1000$US each, you had to buy NTK (~2k$) and possibly NCT, the native devloper kit. Not sure if MPW came with all that, but if you wanted to make drivers, you'd have to buy that as well.
As a result, MessagePads were notoriously disconnected from the outside world, making them an island solution for patient folks with cash to spare. Needles to say, I did buy a MessagePad as soon as they came out. Being a software developer by trade, I was frustrated about the high price of NTK and moved quickly to the PalmPilot (their devkit was "only" 600$ IIRC).
NewtonOS in 2020
In 2020, running NewtonOS via the Einstein emulator is tons of fun. I am currently trying to get a very comfortable version of Einstein running on Android (and eventually iOS) mobile devices. Particularly e-Ink devices are very much in the intent of the original MessagePads. Part of this is developing an interface between NewtonOS and Einstein that is as simple as possible for Newton developers, and is supposed to give NewtonOS access to host properties wherever needed.
NTK is a fully integrated developer environment for NewtonScript apps, running on a classic Mac. There are usually no external tools required to get an app compiled and running on a MessagePad connected via the serial port.
In todays world, we can't launch classic Mac apps anymore without the help of an emulator like BasiliskII (download here), and RS232 serial ports are nowhere to be found, unless daisychaining USB adapters and MessagePad proprietary cables.
Connect Einstein to NTK
If you made it here, you are ready to develop your first NewtonOS app!
If the emulators fails to connect, you may have the wrong version of Bailisk. If you are on a Mac, you can download the one I specifically compiled for this.
The NTK Inspector
Now that we know that the connection between Einstein and Basilisk is working, we can try to establish the testing and debugging connection via the Inspector. The Inspector is a dubber buit into NTK on the Mac side, and on the NewtonOS side is implemented via the Toolkit App that we just uploaded to EInstein.
On the Newton, launch Toolkit from the extras folder. Tap on Connect Inspector.
On the Mac side in NTK, press Apple-K, and the Inspector window will open and connect to the Newton. If both dialog boxes vanish, the connection was successful. In the Inspector window, type 2+2 and press Apple-Return. This launches an long chain of events:
GeekOut: NTK, emulated m68k code, will send this request to the serial port that BasiliskII will forward to the pty which will then be picked up by EInstein which forwards it via an emulated serial port to the Toolkit app, emulated ARM code, which then tells NetwonOS to interprete that request in its NewtonScript interpreter. This will compile the text into byte code, and then interprete that bytecode, giving the result back to the Toolkit which gives it back to Einstein, then through the pty to BasiliskII and finally to the NTK Inspector which then prints #8 2. The first number is the event number, the next number is the reult of our calculation. Yeah, it really is that simple.
Try other commands. GetRoot(); is a bit more exciting.
My first Newton app
Let's try the almost mandatory hello world program. Assuming you have everything set up and the Inspector connection is alive (as long as the toolbox in the inspector window is open, the connection is alive).
In NTK, select Project >> New Project... from the menu. In the following file chooser dialog, create a folder named hello and change into it. Also name the project hello and click Save. The new window will contain a list of files that you use to build your app.
Choose File >> Save as... and name the file hello.lyt. Then choose Project >> Add hello.lyt. You are done. This is a very minimal app that will do absolutely nothing. NTK realizes that and will not let you compile it. So we need to add at least a window, I guess.
We want the static text field to say "Hello, world!", so double-click it in the Layout view which will open the hello.lyt Browser. Click on protoStaticText in the left list, then text in the right list. Replace the "Static Text" in the bottom view with "Hello, world!", including both quotes.
Press Apple-S to save the layout, Apple-1 to build the app, and Apple-2 to upload the app to the MessagePad, assuming the Inspector is still running. Now on the MessagePad, open the Extras folder and you should find a new app named "hello". Tap it, and your app should open a window to say hello to the world.
Now hop hop, off you go, write some exciting new apps for the community... !
App icons are 31 pixels wide and 29 pixels high.
(c) 2014 firstname.lastname@example.org - Impressum