rp2cgo2

package module
v0.0.0-...-4e24184 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2014 License: GPL-2.0 Imports: 8 Imported by: 0

README

rp2cgo2

A RP 2C02 simulator written in Go

NOTE: This repository is no longer being updated, please see nintengo.

Documentation

Index

Constants

View Source
const (
	CYCLES_PER_SCANLINE uint16 = 341
	NUM_SCANLINES              = 262
	POWERUP_SCANLINE           = 241
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressFlag

type AddressFlag uint16
const (
	CoarseXScroll AddressFlag = 1 << iota

	CoarseYScroll

	NametableSelect

	FineYScroll
)

type ControllerFlag

type ControllerFlag uint8
const (
	BaseNametableAddress ControllerFlag = 1 << iota

	VRAMAddressIncrement
	SpritePatternAddress
	BackgroundPatternAddress
	SpriteSize

	NMIOnVBlank
)

type MaskFlag

type MaskFlag uint8
const (
	Grayscale MaskFlag = 1 << iota
	ShowBackgroundLeft
	ShowSpritesLeft
	ShowBackground
	ShowSprites
	IntensifyReds
	IntensifyGreens
	IntensifyBlues
)

type Mirroring

type Mirroring uint8
const (
	Horizontal Mirroring = iota
	Vertical
	FourScreen
)

func (Mirroring) String

func (m Mirroring) String() string

type OAM

type OAM struct {
	*m65go2.BasicMemory

	Buffer *m65go2.BasicMemory
	// contains filtered or unexported fields
}

func NewOAM

func NewOAM() *OAM

func (*OAM) Sprite

func (oam *OAM) Sprite(index uint8) uint32

func (*OAM) SpriteEvaluation

func (oam *OAM) SpriteEvaluation(scanline uint16, cycle uint16, size uint16) (spriteOverflow bool)

type RP2C02

type RP2C02 struct {
	Output chan []uint8

	Registers Registers
	Memory    *rp2ago3.MappedMemory
	Interrupt func(state bool)

	Cycles chan uint16
	// contains filtered or unexported fields
}

func NewRP2C02

func NewRP2C02(interrupt func(bool)) *RP2C02

func (*RP2C02) Execute

func (ppu *RP2C02) Execute()

func (*RP2C02) Fetch

func (ppu *RP2C02) Fetch(address uint16) (value uint8)

func (*RP2C02) Mappings

func (ppu *RP2C02) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*RP2C02) Reset

func (ppu *RP2C02) Reset()

func (*RP2C02) Run

func (ppu *RP2C02) Run()

func (*RP2C02) Store

func (ppu *RP2C02) Store(address uint16, value uint8) (oldValue uint8)

type Registers

type Registers struct {
	Controller uint8
	Mask       uint8
	Status     uint8
	OAMAddress uint8
	Scroll     uint16
	Address    uint16
	Data       uint8
}

func (*Registers) Reset

func (reg *Registers) Reset()

type Sprite

type Sprite struct {
	TileLow   uint8
	TileHigh  uint8
	Sprite    uint32
	XPosition uint8
}

type SpriteFlag

type SpriteFlag uint32
const (
	// byte 0
	YPosition SpriteFlag = 1 << iota

	// byte 1
	TileBank
	TileNumber

	// byte 2
	SpritePalette

	Priority
	FlipHorizontally
	FlipVertically
	// byte 3
	XPosition
)

type StatusFlag

type StatusFlag uint8
const (
	SpriteOverflow StatusFlag
	Sprite0Hit
	VBlankStarted
)

Jump to

Keyboard shortcuts

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