A disassembler for the stack based virtual machine running on a circa 1987 Trimble 4000SX GPS receiver.
The VM seems to have a lot in common with the UCSD Pascal P-Code virtual machine, with similar classes of instructions, but not similar opcodes. It uses Pascal style strings, which leads me to believe this might have been a commercially sold Pascal implementation.
I haven’t figured out some opcodes yet, but I’ve figured out enough to determine how many extension bytes each opcode will have so that they don’t mess up the disassembly.
More information can be found here:
http://beefchicken.com/gps/trimble/4000/sxdeepdive
This project builds under Go 1.20. Install go, enter the directory of the project, then run go install
The disassembler reads from binary ROM dumps. A ROM dump consists of a directory full of ROM files, and a map.json
file that instructs the disassembler on how to reassembled the roms. For example:
{
"roms": [
{
"file": "U36.rom",
"start": "0x000000", "end": "0x003FFE",
"version": "3.30",
"device": "27C64",
"checksum": "0x52EA"
},
{
"file": "U44.rom",
"start": "0x000001", "end": "0x003FFF",
"version": "3.31",
"device": "27C64",
"checksum": "0xD16B"
},
{
"file": "U37.rom",
"start": "0x090000", "end": "0x09FFFE",
"version": "3.30",
"device": "AT27C256R",
"checksum": "0x2500"
},
{
"file": "U45.rom",
"start": "0x090001", "end": "0x09FFFF",
"version": "3.30",
"device": "AT27C256R",
"checksum": "0x8E92"
},
{
"file": "U38.rom",
"start": "0x0A0000", "end": "0x0AFFFE",
"version": "3.30",
"device": "AT27C256R",
"checksum": "0xE240"
},
{
"file": "U46.rom",
"start": "0x0A0001", "end": "0x0AFFFF",
"version": "3.30",
"device": "AT27C256R",
"checksum": "0x0717"
}
],
"labels": [
{"address": "0x0034AA", "label": "CLEARSCREEN"},
{"address": "0x095BD8", "label": "SLEEP1SECOND"},
{"address": "0x0034C8", "label": "SETSEGMENTS"}
]
}
The disassembler will automatically figure out which ROMs are pairs.
To run the disassembler:
disasm4000sx <path to rom directory>
for example
disasm4000sx 331
Distributed under the MIT License. See LICENSE.txt for more information.
Keelan Lightfoot - http://beefchicken.com/contact/
Project Link: http://code.beefchicken.com/keelan/disasm4000sx