Est. 1974 Advanced

Assembler (8080)

The assembly language of the Intel 8080, the April 1974 microprocessor behind the Altair 8800, CP/M and Altair BASIC, whose mnemonics and register model carried over into the 8085, the Z80 and x86.

Created by Intel Corporation (8080 designed by Federico Faggin, Masatoshi Shima and Stanley Mazor)

Paradigm Assembly, Imperative, Low-level
Typing None (untyped)
First Appeared 1974
Latest Version No versioned standard; Intel's 8080/8085 Assembly Language Programming Manual (9800301, last revised May 1981) is the final official definition

Assembler (8080) is the assembly language of the Intel 8080, an 8-bit NMOS microprocessor that Intel released in April 1974. The 8008 before it showed that a processor on a chip could work, and the 8080 made one practical. It had a 40-pin package, a 16-bit address bus covering 64 KB of memory, a stack in external memory, and TTL-compatible signals. It powered the MITS Altair 8800, the IMSAI 8080 and the early S-100 machines, and it was the original target of CP/M. Its assembly language became one of the most widely used programming notations of the early personal computer era. Its mnemonics (MOV, MVI, LXI, DAD, JNZ, CALL, RET) and its register model can still be traced through the 8085, the Zilog Z80 and the x86 family.

History and Origins

From the 8008 to the 8080

Intel’s first 8-bit processor, the 8008 (1972), used the instruction set of the Datapoint 2200 terminal. It was slow, and its 18-pin package forced addresses and data to share pins. Federico Faggin, who had led the 4004 design and became the primary architect of the 8080, reportedly heard complaints about it from customers while giving seminars. He proposed a successor in the spring of 1972. Intel’s management did not approve the project until that autumn. In November 1972 Faggin brought Masatoshi Shima over from Japan to do the detailed logic and circuit design under his direction. Stanley Mazor also worked on the architecture.

Shima finished the layout in August 1973, production began in December, and a working NMOS prototype was ready in January 1974. Intel released the 8080 in April 1974. Its launch advertisement, in the 15 April 1974 issue of Electronic News, was headlined “From CPU to software, the 8080 Microcomputer is here.” Intel was selling a programming environment along with the chip.

Source compatibility, not binary compatibility

The 8080 cannot run 8008 binaries. The opcodes were reassigned and the assembly mnemonics were redesigned, so the 8008’s LAB became the 8080’s MOV A,B. Intel still presented the 8080 as the 8008’s successor at the source level: its September 1975 8080 Microcomputer Systems User’s Manual says programs written for the 8008 can be assembled and executed on the 8080. This idea of an assembly-level migration path came back when Intel designed the 8086.

The tools of 1974–1975

Many early 8080 programs were not assembled on 8080 hardware. Intel’s approach followed the one it had used for the 8008. Programmers wrote code on a minicomputer or a time-sharing mainframe, assembled it there, and loaded the result into an Intellec development system or burned it into PROM. Intel’s March 1975 data sheet for MAC80, the MCS-80 cross assembler, describes it this way:

  • It was written in ANSI standard FORTRAN IV, for “most large scale computing systems with a 32-bit or larger integer format.”
  • It accepted “all 78 instruction mnemonics plus 10 pseudo-operators.”
  • It allowed up to 499 labels and up to nine levels of nested conditional assembly and macro calls.
  • It produced hexadecimal output for loading into an Intellec 8/Mod 80, or BNPF output for programming ROMs.
  • It was available on Tymshare (U.S., U.K., France), General Electric (U.S., Canada), Honeywell Bull (Europe, Australia), United Computing Systems (U.S.), Dentsu (Japan) and Timesharing Ltd. (U.K., Belgium).

Alongside MAC80, Intel sold INTERP/80, an 8080 instruction set simulator written in FORTRAN IV (reportedly by Gary Kildall while he was consulting for Intel), and a PL/M compiler. The language was defined in Intel’s 8080 Assembly Language Programming Manual. Its Rev. B is dated February 1975 and Rev. C January 1976. Intel’s copyright claim on the mnemonics is widely cited as the reason the Z80 got a different assembly syntax; Zilog’s 1978 data catalog states that “all mnemonics copyright Intel Corporation 1977”.

