From d950bb8ff032550f6299fc3ff8ad42f6372ab8ab Mon Sep 17 00:00:00 2001 From: Will Angenent Date: Sat, 26 May 2018 13:58:41 +0100 Subject: [PATCH] Fixed aux memory writes that should have been ignored This was killing the Prodos basic intepreter bootstrapper since a write was going to main memory at $800, leading to invalid code when the JMP to $0800 from the prodos reloader was done. --- mmu/mmu.go | 9 +++++---- prodos_boot_test.go | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mmu/mmu.go b/mmu/mmu.go index 6ab8694..703f895 100644 --- a/mmu/mmu.go +++ b/mmu/mmu.go @@ -255,16 +255,17 @@ func WriteMemory(address uint16, value uint8) { return } + if FakeAuxMemoryWrite { + // If there is no aux memory, then the write is ignored. + return + } + memory := WritePageTable[address>>8] // If memory is nil, then it's read only. The write is ignored. if memory != nil { memory[uint8(address&0xff)] = value } - if FakeAuxMemoryWrite { - return - } - if system.RunningFunctionalTests && address == 0x200 { testNumber := ReadMemory(0x200) if testNumber == 0xf0 { diff --git a/prodos_boot_test.go b/prodos_boot_test.go index 04c76b6..c428720 100644 --- a/prodos_boot_test.go +++ b/prodos_boot_test.go @@ -31,12 +31,14 @@ func TestProdosBoot(t *testing.T) { utils.RunUntilBreakPoint(t, 0xc600, 2, false, "Boot ROM") utils.RunUntilBreakPoint(t, 0x0801, 2, false, "Loader") - utils.RunUntilBreakPoint(t, 0x2000, 3, false, "Relocator") + utils.RunUntilBreakPoint(t, 0x2000, 3, false, "Kernel Relocator") utils.RunUntilBreakPoint(t, 0x0080, 1, false, "AUX RAM test") utils.RunUntilBreakPoint(t, 0x2932, 1, false, "Relocation done") utils.RunUntilBreakPoint(t, 0x21f3, 1, false, "The first JSR $bf00 - ONLINE - get names of one or all online volumes") utils.RunUntilBreakPoint(t, 0xd000, 1, false, "First call to MLI kernel") - // utils.RunUntilBreakPoint(t, 0x0800, 1, false, "BI loader") + utils.RunUntilBreakPoint(t, 0x0800, 2, false, "BI loader") + utils.RunUntilBreakPoint(t, 0x2000, 2, false, "BI Relocator") + utils.RunUntilBreakPoint(t, 0xbe00, 52, false, "BI Start") elapsed := float64(time.Since(t0) / time.Millisecond) fmt.Printf("CPU Cycles: %d\n", system.FrameCycles)