Documentation ¶
Overview ¶
Package z80test allows you to write test cases for z80 code.
Index ¶
- type Config
- type ErrorHalt
- type ErrorMaxInstructions
- type ErrorPanic
- type Memory
- func (mem *Memory) Bank(n int) []byte
- func (mem *Memory) ContendRead(address uint16, time int)
- func (mem *Memory) ContendReadNoMreq(address uint16, time int)
- func (mem *Memory) ContendReadNoMreq_loop(address uint16, time int, count uint)
- func (mem *Memory) ContendWriteNoMreq(address uint16, time int)
- func (mem *Memory) ContendWriteNoMreq_loop(address uint16, time int, count uint)
- func (mem *Memory) CopyBank(n int, bank *[1024 * 8]byte) error
- func (mem *Memory) Data() []byte
- func (mem *Memory) Read(address uint16) byte
- func (mem *Memory) ReadByte(address uint16) byte
- func (mem *Memory) ReadByteInternal(address uint16) byte
- func (mem *Memory) Write(address uint16, value byte, protectROM bool)
- func (mem *Memory) WriteByte(address uint16, value byte)
- func (mem *Memory) WriteByteInternal(address uint16, value byte)
- type NextMachine
- func (tc *NextMachine) A() Register8
- func (tc *NextMachine) AF() Register16
- func (tc *NextMachine) B() Register8
- func (tc *NextMachine) BC() Register16
- func (tc *NextMachine) BC_() Register16
- func (tc *NextMachine) B_() Register8
- func (tc *NextMachine) C() Register8
- func (tc *NextMachine) C_() Register8
- func (tc *NextMachine) D() Register8
- func (tc *NextMachine) DE() Register16
- func (tc *NextMachine) DE_() Register16
- func (tc *NextMachine) D_() Register8
- func (tc *NextMachine) E() Register8
- func (tc *NextMachine) E_() Register8
- func (tc *NextMachine) F() Register8
- func (tc *NextMachine) H() Register8
- func (tc *NextMachine) HL() Register16
- func (tc *NextMachine) HL_() Register16
- func (tc *NextMachine) H_() Register8
- func (tc *NextMachine) IX() Register16
- func (tc *NextMachine) IY() Register16
- func (tc *NextMachine) L() Register8
- func (tc *NextMachine) L_() Register8
- func (tc *NextMachine) PC() Register16
- func (tc *NextMachine) SP() Register16
- type Register16
- type Register8
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Core z80asm.Z80Core MaxInstructions int // Maximum number of instructions to execute. // StackTop is the location of the stack. // The value 0 means the stack grows backwards from the top of memory. StackTop uint16 NextMachine *NextMachine }
type ErrorMaxInstructions ¶
type ErrorMaxInstructions struct {
MaxInstructions int
}
ErrorMaxInstructions is an error that is returned when the code reached the maximum number of instructions (as set in the config).
func (ErrorMaxInstructions) Error ¶
func (emi ErrorMaxInstructions) Error() string
type ErrorPanic ¶
type ErrorPanic struct {
Value interface{}
}
ErrorPanic is returned when the interpreter panics (for example, when it executes an unknown instruction).
func (ErrorPanic) Error ¶
func (ep ErrorPanic) Error() string
type Memory ¶
type Memory struct { RAM []byte // 8k banks 0 to (up to) 223. ROM [0x10000]byte Layer2 [256 * 192]byte Layer2_ [256 * 192]byte // Next memory is managed with 8 8k slots. // We store read and write slots separately, although // mostly they are the same. // But Layer2 paging can allow writes to slots 0 and 1 // to go to layer2 (or shadow layer2) banks. // Also, we set the write slot for a ROM bank to nil. ReadSlots [8][]byte WriteSlots [8][]byte }
func (*Memory) ContendRead ¶
func (*Memory) ContendReadNoMreq ¶
func (*Memory) ContendReadNoMreq_loop ¶
func (*Memory) ContendWriteNoMreq ¶
func (*Memory) ContendWriteNoMreq_loop ¶
func (*Memory) ReadByteInternal ¶
func (*Memory) WriteByteInternal ¶
type NextMachine ¶
type NextMachine struct { // RAM stores the banks of RAM in bank order. // The default banks stored in slots 0 to 7 are // ROM, ROM, 10, 11, 4, 5, 0, 1 RAM []byte // contains filtered or unexported fields }
func Call ¶
func Call(c *Config, address uint16) (rm *NextMachine, re error)
Call calls the code at the given address (pushing a dummy PC return address onto the stack first). It finishes naturally when the corresponding `ret` is executed. The final machine state (whenever it's not nil) can be read from the returned machine.
func (*NextMachine) A ¶
func (tc *NextMachine) A() Register8
func (*NextMachine) AF ¶
func (tc *NextMachine) AF() Register16
func (*NextMachine) B ¶
func (tc *NextMachine) B() Register8
func (*NextMachine) BC ¶
func (tc *NextMachine) BC() Register16
func (*NextMachine) BC_ ¶
func (tc *NextMachine) BC_() Register16
func (*NextMachine) B_ ¶
func (tc *NextMachine) B_() Register8
func (*NextMachine) C ¶
func (tc *NextMachine) C() Register8
func (*NextMachine) C_ ¶
func (tc *NextMachine) C_() Register8
func (*NextMachine) D ¶
func (tc *NextMachine) D() Register8
func (*NextMachine) DE ¶
func (tc *NextMachine) DE() Register16
func (*NextMachine) DE_ ¶
func (tc *NextMachine) DE_() Register16
func (*NextMachine) D_ ¶
func (tc *NextMachine) D_() Register8
func (*NextMachine) E ¶
func (tc *NextMachine) E() Register8
func (*NextMachine) E_ ¶
func (tc *NextMachine) E_() Register8
func (*NextMachine) F ¶
func (tc *NextMachine) F() Register8
func (*NextMachine) H ¶
func (tc *NextMachine) H() Register8
func (*NextMachine) HL ¶
func (tc *NextMachine) HL() Register16
func (*NextMachine) HL_ ¶
func (tc *NextMachine) HL_() Register16
func (*NextMachine) H_ ¶
func (tc *NextMachine) H_() Register8
func (*NextMachine) IX ¶
func (tc *NextMachine) IX() Register16
func (*NextMachine) IY ¶
func (tc *NextMachine) IY() Register16
func (*NextMachine) L ¶
func (tc *NextMachine) L() Register8
func (*NextMachine) L_ ¶
func (tc *NextMachine) L_() Register8
func (*NextMachine) PC ¶
func (tc *NextMachine) PC() Register16
func (*NextMachine) SP ¶
func (tc *NextMachine) SP() Register16
type Register16 ¶
type Register16 struct {
// contains filtered or unexported fields
}
func (Register16) Get ¶
func (r Register16) Get() uint16
func (Register16) High ¶
func (r Register16) High() Register8
func (Register16) Low ¶
func (r Register16) Low() Register8
func (Register16) Set ¶
func (r Register16) Set(x int)
Click to show internal directories.
Click to hide internal directories.