Design of the Language

Registers and register pairs

8080 assembly exposes seven 8-bit working registers, a 16-bit stack pointer and a 16-bit program counter. The manual numbers the registers 0 to 7 but lets programmers use letters for them:

NameNumberPairTypical role
B, C0, 1B (BC)Counters, 16-bit values
D, E2, 3D (DE)16-bit values, second pointer
H, L4, 5H (HL)Memory pointer (M) and 16-bit accumulator
M6The memory byte addressed by HL
A7PSW (A + flags)Accumulator

A distinctive quirk is that a register pair is named by its first register only. LXI H,1234H loads HL, PUSH B pushes BC, DAD D adds DE to HL, and PUSH PSW pushes the accumulator together with the flag byte. The flags are Sign, Zero, Auxiliary Carry, Parity and Carry.

Intel deliberately made the registers specialized rather than general-purpose. HL is the only pair that can address memory in ordinary arithmetic and move instructions, through the pseudo-register M. BC and DE can address memory only through LDAX and STAX. Much of the craft of 8080 programming is deciding which value lives in HL at each moment.

Mnemonic scheme

Intel’s 8080 mnemonics encode the addressing mode in the opcode name itself, rather than in the operand syntax:

OperationRegister formImmediate formDirect-address form
Load/move 8-bitMOV r,rMVI r,dataLDA addr / STA addr
Load 16-bitLXI rp,data16LHLD addr / SHLD addr
AddADD rADI data
Add with carryADC rACI data
CompareCMP rCPI data

Conditional jumps, calls and returns work the same way: JZ, JNZ, JC, JNC, JPE, JPO, JP and JM have matching Cxx call and Rxx return forms. The result is compact and regular for anyone who knows the pattern, but there are many mnemonics to learn.

Statement syntax

The 1975 manual defines a four-field fixed format: label, code, operand and comment. Its rules include:

  • Labels are optional and one to five characters long. They must start with a letter, @ or ?, and must end with a colon.
  • Numbers take a suffix for their base: B for binary, O or Q for octal, D or none for decimal, and H for hexadecimal.
  • Expressions can use +, -, *, /, MOD, NOT, AND, OR, XOR, SHL and SHR, evaluated in a stated precedence order.
  • Comments begin with a semicolon.

Pseudo-instructions and macros

Even in its 1975 form, Intel’s assembly language was a macro assembler language. The Rev. B manual documents these pseudo-instructions:

  • ORG sets the location counter.
  • EQU defines a permanent symbol and SET a redefinable one.
  • DB, DW and DS define bytes, words and storage.
  • IF / ENDIF provide conditional assembly.
  • MACRO / ENDM define macros.
  • END marks the end of the source.

A whole chapter covers “Programming with Macros”, including ready-made macros for indirect loads and indexed addressing, which the 8080 lacks in hardware. DW stores the least significant byte first, and the 8080 is little-endian in all of its 16-bit operations.

Code Examples

The decimal addition routine below is the programming example printed on Intel’s March 1975 MAC80 data sheet. It adds two 16-digit packed BCD numbers two digits at a time:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
;  THIS SUBROUTINE PERFORMS DECIMAL ADDITION
;  FOR 16 DECIMAL DIGITS ON THE INTEL 8080
;  MICROCOMPUTER.
;
;  THE ADDRESS OF THE FIRST OPERAND IS EXPECTED TO BE IN THE
;  D AND E REGISTERS AND THE ADDRESS OF THE SECOND OPERAND
;  IN THE H AND L REGISTERS. THE RESULT IS STORED OVER THE
;  FIRST OPERAND.
;
DECAD:  MVI     C,8         ; INITIALIZE DIGIT COUNTER (HALF)
        XRA     A           ; CLEAR CARRY BIT
LOOP:   LDAX    D           ; LOAD TWO DIGITS FROM FIRST OPERAND
        ADC     M           ; ADD TWO DIGITS FROM SECOND OPERAND WITH CARRY
        DAA                 ; DECIMAL ADJUST RESULT
        STAX    D           ; STORE TWO DIGITS OF RESULT OVER FIRST OPERAND
        INX     H           ; INCREMENT ADDRESS OF SECOND OPERAND
        INX     D           ; INCREMENT ADDRESS OF FIRST OPERAND
        DCR     C           ; DECREMENT DIGIT COUNT
        JNZ     LOOP        ; CONTINUE IF MORE DIGITS LEFT
        RET

