fixed vcs skeleton, added timer stuff, vcs PC fix when debugging, vcs disasm view, vcs run to vsync

This commit is contained in:
Steven Hugg 2018-08-26 20:22:50 -04:00
parent 7cf56b55a8
commit 9cff180022
6 changed files with 22 additions and 13 deletions

View File

@ -51,6 +51,7 @@ TODO:
- vscode/atom extension?
- navigator.getGamepads
- VCS library
- better VCS single stepping, maybe also listings
FYI: Image links for the books on http://8bitworkshop.com/ are broken
On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional?

View File

@ -24,7 +24,7 @@ Start
NextFrame
lsr SWCHB ; test Game Reset switch
bcc Start ; reset?
; 3 lines of VSYNC
; 1 + 3 lines of VSYNC
VERTICAL_SYNC
; 37 lines of underscan
TIMER_SETUP 37
@ -32,10 +32,10 @@ NextFrame
; 192 lines of frame
TIMER_SETUP 192
TIMER_WAIT
; 30 lines of overscan
TIMER_SETUP 30
; 29 lines of overscan
TIMER_SETUP 29
TIMER_WAIT
; go to next frame
; total = 262 lines, go to next frame
jmp NextFrame
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1,6 +1,6 @@
"use strict";
import { Platform, cpuStateToLongString_6502, BaseMAMEPlatform, EmuRecorder, dumpStackToString } from "../baseplatform";
import { Platform, cpuStateToLongString_6502, BaseMAMEPlatform, EmuRecorder, dumpStackToString, DisasmLine } from "../baseplatform";
import { PLATFORMS, RAM, newAddressDecoder, dumpRAM } from "../emu";
import { hex, lpad, tobin, byte2signed } from "../util";
import { CodeAnalyzer_vcs } from "../analysis";
@ -116,6 +116,7 @@ class VCSPlatform {
setupDebug(callback) {
Javatari.room.console.onBreakpointHit = (state) => {
state.c.PC = (state.c.PC - 1) & 0xffff;
Javatari.room.console.pause();
Javatari.room.speaker.mute();
callback(state);
@ -160,7 +161,7 @@ class VCSPlatform {
}
runUntilReturn() {
var depth = 1;
this.runEval(function(c) {
this.runEval( (c) => {
if (depth <= 0 && c.T == 0)
return true;
if (c.o == 0x20)
@ -170,6 +171,10 @@ class VCSPlatform {
return false;
});
}
runToVsync() {
this.advance();
this.runEval( (c) => { return true; } );
}
cpuStateToLongString(c) {
return cpuStateToLongString_6502(c);
}
@ -197,7 +202,7 @@ class VCSPlatform {
}
}
piaStateToLongString(p) {
return "Timer " + p.t + "/" + p.c + "\n";
return "Timer " + p.t + "/" + p.c + "\nINTIM $" + hex(p.IT,2) + " (" + p.IT + ")\nINSTAT $" + hex(p.IS,2) + "\n";
}
tiaStateToLongString(t) {
var pos = this.getRasterPosition();
@ -237,7 +242,11 @@ class VCSPlatform {
this.recorder.recordFrame(this.saveState());
}
}
disassemble(pc:number, read:(addr:number)=>number) : DisasmLine {
return disassemble6502(pc, read(pc), read(pc+1), read(pc+2));
}
};
// TODO: mixin for Base6502Platform?
function nonegstr(n) {
return n < 0 ? "-" : n.toString();

View File

@ -706,7 +706,7 @@ function _recordVideo() {
$("#videoPreviewModal").modal('show');
});
var intervalMsec = 17;
var maxFrames = 500;
var maxFrames = 420;
var nframes = 0;
console.log("Recording video", canvas);
var f = function() {

View File

@ -512,12 +512,13 @@ export class ListingView extends DisassemblerView implements ProjectView {
asmtext = asmtext.replace(/[ ]+\d+\s+.area .+\n/g, '');
}
disasmview.setValue(asmtext);
var findPC = platform.getDebugCallback() ? pc : -1;
var debugging = platform.getDebugCallback && platform.getDebugCallback();
var findPC = debugging ? pc : -1;
if (findPC >= 0 && this.assemblyfile) {
var lineno = this.assemblyfile.findLineForOffset(findPC, 15);
if (lineno && moveCursor) {
// set cursor while debugging
if (platform.getDebugCallback())
if (debugging)
disasmview.setCursor(lineno-1, 0);
jumpToLine(disasmview, lineno-1);
}

View File

@ -567,6 +567,7 @@ function parseDASMListing(code, unresolved, mainFilename) {
}
}
// TODO: use macrolines
// TODO: return {text:code, asmlines:lines, macrolines:macrolines, errors:errors};
return {lines:lines, macrolines:macrolines, errors:errors};
}
@ -636,7 +637,6 @@ function assembleDASM(step) {
listings:listings,
errors:errors,
symbolmap:symbolmap,
intermediate:{listing:alst, symbols:asym},
};
}
@ -806,7 +806,6 @@ function linkLD65(step) {
listings:listings,
errors:errors,
symbolmap:symbolmap,
//TODOintermediate:{listing:lstout, map:mapout, symbols:viceout},
};
}
}
@ -1016,7 +1015,6 @@ function linkSDLDZ80(step)
listings:listings,
errors:errors,
symbolmap:symbolmap,
//TODO intermediate:{listing:rstout},
};
}
}