So, I’ve been hitting the books and I’ve found a few cool resources on the 8085 CPU. Since I understand how most assembly languages work, I want to focus on the unique qualities of this CPU and expose its strengths and weaknesses. The MOS 6502 is well known for its efficiency and instruction pipe lining. Yet, handling simple programming chores like structuring blocks is a pain. For instance, if you wanted to write a conditional statement with several clauses, you would have to use branch instructions or unconditional jumps in the right places.
This isn’t anything new and is a problem typically found in most machine code. However, the 8085 comes with quite a few conditional jump instructions just like the 6502, yet also packs in some niceties that allow some more conditionals to reduce boilerplate code:
With the ability to call subroutines vs. local labels, you can really keep your source clean and flexible. Also, when you call your subroutine, you can handle local logic as normal, yet you also have the ability to return on flag conditions. If a subroutine is well thought out, you can get away with saving some bytes and cycles.
It is true, calling subroutines vs. jumps involves the use of the stack, and can add some overhead to your application. Ideally, though, your system will have a reasonable amount of ROM / Stack Space to work with. I mean, were not talking about writing code for the Atari 2600.
But still, if we wanted to focus 100% on clarity and ease of use, we would be writing in Ruby or Python. Since we reside in the land of assembly, its best to focus on speed and efficiency. Yet, its always nice when we don’t have to bend over backwards to write a conditional.
This post is specifically for the 8085 CPU and the TRS-80 Model 100.