Documentation
¶
Overview ¶
Package host allows you to create a "host" that emulates a computer system with a 6502 CPU, 64K of memory, a built-in assembler, a built-in debugger, and other useful tools.
Within the host it is possible to assemble and load machine code into memory, debug and step through machine code, measure the number of CPU cycles elapsed, set address and data breakpoints, dump the contents of memory, disassemble the contents of memory, manipulate CPU registers and memory, and evaluate arbitrary expressions.
Index ¶
- type Host
- func (h *Host) AssembleFile(filename string) error
- func (h *Host) Break()
- func (h *Host) Cleanup()
- func (h *Host) EnableProcessedMode(r io.Reader, w io.Writer) *IoState
- func (h *Host) EnableRawMode() *IoState
- func (h *Host) OnBreakpoint(cpu *cpu.CPU, b *cpu.Breakpoint)
- func (h *Host) OnBrk(cpu *cpu.CPU)
- func (h *Host) OnDataBreakpoint(cpu *cpu.CPU, b *cpu.DataBreakpoint)
- func (h *Host) RestoreIoState(state *IoState)
- func (h *Host) RunCommands(interactive bool)
- func (h *Host) Write(p []byte) (n int, err error)
- type IoState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
A Host represents a fully emulated 6502 system, 64K of memory, a built-in assembler, a built-in debugger, and other useful tools.
func (*Host) AssembleFile ¶
AssembleFile assembles a file on disk and stores the result in a compiled 'bin' file. A source map file is also produced.
func (*Host) Cleanup ¶ added in v0.2.0
func (h *Host) Cleanup()
Cleanup cleans up all resources initialized by the call to New().
func (*Host) EnableProcessedMode ¶ added in v0.2.0
EnableProcessedMode disables raw mode and enters the processed I/O mode, where input is read from the reader r and output is written to the writer w. The original I/O state is returned so that it may be restored afterwards.
func (*Host) EnableRawMode ¶ added in v0.2.0
EnableRawMode enables the raw interactive console mode. The original I/O state is returned so that it may be restored afterwards.
func (*Host) OnBreakpoint ¶ added in v0.2.0
func (h *Host) OnBreakpoint(cpu *cpu.CPU, b *cpu.Breakpoint)
OnBreakpoint is called when the debugger encounters a code breakpoint.
func (*Host) OnBrk ¶ added in v0.2.0
OnBrk is called when the CPU is about to execute a BRK instruction.
func (*Host) OnDataBreakpoint ¶ added in v0.2.0
func (h *Host) OnDataBreakpoint(cpu *cpu.CPU, b *cpu.DataBreakpoint)
OnDataBreakpoint is called when the debugger encounters a data breakpoint.
func (*Host) RestoreIoState ¶ added in v0.2.0
RestoreIoState restores a previously saved I/O state.
func (*Host) RunCommands ¶
RunCommands accepts host commands from a reader and outputs the results to a writer. If the commands are interactive, a prompt is displayed while the host waits for the the next command to be entered.