From c89aa36f1dbb231dbbc1f8ad05d0e59286d7fdc5 Mon Sep 17 00:00:00 2001 From: Ivan Izaguirre Date: Sun, 15 Sep 2024 16:53:44 +0200 Subject: [PATCH] E2E tests working with DMA --- apple2Run.go | 11 +++++++---- traceApplecorn.go | 4 ++++ traceCpm65.go | 4 ++++ tracePascal.go | 4 ++++ traceProDOS.go | 4 ++++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/apple2Run.go b/apple2Run.go index 1398622..0c676dd 100644 --- a/apple2Run.go +++ b/apple2Run.go @@ -34,27 +34,30 @@ func (a *Apple2) Start(paused bool) { a.paused = paused for { - // Run 6502 steps + // Run cpu steps if !a.paused { if !a.dmaActive { - spinStartCycles := a.cpu.GetCycles() + // 6502 is running for i := 0; i < cpuSpinLoops && !a.dmaActive; i++ { // Conditional tracing // pc, _ := a.cpu.GetPCAndSP() // a.cpu.SetTrace(pc >= 0xc700 && pc < 0xc800) // Execution + startCycles := a.cpu.GetCycles() a.cpu.ExecuteInstruction() + a.cycles += a.cpu.GetCycles() - startCycles - // Special tracing a.executionTrace() } - a.cycles += a.cpu.GetCycles() - spinStartCycles } else { + // a card, like the Z80 Softcard, is running card := a.cards[a.dmaSlot] for i := 0; i < cpuSpinLoops && a.dmaActive; i++ { card.runDMACycle() a.cycles++ + + a.executionTrace() } } diff --git a/traceApplecorn.go b/traceApplecorn.go index f442ad0..987287b 100644 --- a/traceApplecorn.go +++ b/traceApplecorn.go @@ -61,6 +61,10 @@ func (t *traceApplecorn) connect(a *Apple2) { } func (t *traceApplecorn) inspect() { + if t.a.dmaActive { + return + } + if !t.a.mmu.altMainRAMActiveRead { // We want to trace only the activity on the Acorn memory space return diff --git a/traceCpm65.go b/traceCpm65.go index 597aebe..7fa71bc 100644 --- a/traceCpm65.go +++ b/traceCpm65.go @@ -29,6 +29,10 @@ func (t *traceCpm65) connect(a *Apple2) { } func (t *traceCpm65) inspect() { + if t.a.dmaActive { + return + } + pc, _ := t.a.cpu.GetPCAndSP() if pc == cpm65BdosEntrypoint { regA, regX, regY, _ := t.a.cpu.GetAXYP() diff --git a/tracePascal.go b/tracePascal.go index aec12a9..adad151 100644 --- a/tracePascal.go +++ b/tracePascal.go @@ -31,6 +31,10 @@ See: Experimental. Not sure the paramters for DREAD and DWRITE are correct. */ func (t *tracePascal) inspect() { + if t.a.dmaActive { + return + } + bios := uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldL)) + uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldH))<<8 pc, _ := t.a.cpu.GetPCAndSP() diff --git a/traceProDOS.go b/traceProDOS.go index fbe1bb4..8fb11e4 100644 --- a/traceProDOS.go +++ b/traceProDOS.go @@ -37,6 +37,10 @@ func (t *traceProDOS) connect(a *Apple2) { } func (t *traceProDOS) inspect() { + if t.a.dmaActive { + return + } + pc, _ := t.a.cpu.GetPCAndSP() if pc == mliAddress { /*