machine

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package machine contains 8bit machine and coponents implementation

Index

Constants

View Source
const (
	UnknownMachine = iota
	ZXSpectrum
	AmstradCPC
	ZX8081      // NOT IMPLEMENTED
	Commodore64 // NOT IMPLEMENTED
	MSX         // NOT IMPLEMENTED
)

Machines

View Source
const (
	UnknownModel = iota
	ZXSpectrum16k
	ZXSpectrum48k
	AmstradCPC464
	ZX80         // NOT IMPLEMENTED
	ZX81         // NOT IMPLEMENTED
	CommodoreC64 // NOT IMPLEMENTED
	MSX1         // NOT IMPLEMENTED
)

Machine models

View Source
const DefaultModel = ZXSpectrum48k

DefaultModel default machine model is ZX Spectrum 48k

Variables

MachineModels machines and models mapping

View Source
var Machines = map[string]int{
	"zxspectrum":  ZXSpectrum,
	"amstradcpc":  AmstradCPC,
	"zx80":        ZX8081,
	"zx81":        ZX8081,
	"commodore64": Commodore64,
	"msx":         MSX,
}

Machines machine name mapping

View Source
var Models = map[string]int{
	"zxspectrum16k": ZXSpectrum16k,
	"zx16k":         ZXSpectrum16k,
	"zxspectrum48k": ZXSpectrum48k,
	"zx48k":         ZXSpectrum48k,
	"speccy":        ZXSpectrum48k,
	"zx80":          ZX80,
	"zx81":          ZX81,
	"cpc464":        AmstradCPC464,
	"c64":           CommodoreC64,
	"msx1":          MSX1,
}

Models machine model name mapping

Functions

func GetMachine

func GetMachine(name string) int

GetMachine gets machine ID from name

func GetMachineFromModel

func GetMachineFromModel(model int) int

GetMachineFromModel gets machine ID from model ID

func GetModel

func GetModel(name string) int

GetModel gets model ID from name

func Register

func Register(id int, factory Factory)

Register registers a machine

Types

type Config

type Config struct {
	Model        int           // Machine model
	FPS          float32       // Frames per second
	FrameTime    time.Duration // Duration of a frame
	FrameTStates int           // TStates per frame
}

Config machine configuration

func (*Config) SetFPS

func (conf *Config) SetFPS(FPS float32)

SetFPS sets FPS and FrameDuration

type Factory

type Factory func(int) Machine

Factory is a machine constructor function

type Machine

type Machine interface {
	device.Device // Is a device
	// Config gets the machine configuration
	Config() *Config
	// CPU the machine main CPU
	CPU() cpu.CPU
	// Components the machine components
	Components() *device.Components
	// SetController connects the machine to the controller
	SetController(controller.Controller)
	// BeginFrame begin emulation frame tasks
	BeginFrame()
	// Emulate one machine step
	Emulate()
	// EndFrame end emulation frame tasks
	EndFrame()
	// LoadFile loads a file into machine
	LoadFile(name string)
	// TakeSnap takes and saves snapshop of the machine state
	TakeSnapshot()
}

Machine is a 8bit machine

func Create

func Create(model string) (Machine, error)

Create returns a machine from a model name

func CreateFromModel

func CreateFromModel(model int) (Machine, error)

CreateFromModel returns a machine from a model id

Directories

Path Synopsis
cpc
Package cpc implements the Amstrad CPC machine
Package cpc implements the Amstrad CPC machine
Package spectrum implements de ZX Spectrum machine
Package spectrum implements de ZX Spectrum machine

Jump to

Keyboard shortcuts

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