It shows most of the language’s character in fourteen bytes. The two operands are addressed in two different ways: LDAX D and STAX D go through DE, and ADC M goes through HL. XRA A clears the carry flag as a side effect. DAA exists for exactly this kind of BCD arithmetic.

Under CP/M, a minimal “Hello, World!” program calls BDOS function 9, which prints a $-terminated string addressed by DE:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
BDOS    EQU     5           ; CP/M BDOS entry point
PRINT   EQU     9           ; BDOS function: print string

        ORG     100H        ; CP/M programs load at 0100H
START:  MVI     C,PRINT     ; function number in C
        LXI     D,MSG       ; string address in DE
        CALL    BDOS
        RET                 ; return to the CCP

MSG:    DB      'Hello, World!$'
        END     START

Evolution

The 8085 (1976)

Intel introduced the 8085 in March 1976. It is binary compatible with the 8080 and adds only two documented instructions: RIM (Read Interrupt Mask) and SIM (Set Interrupt Mask). Intel’s later manuals therefore describe a single “8080/8085 assembly language”; the combined manual 9800301C is dated November 1978, and revision -04 May 1981. The 8085 also has undocumented 16-bit instructions. Wolfgang Dehnhardt and Villy M. Sorensen found them while writing an 8085 assembler, and some modern assemblers support them as an option.

The Z80 and the mnemonic split (1976)

Faggin left Intel in 1974 and co-founded Zilog. Zilog’s Z80 debuted in July 1976 and runs 8080 machine code. Reportedly because Intel claimed copyright on its mnemonics, Zilog wrote a new and more systematic assembly syntax for the same opcodes. In it, MOV A,M becomes LD A,(HL), LXI H,1234H becomes LD HL,1234H, and JNZ becomes JP NZ. For the rest of the 8-bit era, CP/M software existed in two dialects that assembled to identical bytes. Some assemblers, such as the modern Macroassembler AS, accept both spellings.

8080 (Intel)Z80 (Zilog)8086 (Intel)
MOV A,BLD A,BMOV AL,CH
MVI A,5LD A,5MOV AL,5
LXI H,1234HLD HL,1234HMOV BX,1234H
MOV A,MLD A,(HL)MOV AL,[BX]
DAD DADD HL,DEADD BX,DX
JNZ LOOPJP NZ,LOOPJNZ LOOP

The bridge to x86 (1978–1981)

According to Stanley Mazor, the 8086’s architecture was designed so its assembly language closely resembled the 8080’s, and that many 8080 instructions map directly onto 8086 ones. The 8086 register mapping follows from this: A becomes AL, HL becomes BX, BC becomes CX, and DE becomes DX. Intel shipped CONV86, an ISIS-II tool that converted 8080/8085 assembly source into 8086 source; its operating instructions are dated March 1979. Digital Research later offered XLT86, which translated CP/M-80 .ASM files into .A86 source for CP/M-86. With these tools, CP/M-80 assembly programs could be ported to the new 16-bit processor at the source level.

Resident assemblers

As floppy-disk systems spread in the late 1970s, 8080 assembly moved from time-sharing cross assemblers to the microcomputer itself. Intel’s ISIS-II development systems ran a native 8080/8085 macro assembler. CP/M included Digital Research’s ASM, and Digital Research later added MAC and the relocating RMAC.

Current Relevance

No one designs new products around the 8080 today, but its assembly language is very much alive among hobbyists and in teaching:

  • Emulation and retrocomputing. Altair 8800 and IMSAI 8080 replicas and emulators, CP/M emulators, and Space Invaders emulators all run genuine 8080 code. Writing an 8080 emulator is a popular first exercise in CPU emulation, because the instruction set is small and fully documented.
  • Modern cross assemblers. Maintained multi-target assemblers still support the language. For example, Alfred Arnold’s Macroassembler AS supports the 8080/8085 (with an optional 8085UNDOC mode) and has a Z80SYNTAX switch that accepts Zilog-style operands for 8080 code.
  • Clones. Many companies second-sourced or cloned the 8080, including AMD (Am9080), NEC, National Semiconductor, Mitsubishi and Soviet manufacturers (KR580VM80A). Code for machines built on these clones, such as the Soviet Radio-86RK, is written in the same assembly language.

