Documentation
¶
Index ¶
Constants ¶
const ( // AudioSampleRate is the audio sample rate in Hz AudioSampleRate = 44100 // AudioFrameDuration is how long each frame captures (in seconds) AudioFrameDuration = 1.0 // SamplesPerFrame is the number of samples in each frame SamplesPerFrame = int(AudioSampleRate * AudioFrameDuration) )
const ( // DiskRead is a mode for a DiskOp that indicates that an operation is // some kind of read DiskRead = iota // DiskWrite is a mode for a DiskOp that indicates some write took place DiskWrite )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioFrame ¶
type AudioFrame struct {
// Timestamp is the time since boot when this frame was captured
Timestamp float64
// Samples contains the audio sample values (32-bit floats in range [-1.0,
// 1.0]). This is mono data - one sample per time point
Samples []float32
}
AudioFrame represents one second of captured audio data.
type AudioLog ¶
type AudioLog struct {
// contains filtered or unexported fields
}
AudioLog is a collection of AudioFrames, representing all audio captured during emulation.
func NewAudioLog ¶
func NewAudioLog() *AudioLog
NewAudioLog returns a newly allocated AudioLog ready to record audio.
func (*AudioLog) AddSamples ¶
AddSamples adds audio samples to the log. When a full second of samples has been collected, it creates a new frame.
func (*AudioLog) WriteToFile ¶
WriteToFile writes the audio log to a file in text format.
type DiskLog ¶
type DiskLog struct {
// contains filtered or unexported fields
}
A DiskLog is a collection of DiskOps. Put together, it would describe a series of actions on a given disk.
func NewDiskLog ¶
func NewDiskLog() *DiskLog
NewDiskLog returns a newly allocated DiskLog that can be used for recording purposes.
func (*DiskLog) WriteToFile ¶
WriteToFile will write the contents of the disklog to a file. If this cannot be done, an error is returned.
type DiskOp ¶
type DiskOp struct {
// Elapsed is the time between this DiskOp and some user-defined starting
// point. One example is the time when the emulated computer was booted.
Elapsed time.Duration
// Mode is the mode of operation that was performed. By convention, this
// would be either DiskRead or DiskWrite.
Mode int
// Track is the track number where the operation occurred.
Track int
// Sector is the sector number where the operation occurred.
Sector int
// SectorPosition is the raw offset from the beginning of the track where
// the operation occurred.
SectorPosition int
// Byte is the byte involved in the operation (for example -- what was
// read, or what was written).
Byte uint8
// Instruction is the string representation of the instruction and operand
// that caused the disk operation
Instruction string
}
A DiskOp records some disk operation for later analysis (e.g. for debugging).
type FrameAnalysis ¶
type FrameAnalysis struct {
ZeroCrossings int // Number of times the waveform crosses zero
MaxRunLength int // Longest sequence of identical samples
ActivityRate float64 // Percentage of time with varying samples (0-100)
ActivityTimeline string // Visual representation of activity
}
FrameAnalysis contains dropout and pop detection metrics for an audio frame.
type Instruction ¶
type Instruction struct {
// Address is the address at which this instruction was executed.
Address *int
// Instruction is some string representation of the instruction being
// executed in the line.
Instruction string
// Label is an optional feature of a line of code. If provided, it will
// mark that this line may be jumped or branched with that label rather
// than the raw address in memory at which the instruction was executed.
Label string
// PreparedOperand is a formatted representation of an operand, which may
// include information about its address mode, etc.
PreparedOperand string
// OperandMSB and OperandLSB are the most and least signficant bytes that
// comprise an operand. If these are nil, then we treat the instruction
// has not having had an operand.
OperandMSB *uint8
OperandLSB *uint8
// Operand is the full 16-bit operand for some instruction. This will be
// zero even if the instruction does not technically have an operand.
Operand uint16
// Opcode is a numeric representation for the precise instruction and
// address mode that was executed. (That is, one instruction may have many
// opcodes, one for each address mode in which it may be run.)
Opcode uint8
// Comment is some descriptive comment that is appended to the end of the
// line.
Comment string
// Cycles is the number of CPU cycles consumed by this instruction.
Cycles int
// Speculative is true when this line should be considered as
// "speculative" execution: an instruction that did not run, but _would
// have,_ had the conditions been right. Some branches are not taken in
// the code, but had they been, this line would represent an instruction
// from that block.
Speculative bool
// EndOfBlock is true if we regard this line of execution as being the end
// of some subroutine.
EndOfBlock bool
}
Instruction is a representation of some line of assembly to output. There are many kinds of assembly; this is intended to model that of a 6502-style system.
func (Instruction) ShortString ¶
func (ln Instruction) ShortString() string
ShortString returns a shortened version of String. This version includes only the address, instruction, and operand.
func (Instruction) String ¶
func (ln Instruction) String() string
String returns some representation of a line of assembly. There's no single grammar for assembly -- it's usually a notation that works for a specific assembler. As long as it "looks right", that's good enough for now.
type InstructionMap ¶
type InstructionMap struct {
// contains filtered or unexported fields
}
An InstructionMap is a container that holds a set of Instructions. Its only purpose is to debug the execution of some software being emulated.
func NewInstructionMap ¶
func NewInstructionMap() *InstructionMap
NewInstructionMap returns a newly allocated instruction map.
func (*InstructionMap) Add ¶
func (cm *InstructionMap) Add(line *Instruction)
Add inserts a given line to the instruction map.
func (*InstructionMap) Exists ¶
func (cm *InstructionMap) Exists(line *Instruction) bool
Exists returns true if the given line is already in the instruction map.
func (*InstructionMap) Instructions ¶
func (cm *InstructionMap) Instructions() []string
Instructions returns a string slice of every line in the instruction map. The provided slice will be sorted in ascending order -- by convention, this would be according to the addresses that instructions are executed.
func (*InstructionMap) WriteToFile ¶
func (cm *InstructionMap) WriteToFile(file string) error
WriteToFile writes the formatted lines in the instruction map to the given filename. An error is returned if the file could not be created or written to.
type ScreenFrame ¶
A ScreenFrame is a container of a single visual frame (as would have been rendered on screen) as text.
type ScreenLog ¶
type ScreenLog struct {
// contains filtered or unexported fields
}
A ScreenLog is a collection of ScreenFrames, and represents everything we've visually captured of the software.
func NewScreenLog ¶
func NewScreenLog() *ScreenLog
NewScreenLog returns a newly allocated ScreenLog that is ready to add new frames.
func (*ScreenLog) CaptureFrame ¶
func (s *ScreenLog) CaptureFrame(fb *gfx.FrameBuffer, timestamp float64)
CaptureFrame records a ScreenFrame from the given FrameBuffer. That frame is appended to the ScreenLog receiver.
func (*ScreenLog) WriteToFile ¶
WriteToFile will write the contents of a ScreenLog to a file with the provided filename. If that can't be done, an error is returned.
type TimeSet ¶
type TimeSet struct {
// contains filtered or unexported fields
}
A TimeSet is a map of the instructions that were executed during emulation. Each instruction is paired with some metadata about the execution that can be used to determine the rough time spent on execution for each instruction.
func NewTimeset ¶
NewTimeSet returns a TimeSet oriented by the provided timePerCycle -- that is, we will assume each cycle consumes timePerCycle, and will use that to estimate the total cost of execution for each instruction.
func (*TimeSet) Record ¶
Record will add a call to the TimeSet and set the number of cycles consumed by the provided arguments.
func (*TimeSet) WriteToFile ¶
WriteToFile will write the contents of the timeset to some provided filename. If that cannot be done, an error is returned.
type TimeSetEntry ¶
type TimeSetEntry struct {
// contains filtered or unexported fields
}
A TimeSetEntry records information about the execution of some instruction that is recorded in a TimeSet.