Documentation
¶
Index ¶
- type FlatMemory
- type Memory
- type State
- func (s *State) DisasmInstruction(pc uint32) (string, uint32)
- func (s *State) ExecuteInstruction()
- func (s *State) GetA(i int) uint32
- func (s *State) GetCycles() uint64
- func (s *State) GetD(i int) uint32
- func (s *State) GetPC() uint32
- func (s *State) GetSR() uint16
- func (s *State) GetTrace() bool
- func (s *State) IsSupervisor() bool
- func (s *State) Load(r io.Reader) error
- func (s *State) Reset()
- func (s *State) Save(w io.Writer) error
- func (s *State) SetIRQ(level uint8)
- func (s *State) SetMemory(mem Memory)
- func (s *State) SetPC(pc uint32)
- func (s *State) SetTrace(trace bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlatMemory ¶
type FlatMemory struct {
// contains filtered or unexported fields
}
FlatMemory puts RAM on the 16Mb addressable by the processor. As it is too big to be embedded on the struct, it must be created with NewFlatMemory().
func NewFlatMemory ¶
func NewFlatMemory() *FlatMemory
NewFlatMemory returns 16Mb of RAM covering the full address space
func (*FlatMemory) Peek ¶
func (m *FlatMemory) Peek(address uint32) uint8
Peek returns the data on the given address
func (*FlatMemory) PeekCode ¶
func (m *FlatMemory) PeekCode(address uint32) uint8
PeekCode returns the data on the given address
func (*FlatMemory) Poke ¶
func (m *FlatMemory) Poke(address uint32, value uint8)
Poke sets the data at the given address
type Memory ¶
type Memory interface {
Peek(address uint32) uint8
Poke(address uint32, value uint8)
// PeekCode can be used to optimize the memory manager to requests with
// more locality. It must return the same as a call to Peek()
PeekCode(address uint32) uint8
}
Memory represents the addressable space of the processor. Note that the 68000 is big endian and that words and longs are built from the bytes here.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents the state of the simulated device
func NewM68000 ¶
NewM68000 returns an initialized M68000. Call Reset() to load the stack pointer and the program counter from the vector table.
func (*State) DisasmInstruction ¶
DisasmInstruction disassembles the instruction at the given address, returning the text and the address of the next instruction
func (*State) ExecuteInstruction ¶
func (s *State) ExecuteInstruction()
ExecuteInstruction transforms the state given after a single instruction is executed. An instruction aborted by an exception counts as executed.
func (*State) GetA ¶
GetA returns an address register, from A0 to A7. A7 is the stack pointer of the mode the processor is in.
func (*State) GetD ¶
GetD returns a data register, from D0 to D7. The Macintosh power on tests leave their result on D6 and D7, which is how an emulator can report what the Sad Mac shows without rendering it.
func (*State) IsSupervisor ¶
IsSupervisor tells if the processor is in supervisor mode
func (*State) Reset ¶
func (s *State) Reset()
Reset resets the processor. The supervisor stack pointer and the program counter are loaded from the two first vectors.
func (*State) SetIRQ ¶
SetIRQ sets the level of the interrupt request lines, from 0 for no interrupt to 7 for the non maskable one. While it is asserted, an interrupt is serviced before each instruction if the mask on the status register allows it.