Why It Matters

8080 assembly was the first programming language of the personal computer industry. The Altair’s first BASIC, CP/M, and the first generation of commercial microcomputer software were written in it, or first targeted it. Its register conventions and mnemonic style carried into the 8085. The Z80 re-spelled the same instruction set, and Intel built the 8086 so that 8080 source code could be translated to it mechanically. That design decision is one reason x86 assembly still has an accumulator called AL, a pointer register called BX, and a JNZ instruction. For anyone studying where the modern PC’s instruction set came from, the 8080 is the direct ancestor.

Timeline

1972
Federico Faggin proposes a faster successor to the 8008 in the spring. Intel approves it that autumn, and in November Faggin hires Masatoshi Shima from Japan to do the detailed design
1973
Shima finishes the 8080 layout in August. Production of the chip begins in December
1974
Intel releases the 8080 in April. Its launch advertisement in the 15 April Electronic News is headlined "From CPU to software, the 8080 Microcomputer is here"
1974
Gary Kildall develops CP/M for 8080-based systems on an Intel Intellec-8 development system
1975
Popular Electronics puts the 8080-based MITS Altair 8800 on its January cover. Intel issues Rev. B of the 8080 Assembly Language Programming Manual in February
1975
Intel's March data sheet for the MAC80 cross assembler lists 78 instruction mnemonics, 10 pseudo-operators and full macro support. MAC80 is written in ANSI FORTRAN IV and offered on Tymshare, General Electric and other time-sharing services
1975
Bill Gates, Paul Allen and Monte Davidoff write Altair BASIC for the 8080, testing it on a PDP-10 emulator. MITS ships version 2.0 on 1 July
1976
Intel introduces the 8085 in March. It runs 8080 code and adds just two instructions, RIM and SIM. In July, Zilog debuts the binary-compatible Z80, which has its own assembler mnemonics
1978
Taito's Space Invaders arcade game runs on an Intel 8080. Intel merges the 8080 and 8085 into one assembly language manual (9800301C, November)
1979
Intel documents CONV86, which converts 8080/8085 assembly source into 8086 assembly source (operating instructions dated March 1979)

Notable Uses & Legacy

Altair BASIC (Micro-Soft / MITS)

Microsoft's first product was an 8080 assembly language BASIC interpreter for the Altair 8800. It was developed and debugged on a PDP-10 running Paul Allen's emulator before the authors ever saw an Altair. Allen wrote the paper-tape bootstrap loader in 8080 machine language on the flight to the demonstration in Albuquerque.

CP/M (Digital Research)

Gary Kildall's disk operating system was created in 1974 for 8080 machines. It shipped with ASM, an 8080 assembler, and DDT, a debugger. Each hardware vendor adapted the machine-specific BIOS layer in 8080 assembly, which let the same CP/M applications run on many different S-100 and other 8080/Z80 computers.

Intel SDK-80 System Design Kit

Intel's 1975 single-board 8080 evaluation kit came with a ROM monitor. Intel published the complete assembler listing of that monitor as an appendix to the kit's documentation, making it an early worked example of production 8080 assembly.

Space Invaders (Taito, 1978)

Tomohiro Nishikado built Space Invaders on an Intel 8080 driving a bitmap display, designing his own hardware and development tools. Because the game's program is 8080 machine code, emulating its board is a common first project for people learning 8080 assembly and CPU emulation.

Altair 8800 and IMSAI 8080 microcomputers

The front-panel hobby machines of 1975 had no built-in software. Users toggled 8080 machine code in through switches, or assembled it by hand or with cross assemblers before loading it. This made 8080 assembly the first programming language for many personal computer owners.

Language Influence

Influenced By

Influenced

8085 Assembly Z80 Assembly x86 Assembly

Running Today

Run examples using the official Docker image:

docker pull
Last updated: