vm

package
v0.0.0-...-0d836e2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxWord = 1<<16 - 1
	MemMax  = MaxWord + 1
)
View Source
const (
	BR word = iota
	ADD
	LD
	ST
	JSR
	AND
	LDR
	STR

	NOT
	LDI
	STI
	JMP

	LEA
	TRAP
)
View Source
const (
	POS word = 1 << iota
	ZERO
	NEG
)
View Source
const (
	TrapGetc word = iota + 0x20
	TrapOut
	TrapPuts
	TrapIn
	TrapPutsp
	TrapHalt
)
View Source
const (
	KbdStatus word = 0xFE00
	KbdData   word = 0xFE02
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BadOpError

type BadOpError word

func (BadOpError) Error

func (e BadOpError) Error() string

type BadTrapError

type BadTrapError word

func (BadTrapError) Error

func (e BadTrapError) Error() string

type VM

type VM struct {
	*term.Terminal
	// contains filtered or unexported fields
}

func New

func New(trm *term.Terminal) *VM

func (*VM) KbdLoop

func (vm *VM) KbdLoop()

func (*VM) LoadImageFromFile

func (vm *VM) LoadImageFromFile(fname string)

func (VM) MemRead

func (m VM) MemRead(addr word) word

func (VM) MemWrite

func (m VM) MemWrite(addr, val word)

func (VM) R

func (r VM) R(i word) word

func (*VM) Run

func (vm *VM) Run() error

func (VM) Set

func (r VM) Set(instr word, fn func(word, word) word)

func (VM) SetR

func (r VM) SetR(i, data word)

func (*VM) Stop

func (vm *VM) Stop()

func (VM) Val0

func (r VM) Val0(instr word) word

func (VM) Val1

func (r VM) Val1(instr word) word

func (VM) Val2

func (r VM) Val2(instr word) word

func (*VM) WriteString

func (vm *VM) WriteString(s string)

Jump to

Keyboard shortcuts

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