E2E tests working with DMA

This commit is contained in:
Ivan Izaguirre 2024-09-15 16:53:44 +02:00
parent 1baddad56e
commit c89aa36f1d
5 changed files with 23 additions and 4 deletions

View File

@ -34,27 +34,30 @@ func (a *Apple2) Start(paused bool) {
a.paused = paused a.paused = paused
for { for {
// Run 6502 steps // Run cpu steps
if !a.paused { if !a.paused {
if !a.dmaActive { if !a.dmaActive {
spinStartCycles := a.cpu.GetCycles() // 6502 is running
for i := 0; i < cpuSpinLoops && !a.dmaActive; i++ { for i := 0; i < cpuSpinLoops && !a.dmaActive; i++ {
// Conditional tracing // Conditional tracing
// pc, _ := a.cpu.GetPCAndSP() // pc, _ := a.cpu.GetPCAndSP()
// a.cpu.SetTrace(pc >= 0xc700 && pc < 0xc800) // a.cpu.SetTrace(pc >= 0xc700 && pc < 0xc800)
// Execution // Execution
startCycles := a.cpu.GetCycles()
a.cpu.ExecuteInstruction() a.cpu.ExecuteInstruction()
a.cycles += a.cpu.GetCycles() - startCycles
// Special tracing
a.executionTrace() a.executionTrace()
} }
a.cycles += a.cpu.GetCycles() - spinStartCycles
} else { } else {
// a card, like the Z80 Softcard, is running
card := a.cards[a.dmaSlot] card := a.cards[a.dmaSlot]
for i := 0; i < cpuSpinLoops && a.dmaActive; i++ { for i := 0; i < cpuSpinLoops && a.dmaActive; i++ {
card.runDMACycle() card.runDMACycle()
a.cycles++ a.cycles++
a.executionTrace()
} }
} }

View File

@ -61,6 +61,10 @@ func (t *traceApplecorn) connect(a *Apple2) {
} }
func (t *traceApplecorn) inspect() { func (t *traceApplecorn) inspect() {
if t.a.dmaActive {
return
}
if !t.a.mmu.altMainRAMActiveRead { if !t.a.mmu.altMainRAMActiveRead {
// We want to trace only the activity on the Acorn memory space // We want to trace only the activity on the Acorn memory space
return return

View File

@ -29,6 +29,10 @@ func (t *traceCpm65) connect(a *Apple2) {
} }
func (t *traceCpm65) inspect() { func (t *traceCpm65) inspect() {
if t.a.dmaActive {
return
}
pc, _ := t.a.cpu.GetPCAndSP() pc, _ := t.a.cpu.GetPCAndSP()
if pc == cpm65BdosEntrypoint { if pc == cpm65BdosEntrypoint {
regA, regX, regY, _ := t.a.cpu.GetAXYP() regA, regX, regY, _ := t.a.cpu.GetAXYP()

View File

@ -31,6 +31,10 @@ See:
Experimental. Not sure the paramters for DREAD and DWRITE are correct. Experimental. Not sure the paramters for DREAD and DWRITE are correct.
*/ */
func (t *tracePascal) inspect() { func (t *tracePascal) inspect() {
if t.a.dmaActive {
return
}
bios := uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldL)) + bios := uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldL)) +
uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldH))<<8 uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldH))<<8
pc, _ := t.a.cpu.GetPCAndSP() pc, _ := t.a.cpu.GetPCAndSP()

View File

@ -37,6 +37,10 @@ func (t *traceProDOS) connect(a *Apple2) {
} }
func (t *traceProDOS) inspect() { func (t *traceProDOS) inspect() {
if t.a.dmaActive {
return
}
pc, _ := t.a.cpu.GetPCAndSP() pc, _ := t.a.cpu.GetPCAndSP()
if pc == mliAddress { if pc == mliAddress {
/* /*