[NTLK] More fun with Images and ROMs

Matthias Melcher mm at matthiasm.com
Sun Oct 20 19:04:08 EDT 2013

I put a little tool online for you folks out there to have fun. This can be use to manipulate bitmaps in the MP2100 US ROM. The ROM can then be used in Einstein.

This works on Intel OS X only. You need to use the Terminal, but no worries, it's easy:


The name comes from the idea that the Newton ROM is the golden egg to running NewtonOS natively on Android and iOS. The freckles are the spots on the egg that we do not understand yet. There are about 2 million possible freckles of which we understand about 75%. I want to know what the rest does and find the remaining freckles ;-) .

   E G G F R E C K L E R

Find all the freckles on the Newton egg.

This tool creates and manipulates the MP2100 ROM image by collecting
data from various resources, taking them apart, and rebuilding them
into a ROM image that will run with the NewtonOS emulator "Einstein".

EggFreckler is currently a command line only tool. There are plans
for a user interface - eventually.

EggFreckler runs on Apple OS X Intel only. Older processors will not
be supported. There may be support for Linux one day if some user is
willing to build the GNU cross-compile suite. There will be no
MSWindows support because we rely heavily on GNU tools and the shell.

   Simple Use

How to create a ROM image.

 - open Terminal in /Applications/Utilities/Terminal.app .
 - set the current directory to where you found this README.txt
 - type   ./getROM
 - (make sure you type the dot, the slash, and the lower case and upper
   case character just as I wrote them)
 - the script will download part of the driver developer kit archive
   and assemble the files into a new file named '717006.debug'.
   This is already a working ROM image. You can use this in Einstein.

   Advanced Use

How to manipulate a ROM image.

 - do everything in "Simple Use"
 - now type    bin/db2src 717006.debug newtonos.xml
 - this will create a hierarchy of files that contain the decoded ROM
   as a collection of assembler files and images. You can now go into
   the directory named "images" and draw around in the .bmp images.
   Do not change the file names. Do not change the image sizes. Keep
   in mind that these images are all black & white only.
 - now type    bin/gmake
 - a flood of commands will reassemble all our sources and images back
   into a functional ROM named '717006.rom'.
 - whenever you run 'db2src', all your images will be overwritten with
   the original images form the ROM!
 - whennever you change one or more images, simply run 'gmake' again,
   and the system will only rebuild the files that actually changed

   Expert Use

There is a greater meaning to this than changing images.

If you look through the files you will see an XML database containing
information about the ROM. I will constantly add new features to the
database, creating a slowly evolving source code tree with every new
version of 'db2src'. There is already a complete static analysis of all
ARM code, a 90% complete list of ARM, C, and C++ labels, and a very good
understanding what most of the word in the ROM do.

I will try to add all this knowledge into the system, generating better
and smarter files with each iteration:

The source tree is a representation of the Newton ROM in human readable
and editable code. The code will always compile into an identical ROM.
It is the goal of this program to take the ROM from binary level to a
high level of abstraction. The goal will be reached when most of the binary
is translated back as close to the original source code as possible.

The first milestone is the extraction and reassembly of resources in the ROM,
particularily the bitmaps and masks. A databse structure is set up, and
a complete makefile system is built including all required dependencies.

The second milestone will be relocatable code. By replacing all hard-coded
addresses in the ROM with dynamic labels, we will evetually be able to
add and change any part of the ROM to our liking.

The thirs milestone will be a further abstraction of ARM code into pseudo C
code. This will bring us to the point where we can compile parts of the
ROM to run on any platform. We will create the Newton Script compiler as
a native program and use it to compile the ROM scripts. That will give
us back the full source code of the Newton Script part of the ROM.

 - Matthias
   eggfreckles at matthiasm.com

More information about the NewtonTalk mailing list