interrupt

package
v0.0.0-...-9d1ad58 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FLAG_ADDRESS   uint16 = 0xFF0F
	ENABLE_ADDRESS uint16 = 0xFFFF
)

Variables

View Source
var (
	Types = [...]Type{
		VBLANK, LCD_STAT, TIMER, SERIAL, JOYPAD,
	}

	// https://gbdev.io/pandocs/Interrupts.html#ff0f---if---interrupt-flag-rw
	TypeToAddress = map[Type]uint16{
		VBLANK:   0x40,
		LCD_STAT: 0x48,
		TIMER:    0x50,
		SERIAL:   0x58,
		JOYPAD:   0x60,
	}
)

Functions

This section is empty.

Types

type Interrupt

type Interrupt struct {
	// (IME) MasterEnabled is used to disabled all interrupts on the IE register
	MasterEnabled bool
	// EI: sets master to be enabled (delayed one instruction)
	EI InterruptMasterChange
	// DI: sets master to be disabled (delayed one instruction)
	DI InterruptMasterChange
	// (IF - $FFOF) flag identifies if a specific interrupt bit becomes set
	Flag byte
	// (IE - $FFFF) enable specifies if a specific interrupt bit is enabled
	Enable byte
}

https://gbdev.io/pandocs/Interrupts.html

func New

func New() *Interrupt

func (*Interrupt) Enabled

func (i *Interrupt) Enabled(t Type) bool

func (*Interrupt) Flagged

func (i *Interrupt) Flagged(t Type) bool

func (*Interrupt) Read

func (i *Interrupt) Read(address uint16) byte

func (*Interrupt) Requested

func (i *Interrupt) Requested() bool

func (*Interrupt) Triggered

func (i *Interrupt) Triggered(t Type) bool

func (*Interrupt) Write

func (i *Interrupt) Write(address uint16, data byte)

type InterruptMasterChange

type InterruptMasterChange byte
const (
	MASTER_SET_NONE InterruptMasterChange = 0
	MASTER_SET_NOW  InterruptMasterChange = 1
	MASTER_SET_NEXT InterruptMasterChange = 2
)

type Type

type Type byte
const (
	VBLANK   Type = 1
	LCD_STAT Type = 2
	TIMER    Type = 4
	SERIAL   Type = 8
	JOYPAD   Type = 16
)

Jump to

Keyboard shortcuts

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