1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-07 01:29:30 +00:00

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? - vscode/atom extension?
- navigator.getGamepads - navigator.getGamepads
- VCS library - VCS library
- better VCS single stepping, maybe also listings
FYI: Image links for the books on http://8bitworkshop.com/ are broken 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? 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 NextFrame
lsr SWCHB ; test Game Reset switch lsr SWCHB ; test Game Reset switch
bcc Start ; reset? bcc Start ; reset?
; 3 lines of VSYNC ; 1 + 3 lines of VSYNC
VERTICAL_SYNC VERTICAL_SYNC
; 37 lines of underscan ; 37 lines of underscan
TIMER_SETUP 37 TIMER_SETUP 37
@ -32,10 +32,10 @@ NextFrame
; 192 lines of frame ; 192 lines of frame
TIMER_SETUP 192 TIMER_SETUP 192
TIMER_WAIT TIMER_WAIT
; 30 lines of overscan ; 29 lines of overscan
TIMER_SETUP 30 TIMER_SETUP 29
TIMER_WAIT TIMER_WAIT
; go to next frame ; total = 262 lines, go to next frame
jmp NextFrame jmp NextFrame
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1,6 +1,6 @@
"use strict"; "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 { PLATFORMS, RAM, newAddressDecoder, dumpRAM } from "../emu";
import { hex, lpad, tobin, byte2signed } from "../util"; import { hex, lpad, tobin, byte2signed } from "../util";
import { CodeAnalyzer_vcs } from "../analysis"; import { CodeAnalyzer_vcs } from "../analysis";
@ -116,6 +116,7 @@ class VCSPlatform {
setupDebug(callback) { setupDebug(callback) {
Javatari.room.console.onBreakpointHit = (state) => { Javatari.room.console.onBreakpointHit = (state) => {
state.c.PC = (state.c.PC - 1) & 0xffff;
Javatari.room.console.pause(); Javatari.room.console.pause();
Javatari.room.speaker.mute(); Javatari.room.speaker.mute();
callback(state); callback(state);
@ -160,7 +161,7 @@ class VCSPlatform {
} }
runUntilReturn() { runUntilReturn() {
var depth = 1; var depth = 1;
this.runEval(function(c) { this.runEval( (c) => {
if (depth <= 0 && c.T == 0) if (depth <= 0 && c.T == 0)
return true; return true;
if (c.o == 0x20) if (c.o == 0x20)
@ -170,6 +171,10 @@ class VCSPlatform {
return false; return false;
}); });
} }
runToVsync() {
this.advance();
this.runEval( (c) => { return true; } );
}
cpuStateToLongString(c) { cpuStateToLongString(c) {
return cpuStateToLongString_6502(c); return cpuStateToLongString_6502(c);
} }
@ -197,7 +202,7 @@ class VCSPlatform {
} }
} }
piaStateToLongString(p) { 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) { tiaStateToLongString(t) {
var pos = this.getRasterPosition(); var pos = this.getRasterPosition();
@ -237,7 +242,11 @@ class VCSPlatform {
this.recorder.recordFrame(this.saveState()); 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) { function nonegstr(n) {
return n < 0 ? "-" : n.toString(); return n < 0 ? "-" : n.toString();

View File

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

View File

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

View File

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