Skip to content

lukepeterson/go8080assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 ./....