1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-01 13:50:30 +00:00

atari7800: probe DMA bus

This commit is contained in:
Steven Hugg 2019-08-26 19:00:01 -04:00
parent 7f37644fc6
commit 2d8d2b91eb
3 changed files with 25 additions and 21 deletions

View File

@ -312,8 +312,8 @@ export abstract class BasicMachine implements HasCPU, Bus, SampledAudioSource, A
this.probe.logClocks(n); this.probe.logClocks(n);
return n; return n;
} }
connectCPUMemoryBus(membus:Bus) : void { probeMemoryBus(membus:Bus) : Bus {
this.cpu.connectMemoryBus({ return {
read: (a) => { read: (a) => {
let val = membus.read(a); let val = membus.read(a);
this.probe.logRead(a,val); this.probe.logRead(a,val);
@ -323,10 +323,13 @@ export abstract class BasicMachine implements HasCPU, Bus, SampledAudioSource, A
this.probe.logWrite(a,v); this.probe.logWrite(a,v);
membus.write(a,v); membus.write(a,v);
} }
}); };
} }
connectCPUIOBus(iobus:Bus) : void { connectCPUMemoryBus(membus:Bus) : void {
this.cpu['connectIOBus']({ this.cpu.connectMemoryBus(this.probeMemoryBus(membus));
}
probeIOBus(iobus:Bus) : Bus {
return {
read: (a) => { read: (a) => {
let val = iobus.read(a); let val = iobus.read(a);
this.probe.logIORead(a,val); this.probe.logIORead(a,val);
@ -336,7 +339,10 @@ export abstract class BasicMachine implements HasCPU, Bus, SampledAudioSource, A
this.probe.logIOWrite(a,v); this.probe.logIOWrite(a,v);
iobus.write(a,v); iobus.write(a,v);
} }
}); };
}
connectCPUIOBus(iobus:Bus) : void {
this.cpu['connectIOBus'](this.probeIOBus(iobus));
} }
} }

View File

@ -98,7 +98,6 @@ class TIA {
class MARIA { class MARIA {
bus : Bus; bus : Bus;
probe : ProbeAll;
cycles : number = 0; cycles : number = 0;
regs = new Uint8Array(0x20); regs = new Uint8Array(0x20);
offset : number = -1; offset : number = -1;
@ -164,7 +163,6 @@ class MARIA {
} }
readDLLEntry(bus) { readDLLEntry(bus) {
let x = bus.read(this.dll); let x = bus.read(this.dll);
//this.probe.logRead(this.dll, x); // TODO: use bus
this.offset = (x & 0xf); this.offset = (x & 0xf);
this.h16 = (x & 0x40) != 0; this.h16 = (x & 0x40) != 0;
this.h8 = (x & 0x20) != 0; this.h8 = (x & 0x20) != 0;
@ -185,14 +183,11 @@ class MARIA {
return 0; return 0;
else { else {
this.cycles += 3; this.cycles += 3;
var val = this.bus.read(a); return this.bus.read(a);
//this.probe.logRead(a, val); // TODO: use Bus, clocks
return val;
} }
} }
doDMA(platform : Atari7800) { doDMA(bus : Bus) {
let bus = this.bus = platform; this.bus = bus;
let probe = this.probe = platform.probe;
this.cycles = 0; this.cycles = 0;
this.pixels.fill(this.regs[0x0]); this.pixels.fill(this.regs[0x0]);
if (this.isDMAEnabled()) { if (this.isDMAEnabled()) {
@ -321,6 +316,8 @@ export class Atari7800 extends BasicMachine {
read : (a:number) => number; read : (a:number) => number;
write : (a:number, v:number) => void; write : (a:number, v:number) => void;
probeDMABus : Bus; // to pass to MARIA
constructor() { constructor() {
super(); super();
this.cpu = new MOS6502(); this.cpu = new MOS6502();
@ -351,6 +348,7 @@ export class Atari7800 extends BasicMachine {
[0x0000, 0xffff, 0xffff, (a,v) => { throw new EmuHalt("Write @ " + hex(a,4) + " " + hex(v,2)); }], [0x0000, 0xffff, 0xffff, (a,v) => { throw new EmuHalt("Write @ " + hex(a,4) + " " + hex(v,2)); }],
]); ]);
this.connectCPUMemoryBus(this); this.connectCPUMemoryBus(this);
this.probeDMABus = this.probeIOBus(this);
this.handler = newKeyboardHandler(this.inputs, Atari7800_KEYCODE_MAP); this.handler = newKeyboardHandler(this.inputs, Atari7800_KEYCODE_MAP);
this.pokey1 = new POKEYDeviceChannel(); this.pokey1 = new POKEYDeviceChannel();
this.audioadapter = new TssChannelAdapter(this.pokey1, audioOversample, audioSampleRate); this.audioadapter = new TssChannelAdapter(this.pokey1, audioOversample, audioSampleRate);
@ -397,7 +395,7 @@ export class Atari7800 extends BasicMachine {
// is this scanline visible? // is this scanline visible?
if (visible) { if (visible) {
// do DMA for scanline? // do DMA for scanline?
let dmaClocks = this.maria.doDMA(this); let dmaClocks = this.maria.doDMA(this.probeDMABus);
this.probe.logClocks(dmaClocks >> 2); // TODO: logDMA this.probe.logClocks(dmaClocks >> 2); // TODO: logDMA
mc += dmaClocks; mc += dmaClocks;
// copy line to frame buffer // copy line to frame buffer

View File

@ -1044,12 +1044,12 @@ abstract class ProbeBitmapViewBase extends ProbeViewBase {
} }
getOpRGB(op:number) : number { getOpRGB(op:number) : number {
switch (op) { switch (op) {
case ProbeFlags.EXECUTE: return 0x0f7f0f; case ProbeFlags.EXECUTE: return 0x018001;
case ProbeFlags.MEM_READ: return 0x7f0101; case ProbeFlags.MEM_READ: return 0x800101;
case ProbeFlags.MEM_WRITE: return 0x010f7f; case ProbeFlags.MEM_WRITE: return 0x010180;
case ProbeFlags.IO_READ: return 0x01ffff; case ProbeFlags.IO_READ: return 0x018080;
case ProbeFlags.IO_WRITE: return 0xff01ff; case ProbeFlags.IO_WRITE: return 0xc00180;
case ProbeFlags.INTERRUPT: return 0xffff01; case ProbeFlags.INTERRUPT: return 0xc0c001;
default: return 0; default: return 0;
} }
} }