Skip to content

lukepeterson/go8080assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intel 8080 CPU assembler in Go

What good is an 8080 CPU emulator without an assembler?

This project takes an input string, tokenises the string into a slice of tokens, then parses those tokens, converting each to a valid 8080 opcode.

Tests Go Report Card GitHub release

Features

  • ✅ Tokeniser
  • ✅ Parser
  • ✅ Comment support
  • ✅ Supports all 244 instructions on the 8080 cpu

TODO

  • Label support
  • Data support (define byte, word, storage)
  • 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 ./....