apple2-go/io_test.go

32 lines
797 B
Go
Raw Permalink Normal View History

2018-05-20 10:02:08 +00:00
package main
import (
2018-05-26 22:23:35 +00:00
"testing"
2019-11-02 13:33:05 +00:00
"github.com/freewilll/apple2-go/cpu"
"github.com/freewilll/apple2-go/keyboard"
"github.com/freewilll/apple2-go/mmu"
"github.com/freewilll/apple2-go/system"
"github.com/freewilll/apple2-go/video"
2018-05-26 22:23:35 +00:00
"github.com/stretchr/testify/assert"
2018-05-20 10:02:08 +00:00
)
2018-05-27 20:57:46 +00:00
// TestIoBankSwitching tests the switching of the IO memory ROM at $c000-$c7ff
2018-05-20 10:02:08 +00:00
func TestIoBankSwitching(t *testing.T) {
cpu.InitInstructionDecoder()
mmu.InitRAM()
mmu.InitApple2eROM()
mmu.InitIO()
cpu.Init()
keyboard.Init()
video.Init()
system.Init()
cpu.SetColdStartReset()
cpu.Reset()
mmu.MapFirstHalfOfIO()
assert.Equal(t, uint8(0xa2), mmu.ReadMemory(0xc600)) // read from Primary Slot 6 ROM
mmu.MapSecondHalfOfIO()
assert.Equal(t, uint8(0x8d), mmu.ReadMemory(0xc600)) // read from Primary Slot 6 ROM
}