tape

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelLow  = 0
	LevelHigh = 0x80
	LevelMask = 0x80
)

EAR level constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	Info() *BlockInfo
	Data() []byte
}

Block is a tape block

type BlockInfo

type BlockInfo struct {
	Type   byte // Block type
	Index  int  // Block index
	Offset int  // Block offset
	Length int  // Block length
}

BlockInfo tape block information

type Control

type Control struct {
	Playing    bool  // Tape drive is playing
	Ear        byte  // Tape EAR level
	State      int   // Playback state
	Tstate     int64 // Last clock Tstate
	Timeout    int   // Timeout of current state
	Block      Block // Current tape block
	NumBlocks  int   // Total number of blocks on tape
	BlockIndex int   // Current block index
	BlockPos   int   // Curren block pos
}

Control struct for tape playback

func (*Control) DataAtPos

func (control *Control) DataAtPos() byte

DataAtPos returns data byte at current block position

func (*Control) EndOfBlock

func (control *Control) EndOfBlock() bool

EndOfBlock position at end of block data

func (*Control) EndOfTape

func (control *Control) EndOfTape() bool

EndOfTape blockindex at end of tape blocks

type Drive

type Drive struct {
	// contains filtered or unexported fields
}

Drive tape device

func New

func New(clock device.Clock) *Drive

New creates a Tarive

func (*Drive) Ear

func (drive *Drive) Ear() byte

Ear tape value

func (*Drive) EarHigh

func (drive *Drive) EarHigh() bool

EarHigh tape state is high

func (*Drive) EarLow

func (drive *Drive) EarLow() bool

EarLow tape state is high

func (*Drive) Eject

func (drive *Drive) Eject()

Eject ejects the tape from drive

func (*Drive) HasTape

func (drive *Drive) HasTape() bool

HasTape if there is a tape

func (*Drive) Init

func (drive *Drive) Init()

Init intializes tape drive

func (*Drive) Insert

func (drive *Drive) Insert(tape Tape)

Insert loads the tape into the drive

func (*Drive) IsPlaying

func (drive *Drive) IsPlaying() bool

IsPlaying if tape drive is playing

func (*Drive) Play

func (drive *Drive) Play()

Play starts tape playback

func (*Drive) Playback

func (drive *Drive) Playback()

Playback emulates the loaded tape

func (*Drive) Reset

func (drive *Drive) Reset()

Reset resets tape drive

func (*Drive) Rewind

func (drive *Drive) Rewind()

Rewind rewinds the tape to start

func (*Drive) Stop

func (drive *Drive) Stop()

Stop stops tape playback

type Info

type Info struct {
	Name string // Tape name
}

Info tape information

type Tape

type Tape interface {
	// Info gets the tape information
	Info() *Info
	// Blocks gets the tape blocks
	Blocks() []Block
	// Load tape data. Returns false on error.
	Load(data []byte) bool
	// Play tape
	Play(control *Control)
}

Tape represents a tape file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL