I've ordered an Altair 8800 replica computer from Briel Computers. While I'm waiting for it to arrive, I've been reading up on the 8080 microprocessor, the Altair 8800, and CP/M operating system.
For fun I wrote an 8080 assembly language disassembler to help understand 8080 machine language and in preparation for playing with some 8080 assembler programs. I also used it as an opportunity to get more familiar with the Python programming language. It's the first significant program I've written in Python and it was relatively painless to code.
You can get the source code here. The program reads a binary file specified on the command line and produces a disassembly. It requires Python 3. It has been tested on Linux but should work on any platform that supports Python. See the source code for more details.
Here is some sample output using the first example program in the Altair 8800 manual:
% ./disasm8080.py ex2.bin
0000 org $0000
0000 3A 80 00 lda $0080
0003 47 mov b,a
0004 3A 81 00 lda $0081
0007 80 add b
0008 32 82 00 sta $0082
000B C3 00 00 jmp $0000
000E end
I implemented a number of options to control the output format such as the start address and whether to show the hex bytes or just instructions.
I'd say about one third of the effort was coding, one third was entering the table of 8080 instructions, and one third was learning how to do various things in Python, like reading a binary file and manipulating strings.
If is free software released under the Apache License. Give it a try if you are interested.
1 comment:
What assembler would you use to put it back together?
I was wondering about disassembling the zork1 interpreter on CP/M, and before I would change anything I'd like to know it still works..
Post a Comment