This is my Intel 8080 CPU assembler, which I wrote to support my Intel 8080 CPU emulator.
It takes a newline separated string of Intel 8080 instructions, parses and validates the tokens, and then returns the assembled byte code.
- ✅ Tokeniser
- ✅ Parser
- ✅ Comment support
- ✅ Supports full (244) 8080 CPU instructions
- Label support
- Data support (eg,
DB
,DW
) - Input from
STDIN
code := `
MVI A, 34h
MOV B, C
LDA 1234h
HLT
`
assembler := &assembler.Assembler{}
assembler.Assemble(code)
for _, instruction := range assembler.ByteCode {
fmt.Printf("%02X ", instruction)
}
// Prints "3E 34 41 3A 34 12 76"
Run go test ./...
.