Fixed multiple DOS tests not working

This commit is contained in:
Will Angenent 2018-05-19 11:30:30 +01:00
parent e48ca1a393
commit c2163c8197
5 changed files with 23 additions and 4 deletions

2
.gitignore vendored
View File

@ -3,4 +3,4 @@ cpu.prof
mem.prof
mos6502go.test
apple2e.rom
dos33_disk.dsk
dos33.dsk

View File

@ -91,6 +91,7 @@ func main() {
audio.Mute = *mute
audio.ClickWhenDriveHeadMoves = *clickWhenDriveHeadMoves
system.Init()
cpu.SetColdStartReset()
cpu.Reset()
ebiten.Run(update, 280*video.ScreenSizeFactor, 192*video.ScreenSizeFactor, 2, "Apple //e")

View File

@ -857,6 +857,12 @@ func Run(showInstructions bool, breakAddress *uint16, exitAtBreak bool, disableF
}
}
func SetColdStartReset() {
// Nuke the checkum byte for the reset vector. When this is called, the apple boot firmware will
// conclude that the reset vector is invalid and do a cold start.
mmu.WriteMemory(uint16(0x3f4), uint8(0))
}
func Reset() {
bootVector := 0xfffc
lsb := mmu.PageTable[bootVector>>8][bootVector&0xff] // TODO move readMemory to mmu

View File

@ -14,6 +14,14 @@ import (
const dosDiskImage = "dos33.dsk"
func runDos33Boot(t *testing.T) {
// Boot up DOS3.3
utils.RunUntilBreakPoint(t, 0x0801, 2, false, "Boot0")
utils.RunUntilBreakPoint(t, 0xb700, 2, false, "Boot1")
utils.RunUntilBreakPoint(t, 0x9d84, 2, false, "Boot2")
utils.RunUntilBreakPoint(t, 0xd7d2, 5, false, "JMP to basic interpreter NEWSTT")
}
func TestDOS33Boot(t *testing.T) {
cpu.InitInstructionDecoder()
mmu.InitRAM()
@ -24,12 +32,12 @@ func TestDOS33Boot(t *testing.T) {
keyboard.Init()
video.Init()
system.Init()
cpu.SetColdStartReset()
cpu.Reset()
t0 := time.Now()
// Run until BASIC would execute the program.
utils.RunUntilBreakPoint(t, 0xd7d2, 5, false, "BASIC NEWSTT")
runDos33Boot(t)
elapsed := float64(time.Since(t0) / time.Millisecond)
fmt.Printf("CPU Cycles: %d\n", system.FrameCycles)

View File

@ -19,7 +19,7 @@ func writeBytes(address int, data []uint8) {
}
}
func TestDos33RtsWriteRead(t *testing.T) {
func TestDos33RwtsWriteRead(t *testing.T) {
// Test writing and reading a sector using DOS 3.3's RWTS
cpu.InitInstructionDecoder()
mmu.InitRAM()
@ -30,9 +30,13 @@ func TestDos33RtsWriteRead(t *testing.T) {
keyboard.Init()
video.Init()
system.Init()
cpu.SetColdStartReset()
cpu.Reset()
// Boot up DOS3.3
utils.RunUntilBreakPoint(t, 0x0801, 2, false, "JMP $0801 boot0 done")
utils.RunUntilBreakPoint(t, 0xb700, 2, false, "JMP $b700 boot1 done")
utils.RunUntilBreakPoint(t, 0x9d84, 2, false, "JMP $9d84 boot2 done")
utils.RunUntilBreakPoint(t, 0xd7d2, 5, false, "BASIC NEWSTT")
// Write a sector from 0x2000 to track 35, sector 14