internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RawBlockUnknown RawBlockType = iota
	RawBlockInfo
	RawBlockData

	FileTypeBasic      FBFileType = 2
	FileTypeBgGraphics FBFileType = 3
)
View Source
const (
	FBNameTableOffsetX = 2
	FBNameTableOffsetY = 3
	FBNameTableWidth   = 28
	FBNameTableHeight  = 21
)
View Source
const (
	FAMICOM_FREQUENCY = 1789773
)

Variables

This section is empty.

Functions

func CalcDataChecksum

func CalcDataChecksum(data []byte) uint16

func FBBasicBinToString

func FBBasicBinToString(reader io.Reader) (string, error)

func FBBasicStringToBin

func FBBasicStringToBin(s string, writer io.Writer) error

func FBByteToString

func FBByteToString(c byte) string

func FBStringToBytes

func FBStringToBytes(s string) ([]byte, error)

Types

type FBFile

type FBFile struct {
	Info FBFileInfo
	Data []byte
}

type FBFileInfo

type FBFileInfo struct {
	Type             FBFileType
	Name             [16]byte
	Reserved1        byte
	Length           uint16
	LoadAddress      uint16
	ExecutionAddress uint16
	Pad              [104]byte
}

func (FBFileInfo) MarshalBinary

func (i FBFileInfo) MarshalBinary() ([]byte, error)

func (FBFileInfo) NameStr

func (i FBFileInfo) NameStr() string

func (*FBFileInfo) SetName

func (i *FBFileInfo) SetName(s string)

func (*FBFileInfo) UnmarshalBinary

func (i *FBFileInfo) UnmarshalBinary(buf []byte) error

type FBFileType

type FBFileType uint8

func (FBFileType) String

func (tp FBFileType) String() string

type FBNameTable

type FBNameTable struct {
	Tiles      [960]byte
	Attributes [64]byte
}

func NewFBNameTable

func NewFBNameTable() FBNameTable

func (*FBNameTable) GetString

func (f *FBNameTable) GetString(x, y int) string

func (*FBNameTable) PutString

func (f *FBNameTable) PutString(x, y int, tileString string)

func (*FBNameTable) Read

func (f *FBNameTable) Read(reader io.Reader) error

func (*FBNameTable) Write

func (f *FBNameTable) Write(writer io.Writer) error

type RawBlockType

type RawBlockType uint8

type TapeEncodingInfo

type TapeEncodingInfo struct {
	CyclesPerByte     int
	ShortPulseWidth   int
	LongPulseWidth    int
	SyncMinPulseCount int
	PulseTolerance    float32
}

func NewTapeEncodingInfo

func NewTapeEncodingInfo() TapeEncodingInfo

func (*TapeEncodingInfo) TapeFrequency

func (info *TapeEncodingInfo) TapeFrequency() float64

type TapeReader

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

func NewTapeReader

func NewTapeReader(reader io.ReadSeeker, encInfo TapeEncodingInfo) (*TapeReader, error)

func (*TapeReader) GetPosition

func (reader *TapeReader) GetPosition() int64

func (*TapeReader) NextBit

func (reader *TapeReader) NextBit() (byte, error)

func (*TapeReader) NextByte

func (reader *TapeReader) NextByte() (byte, error)

func (*TapeReader) NextBytes

func (reader *TapeReader) NextBytes(len int) ([]byte, error)

func (*TapeReader) NextBytesWithChecksum

func (reader *TapeReader) NextBytesWithChecksum(len int) ([]byte, uint16, error)

func (*TapeReader) NextFile

func (reader *TapeReader) NextFile() (*FBFile, error)

func (*TapeReader) RewindBit

func (reader *TapeReader) RewindBit(bit byte)

func (*TapeReader) SetPosition

func (reader *TapeReader) SetPosition(pos int64)

func (*TapeReader) SyncToBlock

func (reader *TapeReader) SyncToBlock() (RawBlockType, error)

func (*TapeReader) VerifyBit

func (reader *TapeReader) VerifyBit(bit byte) error

type TapeWriter

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

func NewTapeWriter

func NewTapeWriter(writer io.WriteSeeker, encInfo TapeEncodingInfo, frequency int) (*TapeWriter, error)

func (*TapeWriter) Close

func (writer *TapeWriter) Close() error

func (*TapeWriter) WriteBit

func (writer *TapeWriter) WriteBit(bit byte) error

func (*TapeWriter) WriteByte

func (writer *TapeWriter) WriteByte(v byte) error

func (*TapeWriter) WriteBytes

func (writer *TapeWriter) WriteBytes(buf []byte) error

func (*TapeWriter) WriteBytesWithChecksum

func (writer *TapeWriter) WriteBytesWithChecksum(buf []byte) error

func (*TapeWriter) WriteFile

func (writer *TapeWriter) WriteFile(file FBFile) error

func (*TapeWriter) WritePulse

func (writer *TapeWriter) WritePulse(length int) error

func (*TapeWriter) WriteSilence

func (writer *TapeWriter) WriteSilence(length float64) error

Jump to

Keyboard shortcuts

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