1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-09 15:29:29 +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);
return n;
}
connectCPUMemoryBus(membus:Bus) : void {
this.cpu.connectMemoryBus({
probeMemoryBus(membus:Bus) : Bus {
return {
read: (a) => {
let val = membus.read(a);
this.probe.logRead(a,val);
@ -323,10 +323,13 @@ export abstract class BasicMachine implements HasCPU, Bus, SampledAudioSource, A
this.probe.logWrite(a,v);
membus.write(a,v);
}
});
};
}
connectCPUIOBus(iobus:Bus) : void {
this.cpu['connectIOBus']({
connectCPUMemoryBus(membus:Bus) : void {
this.cpu.connectMemoryBus(this.probeMemoryBus(membus));
}
probeIOBus(iobus:Bus) : Bus {
return {
read: (a) => {
let val = iobus.read(a);
this.probe.logIORead(a,val);
@ -336,7 +339,10 @@ export abstract class BasicMachine implements HasCPU, Bus, SampledAudioSource, A
this.probe.logIOWrite(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 {
bus : Bus;
probe : ProbeAll;
cycles : number = 0;
regs = new Uint8Array(0x20);
offset : number = -1;
@ -164,7 +163,6 @@ class MARIA {
}
readDLLEntry(bus) {
let x = bus.read(this.dll);
//this.probe.logRead(this.dll, x); // TODO: use bus
this.offset = (x & 0xf);
this.h16 = (x & 0x40) != 0;
this.h8 = (x & 0x20) != 0;
@ -185,14 +183,11 @@ class MARIA {
return 0;
else {
this.cycles += 3;
var val = this.bus.read(a);
//this.probe.logRead(a, val); // TODO: use Bus, clocks
return val;
return this.bus.read(a);
}
}
doDMA(platform : Atari7800) {
let bus = this.bus = platform;
let probe = this.probe = platform.probe;
doDMA(bus : Bus) {
this.bus = bus;
this.cycles = 0;
this.pixels.fill(this.regs[0x0]);
if (this.isDMAEnabled()) {
@ -320,6 +315,8 @@ export class Atari7800 extends BasicMachine {
read : (a:number) => number;
write : (a:number, v:number) => void;
probeDMABus : Bus; // to pass to MARIA
constructor() {
super();
@ -351,6 +348,7 @@ export class Atari7800 extends BasicMachine {
[0x0000, 0xffff, 0xffff, (a,v) => { throw new EmuHalt("Write @ " + hex(a,4) + " " + hex(v,2)); }],
]);
this.connectCPUMemoryBus(this);
this.probeDMABus = this.probeIOBus(this);
this.handler = newKeyboardHandler(this.inputs, Atari7800_KEYCODE_MAP);
this.pokey1 = new POKEYDeviceChannel();
this.audioadapter = new TssChannelAdapter(this.pokey1, audioOversample, audioSampleRate);
@ -397,7 +395,7 @@ export class Atari7800 extends BasicMachine {
// is this scanline visible?
if (visible) {
// do DMA for scanline?
let dmaClocks = this.maria.doDMA(this);
let dmaClocks = this.maria.doDMA(this.probeDMABus);
this.probe.logClocks(dmaClocks >> 2); // TODO: logDMA
mc += dmaClocks;
// copy line to frame buffer

View File

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