risc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: ISC Imports: 3 Imported by: 2

Documentation

Overview

Package risc implements emulation of the Project Oberon RISC processor.

Index

Constants

View Source
const (
	FramebufferWidth  = 1024
	FramebufferHeight = 768
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Clipboard

type Clipboard interface {
	WriteControl(len uint32)
	ReadControl() uint32
	WriteData(value uint32)
	ReadData() uint32
}

type Error

type Error struct {
	PC uint32
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

type Framebuffer

type Framebuffer struct {
	Rect image.Rectangle
	Pix  []uint32
}

func (*Framebuffer) At

func (fb *Framebuffer) At(x, y int) color.Color

func (*Framebuffer) Bounds

func (fb *Framebuffer) Bounds() image.Rectangle

func (*Framebuffer) ColorModel

func (fb *Framebuffer) ColorModel() color.Model

func (*Framebuffer) PixOffset

func (fb *Framebuffer) PixOffset(x, y int) (i, bit int)

PixOffset is a helper method to locate a pixel in the Pix slice. It returns the index in Pix for the pixel at coordinates (x, y) and the bit position of the pixel within the word, i.e. the pixel value can be isolated with (fb.Pix[i]>>bit)&1.

The coordinates (x, y) are interpreted as image coordinates with the origin (0, 0) at the top left.

type LED

type LED interface {
	Write(value uint32)
}

type RISC

type RISC struct {
	PC uint32     // Program counter
	R  [16]uint32 // General registers R0..R15
	H  uint32     // Auxiliary register for high 32 bits of multiplication or remainder of division
	Z  bool       // Zero flag
	N  bool       // Negative flag
	C  bool       // Carry flag
	V  bool       // Overflow flag

	Mem []uint32 // Memory
	// contains filtered or unexported fields
}

func New

func New() *RISC

func (*RISC) ConfigureMemory

func (r *RISC) ConfigureMemory(megabytesRAM, screenWidth, screenHeight int)

func (*RISC) Framebuffer

func (r *RISC) Framebuffer() *Framebuffer

func (*RISC) GetFramebufferDamageAndReset

func (r *RISC) GetFramebufferDamageAndReset() image.Rectangle

func (*RISC) KeyboardInput

func (r *RISC) KeyboardInput(ps2commands []byte)

func (*RISC) MouseButton

func (r *RISC) MouseButton(button int, down bool)

func (*RISC) MouseMoved

func (r *RISC) MouseMoved(x, y int)

func (*RISC) Reset

func (r *RISC) Reset()

func (*RISC) Run

func (r *RISC) Run(cycles int) error

func (*RISC) SetClipboard

func (r *RISC) SetClipboard(c Clipboard)

func (*RISC) SetLEDs

func (r *RISC) SetLEDs(l LED)

func (*RISC) SetSPI

func (r *RISC) SetSPI(index int, spi SPI)

func (*RISC) SetSerial

func (r *RISC) SetSerial(s Serial)

func (*RISC) SetSwitches

func (r *RISC) SetSwitches(s int)

func (*RISC) SetTime

func (r *RISC) SetTime(millis uint32)

type SPI

type SPI interface {
	ReadData() uint32
	WriteData(value uint32)
}

type Serial

type Serial interface {
	ReadStatus() uint32
	ReadData() uint32
	WriteData(value uint32)
}

Directories

Path Synopsis
internal
fp
Package fp implements floating-point arithmetic operations for the Oberon RISC emulator.
Package fp implements floating-point arithmetic operations for the Oberon RISC emulator.
fp/test/numbers
Command numbers generates a Go file containing a slice of uint32 numbers as test input for the Oberon RISC emulator's floating-point arithmetic operations.
Command numbers generates a Go file containing a slice of uint32 numbers as test input for the Oberon RISC emulator's floating-point arithmetic operations.
fp/test/v2go
Command v2go translates Verilog source code to Go.
Command v2go translates Verilog source code to Go.

Jump to

Keyboard shortcuts

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