[NTLK] NewtonOS ROM Source Code
Matthias Melcher
mm at matthiasm.com
Fri Feb 11 16:21:39 EST 2011
To all developers:
If there was a way to generate fully functional assembler code from the ROM (I am thinking of static code analysis which is terribly easy for the NewtonScript parts and relatively easy for the ARM parts - but hard for all the data chunks), would that be useful to get more insight?
Would those who commented parts of the code be interested to collect all comments in a single database that could be read by this program?
Would an interactive version that allows for easy new commenting be useful?
Would we ever be able to compile NewtonOS as a stand-alon app?
The code below BTW compiles right back into a full Newton ROM... .
Example byte code:
L0062AA24:
NSObjXBin 16 @ NewtonScript Bytecode (16 instruction bytes from 0x0062aa30 to 0x0062aa40)
NSPtr SYMinstructions @ -> 0x00535F6C
BCPush 0 @ 0030: BCPush 0 @ "StringP("
BCGetVar 3 @ 0173: BCGetVar 3 @ arg0
BCPush 1 @ 0031: BCPush 1 @ ")"
BCPush 2 @ 0032: BCPush 2 @ 'array
BCMakeArray 3 @ 0213: BCMakeArray 3 @
BCStringer @ 0307: BCStringer @ concatenate array into string
BCPush 3 @ 0033: BCPush 3 @ 'undocumented
BCPush 4 @ 0034: BCPush 4 @ 'badwickednaughtynoot
BCCall 2 @ 0052: BCCall 2 @ call badwickednaughtynoot(string, 'undocumented)
BCPop @ 0000: BCPop @ throw away the result
BCGetVar 3 @ 0173: BCGetVar 3 @ arg0
BCPush 5 @ 0035: BCPush 5 @ 'isstring
BCCall 1 @ 0051: BCCall 1 @ call isstring(arg0)
BCReturn @ 0002: BCReturn @ return function result
L0062AA84:
NSObjXFrame 5
NSPtr L0067EE70 @ -> array of symbols
.word 0x00000032 @ 'class
NSPtr L0062AA24 @ 'instructions -> see above
NSPtr L0062AA40 @ 'literals
NSNil @ 'argrame
NSInt 1 @ 'numargs
L0062AA40:
NSObjXArray 6
NSPtr SYMliterals @ six literals
NSPtr L0062AA64
NSPtr L0049793C
NSPtr SYMarray @ -> 0x003B0038
NSPtr SYMundocumented @ -> 0x0063801C
NSPtr SYMbadwickednaughtynoot @ -> 0x003B160C
NSPtr SYMisstring @ -> 0x003B4F2C
Example ARM code:
Timeout__18TADSPEndpointChunkFUl: @ 0x00025020: TADSPEndpointChunk::Timeout(unsigned long)
mov r12, sp @ 0x00025020 0xE1A0C00D - ....
stmdb sp!, {r11, r12, lr-pc} @ 0x00025024 0xE92DD800 - .-..
sub r11, r12, #4 @ 0x00025028 0xE24CB004 - .L..
mov r2, r1 @ 0x0002502C 0xE1A02001 - ....
mov r3, #0 @ 0x00025030 0xE3A03000 - ..0.
add r12, r0, #192 @ 0x00025034 0xE280C0C0 - ....
ldr r1, L00025050 @ 0x00025038 0xE59F1010 - ....
teq r12, r2 @ 0x0002503C 0xE13C0002 - .<..
bne L00025054 @ 0x00025040 0x1A000003 - ....
mov r2, #0 @ 0x00025044 0xE3A02000 - ....
bl VEC_KillControl__18TADSPEndpointChunkFlUc @ 0x00025048 0xEB697869 - .ixi
b L00025074 @ 0x0002504C 0xEA000008 - ....
L00025050:
.word 0xFFFFD8DB @ 0x00025050 .... (flags_type_arm_word)
L00025054:
ldr r2, [r2] @ 0x00025054 0xE5922000 - ....
cmn r2, #2 @ 0x00025058 0xE3720002 - .r..
bne L00025068 @ 0x0002505C 0x1A000001 - ....
bl VEC_KillSend__18TADSPEndpointChunkFl @ 0x00025060 0xEB697865 - .ixe
b L00025074 @ 0x00025064 0xEA000002 - ....
L00025068:
cmn r2, #1 @ 0x00025068 0xE3720001 - .r..
bne L00025078 @ 0x0002506C 0x1A000001 - ....
bl VEC_KillRecv__18TADSPEndpointChunkFl @ 0x00025070 0xEB697860 - .ix`
L00025074:
mov r3, r0 @ 0x00025074 0xE1A03000 - ..0.
L00025078:
mov r0, r3 @ 0x00025078 0xE1A00003 - ....
ldmdb r11, {r11, sp, pc} @ 0x0002507C 0xE91BA800 - ....
More information about the NewtonTalk
mailing list