Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.17 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.17 KB

Intel 8080 CPU assembler in Go

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.

Tests Go Report Card GitHub release

Features

  • ✅ Tokeniser
  • ✅ Parser
  • ✅ Comment support
  • ✅ Supports full (244) 8080 CPU instructions

TODO

  • Label support
  • Data support (eg, DB, DW)
  • Input from STDIN

Usage

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"

Running tests

Run go test ./....