8080 / 8085 Introduction

        .cr     8080        To load the 8080 cross overlay
        .cr     8085        To load the 8085 cross overlay

We're going way back in time with the 8080 and the 8085 microprocessors. They are the ancestors of our today's Pentium processors. The 8080 was the brain of the MITS Altair 8800, considered to be the world's first personal computer by many.
If you take a look at the 8080's programming model you may find some striking similarities with the Pentium.

From a software point of view there is only a small difference between the 8080 and 8085. In fact the main difference is that the 8085 has 2 extra instructions to deal with its serial input and serial output pins and interrupt system. Apart from that the 8085 uses less cycles to complete most of its instructions, making it faster than the 8080 using the same clock speed. Because of these small differences I describe these two processor types on the same page.
The hardware differences between the two processors are more spectacular. You'd better use a 8085 if you plan to use either of the 2 processors because it is much easier to interface with.

The infamous Altair 8800 The infamous Altair 8800

Programming Model

The programming model in the picture below shows the most important registers of the 8080/8085 processor. I only include a little summary about the features of the 8080/8085's programming model here. It is not my intention to make the original documentation obsolete, so please refer to the original documentation for further details.

8080 & 8085 programming model

The Accumulator

The Accumulator is the most important register for 8 bit arithmetic operations. Its standard name is A, which is a reserved word.
The Accumulator and the Flag register PSW form one single 16-bit register. PUSH and POP treat the Accumulator and PSW as one pair of registers called PSW, where A is the MSB and PSW is the LSB.

The Program Status Word

The PSW contains 5 system flags:

Bit 7SSign Flag
Bit 6ZZero Flag
Bit 50Always 0
Bit 4ACYAuxiliary Carry Flag
Bit 30Always 0
Bit 2PParity Flag
Bit 11Always 1
Bit 0CCarry Flag

General Purpose Registers

Apart from the Accumulator the 8080/8085 is equipped with 6 additional general purpose 8-bit registers. These registers can be concatenated to form three 16-bit register pairs. Especially the HL pair is used as a data pointer to transfer data to and from memory and it can be used for a limited number of 16-bit arithmetic functions.

The Stack Pointer

The stack on an 8080/8085 can be located anywhere in RAM memory, pointed to by the stack pointer SP. Every time something is pushed on to the stack, the SP pointer is decremented, so the stack is growing down in memory.

Stack operations are always performed with registers pairs. A register pair is referenced by the name of the MSB register: B, D or H. The only exception is PSW, which in fact is the LSB register of the AF pair.
A push on the stack, whether it comes from the PUSH instruction, a subroutine call, or interrupt has the following sequence:

  • Decrement SP by 1
  • Save most significant byte of register pair
  • Decrement SP by 1
  • Save least significant byte of register pair

Naturally a POP from the stack has just the opposite effect:

  • Load least significant byte of register pair
  • Increment SP by 1
  • Load most significant byte of register pair
  • Increment SP by 1

The Program Counter

The program counter PC is normally incremented after fetching each instruction or operand byte during program execution. The only way you can change this behaviour is with the jump, call and return instructions. Also interrupts can change the program counter's value.


SB-Assembler Version 3 can show you the cycle times of each instruction when the TON list flag is switched on. The numbers presented are the number of T states the processor needs to execute the instruction.
For conditional instructions 2 times are given. The lowest values are when the condition is false, while the highest times are for when the condition is true.

Reserved Words

The SB-Assembler 8080 and 8085 cross overlays have a few reserved words. Reserved words are all register names. You better avoid these reserved words when you assign your own labels. E.g. don't call your labels PSW, or A or H.
If you do use the reserved words as label names you may expect unpredictable behaviour of the assembler sooner or later. Please note that the assembler will not warn you if you try to assign a label with a reserved name!
Reserved names can not be used in expressions, like label names can. An Undefined label error will be reported if you do try to use a reserved word in an expression because it is treated as a normal label in this case.

Here's the list of all reserved words:

A, B, C, D, E, H, L, M, SP, PSW

Special Features

Restart Vectors

Originally the 8 possible restart vectors are numbered from 0 to 7 in other 8080 assemblers. This is a little inconvenient, because you can't let the restart vector point to the appropriate vector address by using its label name.
Therefore I've added another addressing format to the RST instructions. Not only can you use the original addressing format, using a number from 0 to 7, but you can also use the appropriate vector addresses as well. The list below shows the relation between the vector address and interrupt number.

Vector Address Interrupt Number

Please note that the value of the operand after an RST instruction may not be any other value than 0 to 7, $08, $10, $18, $20, $28, $30 or $38. Any other value will result in a Out of range error to be reported.

Overlay Initialization

Two things are set while initializing the 8080 and 8085 overlays every time one of them is loaded by the .CR directive.

  • Little endian model is selected for 16-bit addresses and for the .DA and .DL directives. This means that words or long words are stored with their low byte first.
  • The maximum program counter value is set to $FFFF.

Differences Between Other Assemblers

There are some differences between the SB-Assembler and other assemblers for the 8080/8085 processor. These differences require you to adapt existing source files before they can be assembled by the SB-Assembler. This is not too difficult though, and is the (small) price you have to pay for having a very universal cross assembler.

  • The 8080/8085 instruction set knows special mnemonics that indicate immediate addressing mode. Therefore it is not absolutely necessary to add the immediate mode identifier # in front of the operand. Although it wouldn't hurt if you did.
    E.g. the two instructions MVI A,VALUE and MVI A,#VALUE have exactly the same effect.
    The SB-Assembler will automatically use 8 or 16-bit values, depending on the instruction's needs. If you want another part of the 32-bit number to be loaded immediately into any of the registers or register pairs you could use the other immediate mode identifiers /, =, or \.
  • The obvious differences in notation of directives common to all SB-Assembler crosses.
  • Don't forget that the SB-Assembler does not allow spaces in or between operands. Only Version 3 will allow one space after each comma separating operands in the operand field.