Skip to content

Commit

Permalink
E2E tests working with DMA
Browse files Browse the repository at this point in the history
ivanizag committed Sep 15, 2024
1 parent 1baddad commit c89aa36
Showing 5 changed files with 23 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apple2Run.go
Original file line number Diff line number Diff line change
@@ -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()
}
}

4 changes: 4 additions & 0 deletions traceApplecorn.go
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions traceCpm65.go
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 4 additions & 0 deletions tracePascal.go
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 4 additions & 0 deletions traceProDOS.go
Original file line number Diff line number Diff line change
@@ -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 {
/*

0 comments on commit c89aa36

Please sign in to comment.