| |
ASM85
8085 assembler
for x86 (C++)
D o w n l o a d
* ASM85 v0.5 binary
(97kb) | source (20kb)
* ASM85 v0.1
binary+source (44kb)
N o t e s
ASM85 v0.5
As I had a month long summer break I
decided to go back and rewrite the assembler. It needed lots of and
work and I wasn't particularly proud of my previous version. Since I
started attending the TopCoder.com contests I have realized how
important it is to handle constraints gracefully. I also felt my
coding structure had improved. The previous version was a source
code reader's incubus.
This time I used VC++ and made extensive use of STL. STL is
excellent, the vector, the map and string classes have resurrected
C++. The overhead is also very little so you don't have to worry
about efficiency.
The source code is missing one component, namely the detailed
syntax checker. It isn't too hard to implement so feel free to add
the code. The assembler is now capable of handling labels and
resolves them appropriately. Hence it requires two passes, the first
pass collects all the important symbolic information and then in the
second pass, labels are substituted with their appropriate address.
The assembler outputs error messages if the process is unsuccessful,
otherwise it outputs a LST and BIN file.
ASM85 v0.1
Writing a compiler has always been something I wanted to try.
Sadly, it is far too time consuming and complicated to write a full
fledged language compiler. One day at college, a professor was
teaching about software patches for microprocessors and about
emulators. He suggested that writing an 8085 assembler (as we were
learning 8085 assembler programming at lab) would serve as an
excellent practical exercise!
Since I have no pedantic knowledge of assembler design, I set off
programming the assembler based on my own ideas. I was writing it in
Turbo C++ 3.0. The foremost problem with assemblers/compilers is
getting the parser right. If you haven't got it right, your entire
program is going to get screwed. You will end up handling too many
exceptions and make the source code look like some overbaked cake!
As you can imagine, I ended up doing this. The other problem with
any program in general is making sure that the program handles every
exception gracefully. Unless you have previously worked in group
projects or programming environments which required your program to
be run by someone other than you during design, most programmer tend
to leave the error handling cases for the end. I suggest that next
time you write programs, handle exceptions in situ!
The 8085 assembler does only one pass. This means it doesn't handle
labels. It outputs a LST file which contains the source and machine
code. No syntax checking is performed.
|