gomu8080

package module
v0.0.0-...-bbef6f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 5 Imported by: 0

README

Gomu8080

An emulator for Intel 8080 processor written in Go.

This project passed all the CPU test suites below,

  • cpudiag.bin
  • tst8080.com
  • 8080pre.com
  • 8080exm.com

Gomu8080

How to run

You can activate debug mode using flag debug below. Test mode:

go run example/main.go -path=[path to rom file] -debug=true

Space Invader mode:

go run example/main.go -path=[path to rom directory] -debug=false -spaceinvader=true

Important Notes

Even though this project is passed all CPU diagnostic tests above, the Space Invader mode doesn't work as expected. There are some glitches in the animation logic. Therefore, PRs are welcome :)

Space Invaders

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

type Game struct {

	// external hardware
	ShiftReg       uint16
	ShiftRegOffset uint8

	// flipflop for display
	IsFullDraw bool
	LastDraw   int64
	// contains filtered or unexported fields
}

func NewGame

func NewGame(pcs *Processor, mmu *MMU, width int, height int) *Game

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Layout

func (g *Game) Layout(outsideWidth int, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) Process

func (g *Game) Process()

func (*Game) Update

func (g *Game) Update() error

type MMU

type MMU struct {
	Memory [65536]byte
}

MMU - Memory Management Unit

func NewMMU

func NewMMU() *MMU

func (*MMU) Load

func (m *MMU) Load(length int, data []byte, pos int) error

type Processor

type Processor struct {
	// main register
	A byte
	F byte

	B byte
	C byte

	D byte
	E byte

	H byte
	L byte

	// stack register
	SP uint16

	// program counter
	PC uint16

	// processor flags
	Sign           bool
	Zero           bool
	Parity         bool
	Carry          bool
	AuxiliaryCarry bool
	// unused flag (must as for cpu pre test check in psw push pop)
	FlagBit1 bool
	FlagBit3 bool
	FlagBit5 bool

	// debug
	DebugMode bool

	// processor state
	IsHalt bool

	// enable interupt
	IsInteruptsEnabled bool

	// pre calculation for zsp flags
	ZSP [0x100]uint8
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(mmu *MMU, debugMode bool) *Processor

func (*Processor) BdosConsoleOutput

func (p *Processor) BdosConsoleOutput()

Emulate BDOS in CP/M for character output routine C_WRITE - Output character C=2, E=ascii character

func (*Processor) BdosWriteStr

func (p *Processor) BdosWriteStr()

for debugging purpose

Emulate BDOS in CP/M for message output routine
C_WRITESTR - Output string
C=9, DE=address of string

func (*Processor) GetCarry

func (p *Processor) GetCarry(op1 uint8, op2 uint8, carry uint8, bit uint8) bool

func (*Processor) PrintStatus

func (p *Processor) PrintStatus()

debug print status

func (*Processor) Run

func (p *Processor) Run()

func (*Processor) SetAuxiliaryCarry

func (p *Processor) SetAuxiliaryCarry(result uint16, op1 uint8, op2 uint8, isAdd bool)

func (*Processor) SetFlagsAdd

func (p *Processor) SetFlagsAdd(op1 uint8, op2 uint8, carry uint8, mode uint8)

func (*Processor) SetFlagsSub

func (p *Processor) SetFlagsSub(op1 uint8, op2 uint8, carry uint8, mode uint8)

func (*Processor) SetParity

func (p *Processor) SetParity(result byte)

func (*Processor) SetSign

func (p *Processor) SetSign(result byte)

func (*Processor) SetZSP

func (p *Processor) SetZSP(value uint8)

func (*Processor) SetZero

func (p *Processor) SetZero(result byte)

Flags Helper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL