mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-25 18:33:11 +00:00
took maxCycles out of advanceFrame()
This commit is contained in:
parent
69f4eed8a7
commit
f6cc973cdd
@ -1042,7 +1042,7 @@ export abstract class BaseMachinePlatform<T extends Machine> extends BaseDebugPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
advance(novideo:boolean) {
|
advance(novideo:boolean) {
|
||||||
this.machine.advanceFrame(999999, this.getDebugCallback());
|
this.machine.advanceFrame(this.getDebugCallback());
|
||||||
if (!novideo && this.video) this.video.updateFrame();
|
if (!novideo && this.video) this.video.updateFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export interface InstructionBased {
|
|||||||
export type TrapCondition = () => boolean;
|
export type TrapCondition = () => boolean;
|
||||||
|
|
||||||
export interface FrameBased {
|
export interface FrameBased {
|
||||||
advanceFrame(maxClocks:number, trap:TrapCondition) : number;
|
advanceFrame(trap:TrapCondition) : number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VideoSource {
|
export interface VideoSource {
|
||||||
@ -363,7 +363,7 @@ export abstract class BasicScanlineMachine extends BasicMachine implements Raste
|
|||||||
|
|
||||||
frameCycles : number;
|
frameCycles : number;
|
||||||
|
|
||||||
advanceFrame(maxClocks:number, trap) : number {
|
advanceFrame(trap: TrapCondition) : number {
|
||||||
this.preFrame();
|
this.preFrame();
|
||||||
var clock = 0;
|
var clock = 0;
|
||||||
var endLineClock = 0;
|
var endLineClock = 0;
|
||||||
|
@ -218,8 +218,8 @@ export class AppleII extends BasicScanlineMachine {
|
|||||||
drawScanline() {
|
drawScanline() {
|
||||||
// TODO: draw scanline via ap2disp
|
// TODO: draw scanline via ap2disp
|
||||||
}
|
}
|
||||||
advanceFrame(maxClocks:number, trap) : number {
|
advanceFrame(trap) : number {
|
||||||
var clocks = super.advanceFrame(maxClocks, trap);
|
var clocks = super.advanceFrame(trap);
|
||||||
this.ap2disp && this.ap2disp.updateScreen();
|
this.ap2disp && this.ap2disp.updateScreen();
|
||||||
return clocks;
|
return clocks;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ export class Atari7800 extends BasicMachine implements RasterFrameBased {
|
|||||||
return clk;
|
return clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
advanceFrame(maxClocks, trap) : number {
|
advanceFrame(trap) : number {
|
||||||
var idata = this.pixels;
|
var idata = this.pixels;
|
||||||
var iofs = 0;
|
var iofs = 0;
|
||||||
var rgb;
|
var rgb;
|
||||||
|
@ -349,7 +349,7 @@ export class C64 extends BasicMachine implements RasterFrameBased {
|
|||||||
else return this.ram[a];
|
else return this.ram[a];
|
||||||
}
|
}
|
||||||
|
|
||||||
advanceFrame(maxClocks, trap) : number {
|
advanceFrame(trap) : number {
|
||||||
var idata = this.pixels;
|
var idata = this.pixels;
|
||||||
var iofs = 0;
|
var iofs = 0;
|
||||||
var vicClocks = cpuClocksPreDMA;
|
var vicClocks = cpuClocksPreDMA;
|
||||||
@ -362,7 +362,7 @@ export class C64 extends BasicMachine implements RasterFrameBased {
|
|||||||
// TODO: https://www.c64-wiki.com/wiki/Raster_interrupt
|
// TODO: https://www.c64-wiki.com/wiki/Raster_interrupt
|
||||||
if (this.vic.regs[0x19] & 0x1) {
|
if (this.vic.regs[0x19] & 0x1) {
|
||||||
this.vic.regs[0x19] &= 0x7e;
|
this.vic.regs[0x19] &= 0x7e;
|
||||||
this.cpu.IRQ();
|
//TODO: this.cpu.IRQ();
|
||||||
//this.profiler && this.profiler.logInterrupt(0x1);
|
//this.profiler && this.profiler.logInterrupt(0x1);
|
||||||
}
|
}
|
||||||
// is this scanline visible?
|
// is this scanline visible?
|
||||||
@ -472,7 +472,7 @@ export class C64 extends BasicMachine implements RasterFrameBased {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getDebugCategories() {
|
getDebugCategories() {
|
||||||
return ['VIC-II'];
|
return ['CPU','Stack','VIC-II'];
|
||||||
}
|
}
|
||||||
getDebugInfo(category, state) {
|
getDebugInfo(category, state) {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
|
@ -133,9 +133,9 @@ export class KIM1 extends BasicHeadlessMachine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
advanceFrame(maxClocks:number, trap) : number {
|
advanceFrame(trap) : number {
|
||||||
var clock = 0;
|
var clock = 0;
|
||||||
while (clock < maxClocks) {
|
while (clock < this.cpuFrequency/60) {
|
||||||
if (trap && trap()) break;
|
if (trap && trap()) break;
|
||||||
clock += this.advanceCPU();
|
clock += this.advanceCPU();
|
||||||
}
|
}
|
||||||
|
@ -123,12 +123,12 @@ export class Midway8080 extends BasicScanlineMachine {
|
|||||||
this.cpu.interrupt(data);
|
this.cpu.interrupt(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
advanceFrame(maxCycles, trap) : number {
|
advanceFrame(trap) : number {
|
||||||
if (this.watchdog_counter-- <= 0) {
|
if (this.watchdog_counter-- <= 0) {
|
||||||
console.log("WATCHDOG FIRED"); // TODO: alert on video
|
console.log("WATCHDOG FIRED"); // TODO: alert on video
|
||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
return super.advanceFrame(maxCycles, trap);
|
return super.advanceFrame(trap);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadState(state) {
|
loadState(state) {
|
||||||
|
@ -14,7 +14,7 @@ class C64Platform extends Base6502MachinePlatform<C64> implements Platform {
|
|||||||
getDefaultExtension() { return ".c"; };
|
getDefaultExtension() { return ".c"; };
|
||||||
readAddress(a) { return this.machine.readConst(a); }
|
readAddress(a) { return this.machine.readConst(a); }
|
||||||
loadBios(bios) { this.machine.loadBIOS(bios); }
|
loadBios(bios) { this.machine.loadBIOS(bios); }
|
||||||
getMemoryMap = function() { return { main:[
|
getMemoryMap() { return { main:[
|
||||||
{name:'6510 Registers',start:0x0, size:0x2,type:'io'},
|
{name:'6510 Registers',start:0x0, size:0x2,type:'io'},
|
||||||
{name:'RAM', start:0x2, size:0x7ffe,type:'ram'},
|
{name:'RAM', start:0x2, size:0x7ffe,type:'ram'},
|
||||||
{name:'Cartridge ROM',start:0x8000,size:0x2000,type:'rom'},
|
{name:'Cartridge ROM',start:0x8000,size:0x2000,type:'rom'},
|
||||||
|
@ -77,9 +77,9 @@ class WilliamsSound extends BasicMachine {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
advanceFrame(maxCycles, trap) : number {
|
advanceFrame(trap) : number {
|
||||||
this.pixels && this.pixels.fill(0); // clear waveform
|
this.pixels && this.pixels.fill(0); // clear waveform
|
||||||
maxCycles = Math.min(this.cpuCyclesPerFrame, maxCycles);
|
let maxCycles = this.cpuCyclesPerFrame;
|
||||||
var n = 0;
|
var n = 0;
|
||||||
while (n < maxCycles) {
|
while (n < maxCycles) {
|
||||||
if (trap && trap()) {
|
if (trap && trap()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user