Documentation
¶
Index ¶
- Constants
- type AddressBus
- type AddressError
- type AddressRangeDevice
- type Breakpoint
- type BreakpointEvent
- type BreakpointHit
- type BreakpointType
- type Bus
- func (b *Bus) AddDevice(device Device)
- func (b *Bus) Peek(s Size, address uint32) (uint32, error)
- func (b *Bus) Read(s Size, address uint32) (uint32, error)
- func (b *Bus) Reset()
- func (b *Bus) SetWaitHook(hook WaitHook)
- func (b *Bus) SetWaitStates(states uint32)
- func (b *Bus) Write(s Size, address uint32, value uint32) error
- type BusError
- type CPU
- type CycleListener
- type CycleScheduler
- type Device
- type InterruptController
- type MappedDevice
- func (d *MappedDevice) AddressRange() (uint32, uint32)
- func (d *MappedDevice) Contains(address uint32) bool
- func (d *MappedDevice) Peek(size Size, address uint32) (uint32, error)
- func (d *MappedDevice) Read(size Size, address uint32) (uint32, error)
- func (d *MappedDevice) Reset()
- func (d *MappedDevice) Write(size Size, address uint32, value uint32) error
- type PeekDevice
- type RAM
- type Registers
- type ScheduledEvent
- type Size
- type TraceCallback
- type TraceInfo
- type WaitHook
- type WaitStateDevice
Constants ¶
const ( Version = "1.1.0" XBusError = 2 XAddressError = 3 XIllegal = 4 XDivByZero = 5 XPrivViolation = 8 XUninitializedInt = 15 XTrap = 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressBus ¶
type AddressBus interface {
Read(s Size, address uint32) (uint32, error)
Write(s Size, address uint32, value uint32) error
Reset()
}
AddressBus for accessing address areas
type AddressError ¶
type AddressError uint32
func (AddressError) Error ¶
func (ae AddressError) Error() string
type AddressRangeDevice ¶ added in v1.1.0
AddressRangeDevice exposes a fixed address range that can be indexed by the bus.
type Breakpoint ¶
type BreakpointEvent ¶
type BreakpointEvent struct {
Type BreakpointType
Address uint32
Registers Registers
}
type BreakpointHit ¶
type BreakpointHit struct {
Address uint32
Type BreakpointType
}
func (BreakpointHit) Error ¶
func (bh BreakpointHit) Error() string
type BreakpointType ¶
type BreakpointType int
const ( BreakpointExecute BreakpointType = iota BreakpointRead BreakpointWrite )
func (BreakpointType) String ¶
func (bt BreakpointType) String() string
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus multiplexes memory access between attached devices and performs common checks such as alignment and bus error handling.
func (*Bus) Peek ¶ added in v1.1.0
Peek reads from the mapped device without charging wait states. Devices may use this for debugger-friendly, side-effect-free inspection.
func (*Bus) Read ¶
Read forwards a read to the mapped device after performing alignment and mapping checks.
func (*Bus) SetWaitHook ¶
SetWaitHook installs a callback that receives the configured wait states for every transaction. Callers can use this to count cycles or block for a desired duration.
func (*Bus) SetWaitStates ¶
SetWaitStates defines how many states the bus should report for each transaction when a WaitHook is configured.
type CPU ¶
type CPU interface {
Registers() Registers
Step() error
RunCycles(budget uint64) error
Reset() error
SetTracer(TraceCallback)
SetScheduler(*CycleScheduler)
Scheduler() *CycleScheduler
AddBreakpoint(Breakpoint)
RequestInterrupt(level uint8, vector *uint8) error
Cycles() uint64
}
CPU exposes the minimal interface for interacting with the emulator core.
func NewCPU ¶
func NewCPU(bus AddressBus) (CPU, error)
type CycleListener ¶ added in v1.1.0
type CycleScheduler ¶ added in v1.1.0
type CycleScheduler struct {
// contains filtered or unexported fields
}
type Device ¶
type Device interface {
Contains(address uint32) bool
Read(Size, uint32) (uint32, error)
Write(Size, uint32, uint32) error
Reset()
}
Device represents a memory-mapped peripheral on the address bus. Implementations are expected to be safe for repeated Reset calls and must internally validate the address ranges they cover.
type InterruptController ¶
type InterruptController struct {
// contains filtered or unexported fields
}
func NewInterruptController ¶
func NewInterruptController() *InterruptController
type MappedDevice ¶ added in v1.1.0
type MappedDevice struct {
// contains filtered or unexported fields
}
MappedDevice wraps another device with an explicit 24-bit address range.
func (*MappedDevice) AddressRange ¶ added in v1.1.0
func (d *MappedDevice) AddressRange() (uint32, uint32)
func (*MappedDevice) Contains ¶ added in v1.1.0
func (d *MappedDevice) Contains(address uint32) bool
func (*MappedDevice) Peek ¶ added in v1.1.0
func (d *MappedDevice) Peek(size Size, address uint32) (uint32, error)
func (*MappedDevice) Read ¶ added in v1.1.0
func (d *MappedDevice) Read(size Size, address uint32) (uint32, error)
func (*MappedDevice) Reset ¶ added in v1.1.0
func (d *MappedDevice) Reset()
type PeekDevice ¶ added in v1.1.0
PeekDevice exposes a side-effect-free read path for debugging and disassembly.
type RAM ¶
type RAM struct {
// contains filtered or unexported fields
}
simple flat memory structure
func (*RAM) WaitStates ¶
WaitStates allows RAM to satisfy WaitStateDevice while imposing no additional delay.
type Registers ¶
type Registers struct {
D [8]int32
A [8]uint32
PC uint32
SR uint16
SSP uint32
USP uint32
IR uint16 // instruction register
}
Registers represents the programmer visible registers of the 68000 CPU.
type ScheduledEvent ¶ added in v1.1.0
type TraceCallback ¶
type TraceCallback func(TraceInfo)
type WaitHook ¶
type WaitHook func(states uint32)
WaitHook can be used to simulate wait states or count cycles for bus access.
type WaitStateDevice ¶
WaitStateDevice optionally advertises additional wait states a device imposes per transaction. Implementations may vary their contribution based on access size and address.