Beispiel #1
0
func NewTapeFromFile(filename string) (*Tape, error) {
	data, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}

	tap, err := formats.NewTAP(data)
	if err != nil {
		return nil, err
	}

	return &Tape{tap}, nil
}
Beispiel #2
0
func (t *testSuite) Should_load_tapes_using_ROM_routine() {
	filename := "testdata/hello.tap"
	data, err := ioutil.ReadFile(filename)
	t.Nil(err)
	tap, err := formats.NewTAP(data)
	t.Nil(err)

	// Reset
	romLoaded := make(chan (<-chan bool))
	speccy.CommandChannel <- spectrum.Cmd_Reset{romLoaded}
	<-(<-romLoaded)

	errChan := make(chan error)
	speccy.CommandChannel <- spectrum.Cmd_Load{ /*informalFileName*/ filename, tap, errChan}
	t.Nil(<-errChan)

	<-speccy.TapeDrive().LoadComplete()

	t.True(screenEqualTo("testdata/hello_tape_loaded.sna"))
}
Beispiel #3
0
func (t *testSuite) Should_support_accelerated_loading() {
	filename := "testdata/hello.tap"
	data, err := ioutil.ReadFile(filename)
	t.Nil(err)
	tap, err := formats.NewTAP(data)
	t.Nil(err)

	// Reset
	romLoaded := make(chan (<-chan bool))
	speccy.CommandChannel <- spectrum.Cmd_Reset{romLoaded}
	<-(<-romLoaded)

	start := time.Now()
	speccy.TapeDrive().AcceleratedLoad = true

	errChan := make(chan error)
	speccy.CommandChannel <- spectrum.Cmd_Load{ /*informalFileName*/ filename, tap, errChan}
	t.Nil(<-errChan)

	<-speccy.TapeDrive().LoadComplete()

	t.True(time.Now().Sub(start).Nanoseconds() < 10e9)
	t.True(screenEqualTo("testdata/hello_tape_loaded.sna"))
}