mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-12 18:42:14 +00:00
tigervision debugging; started verilog_bar; astrocade new header
This commit is contained in:
parent
ccd0731b14
commit
00621bdf16
|
@ -66,6 +66,10 @@ TODO:
|
||||||
- debug bankswitching for funky formats
|
- debug bankswitching for funky formats
|
||||||
- "invalid ROM" error should show up better
|
- "invalid ROM" error should show up better
|
||||||
- spaces in filename don't parse code listing (DASM, maybe more)
|
- spaces in filename don't parse code listing (DASM, maybe more)
|
||||||
|
- zmac: item_lookup needs better hash function
|
||||||
|
- 'undefined' for bitmap replacer
|
||||||
|
- astrocade: run to cursor in hello world messes up emulation
|
||||||
|
- requestInterrupt needs to be disabled after breakpoint?
|
||||||
|
|
||||||
|
|
||||||
WEB WORKER FORMAT
|
WEB WORKER FORMAT
|
||||||
|
|
|
@ -149,6 +149,10 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||||
<button id="dbg_bitmap" type="submit" title="Edit Bitmap"><span class="glyphicon glyphicon-camera" aria-hidden="true"></span></button>
|
<button id="dbg_bitmap" type="submit" title="Edit Bitmap"><span class="glyphicon glyphicon-camera" aria-hidden="true"></span></button>
|
||||||
<button id="dbg_record" type="submit" title="Start/Stop Replay Recording" style="display:none"><span class="glyphicon glyphicon-record" aria-hidden="true"></span></button>
|
<button id="dbg_record" type="submit" title="Start/Stop Replay Recording" style="display:none"><span class="glyphicon glyphicon-record" aria-hidden="true"></span></button>
|
||||||
</span>
|
</span>
|
||||||
|
<span id="verilog_bar" style="display:none">
|
||||||
|
<span class="label"><span id="settle_label"></span> evals/clk</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
<span class="dropdown" style="float:right">
|
<span class="dropdown" style="float:right">
|
||||||
<a class="btn btn-secondary dropdown-toggle" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="btn btn-secondary dropdown-toggle" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
GET BOOKS <span class="caret"></span>
|
GET BOOKS <span class="caret"></span>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
|
|
||||||
; Minimal header file for use with Astrocade C programs
|
; Minimal header file for use with Astrocade C programs
|
||||||
|
|
||||||
.area _CODE
|
.area _CODE
|
||||||
|
|
||||||
.byte 0x55 ; ... with the code for a normal menued cartridge
|
jp start ; jump to main()
|
||||||
.word 0x0218 ; Initialize menu
|
start:
|
||||||
.word PrgName ; ... with string at PrgName
|
ld sp,#0x4fce
|
||||||
.word _main ; ... such that selecting the program enters PrgStart
|
jp _main
|
||||||
PrgName: .ascii "8BITWORKSHOP" ; String
|
|
||||||
.byte 0 ; ... which must be followed by 0
|
|
||||||
|
|
12
presets/astrocade/acmenu.s
Normal file
12
presets/astrocade/acmenu.s
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
; Minimal header file for use with Astrocade C programs
|
||||||
|
|
||||||
|
.area _CODE
|
||||||
|
|
||||||
|
.byte 0x55 ; ... with the code for a normal menued cartridge
|
||||||
|
.word 0x0218 ; Initialize menu
|
||||||
|
.word PrgName ; ... with string at PrgName
|
||||||
|
.word _main ; ... such that selecting the program enters PrgStart
|
||||||
|
PrgName:
|
||||||
|
.ascii "8BITWORKSHOP" ; String
|
||||||
|
.byte 0 ; ... which must be followed by 0
|
|
@ -15,7 +15,10 @@ export interface OpcodeMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CpuState {
|
export interface CpuState {
|
||||||
PC:number, T?:number, o?:number,/*opcode*/
|
PC:number;
|
||||||
|
EPC?:number; // effective PC (for bankswitching)
|
||||||
|
T?:number;
|
||||||
|
o?:number;/*opcode*/
|
||||||
SP?:number
|
SP?:number
|
||||||
/*
|
/*
|
||||||
A:number, X:number, Y:number, SP:number, R:boolean,
|
A:number, X:number, Y:number, SP:number, R:boolean,
|
||||||
|
@ -425,7 +428,6 @@ export abstract class BaseZ80Platform extends BaseDebugPlatform {
|
||||||
var targetTstates = cpu.getTstates() + cycles;
|
var targetTstates = cpu.getTstates() + cycles;
|
||||||
if (debugCond) { // || trace) {
|
if (debugCond) { // || trace) {
|
||||||
while (cpu.getTstates() < targetTstates) {
|
while (cpu.getTstates() < targetTstates) {
|
||||||
//_trace(); // TODO
|
|
||||||
if (debugCond && debugCond()) {
|
if (debugCond && debugCond()) {
|
||||||
debugCond = null;
|
debugCond = null;
|
||||||
break;
|
break;
|
||||||
|
@ -437,6 +439,10 @@ export abstract class BaseZ80Platform extends BaseDebugPlatform {
|
||||||
}
|
}
|
||||||
return cpu.getTstates() - targetTstates;
|
return cpu.getTstates() - targetTstates;
|
||||||
}
|
}
|
||||||
|
requestInterrupt(cpu, data) {
|
||||||
|
if (!this.wasBreakpointHit())
|
||||||
|
cpu.requestInterrupt(data);
|
||||||
|
}
|
||||||
postFrame() {
|
postFrame() {
|
||||||
if (this.debugCondition && !this.debugBreakState) {
|
if (this.debugCondition && !this.debugBreakState) {
|
||||||
this.debugSavedState = this.saveState();
|
this.debugSavedState = this.saveState();
|
||||||
|
|
|
@ -86,6 +86,10 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
|
||||||
|
|
||||||
function ramwrite(a:number, v:number) {
|
function ramwrite(a:number, v:number) {
|
||||||
ram.mem[a] = v;
|
ram.mem[a] = v;
|
||||||
|
ramupdate(a, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ramupdate(a:number, v:number) {
|
||||||
var ofs = a*4+3; // 4 pixels per byte
|
var ofs = a*4+3; // 4 pixels per byte
|
||||||
for (var i=0; i<4; i++) {
|
for (var i=0; i<4; i++) {
|
||||||
var lr = ((a % swbytes) >= (horcb & 0x3f)) ? 0 : 4;
|
var lr = ((a % swbytes) >= (horcb & 0x3f)) ? 0 : 4;
|
||||||
|
@ -97,7 +101,7 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
|
||||||
function refreshline(y:number) {
|
function refreshline(y:number) {
|
||||||
var ofs = y*swidth/4;
|
var ofs = y*swidth/4;
|
||||||
for (var i=0; i<swidth/4; i++)
|
for (var i=0; i<swidth/4; i++)
|
||||||
ramwrite(ofs+i, ram.mem[ofs+i]);
|
ramupdate(ofs+i, ram.mem[ofs+i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function magicwrite(a:number, v:number) {
|
function magicwrite(a:number, v:number) {
|
||||||
|
@ -295,9 +299,10 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
|
||||||
|
|
||||||
advance(novideo : boolean) {
|
advance(novideo : boolean) {
|
||||||
for (var sl=0; sl<sheight; sl++) {
|
for (var sl=0; sl<sheight; sl++) {
|
||||||
|
//console.log(sl, hex(cpu.getPC(),4), cpu.saveState());
|
||||||
this.runCPU(cpu, cpuCyclesPerLine);
|
this.runCPU(cpu, cpuCyclesPerLine);
|
||||||
if (sl == inlin && (inmod & 0x8)) {
|
if (sl == inlin && (inmod & 0x8)) {
|
||||||
cpu.requestInterrupt(infbk);
|
this.requestInterrupt(cpu, infbk);
|
||||||
}
|
}
|
||||||
if (refreshlines>0) {
|
if (refreshlines>0) {
|
||||||
refreshline(sl);
|
refreshline(sl);
|
||||||
|
@ -326,7 +331,7 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadState(state) {
|
loadState(state) {
|
||||||
cpu.loadState(state.c);
|
cpu.loadState(state.c); // TODO: this causes problems on reset+debug
|
||||||
ram.mem.set(state.b);
|
ram.mem.set(state.b);
|
||||||
palette.set(state.palette);
|
palette.set(state.palette);
|
||||||
magicop = state.magicop;
|
magicop = state.magicop;
|
||||||
|
@ -339,6 +344,7 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
|
||||||
infbk = state.infbk;
|
infbk = state.infbk;
|
||||||
verbl = state.verbl;
|
verbl = state.verbl;
|
||||||
this.loadControlsState(state);
|
this.loadControlsState(state);
|
||||||
|
refreshall();
|
||||||
}
|
}
|
||||||
saveState() {
|
saveState() {
|
||||||
return {
|
return {
|
||||||
|
@ -408,7 +414,6 @@ class AstrocadeAudio extends AY38910_Audio {
|
||||||
var j = val*2+1;
|
var j = val*2+1;
|
||||||
this.psg.writeRegisterAY(i, j&0xff); // freq lo
|
this.psg.writeRegisterAY(i, j&0xff); // freq lo
|
||||||
this.psg.writeRegisterAY(i+1, (j>>8)&0xff); // freq hi
|
this.psg.writeRegisterAY(i+1, (j>>8)&0xff); // freq hi
|
||||||
console.log(i,j);
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.psg.writeRegisterAY(10, val & 0xf); // tone c vol
|
this.psg.writeRegisterAY(10, val & 0xf); // tone c vol
|
||||||
|
|
|
@ -156,7 +156,10 @@ class VCSPlatform extends BasePlatform {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
fixState(state) {
|
fixState(state) {
|
||||||
state.c.EPC = state.c.PC + (state.ca.bo || 0); // effective PC for ROM
|
var ofs = state.ca.bo || 0;
|
||||||
|
if (state.ca.fo && (state.c.PC & 0xfff) >= 2048)
|
||||||
|
ofs = state.ca.fo; // 3E/3F fixed-slice formats
|
||||||
|
state.c.EPC = state.c.PC + ofs; // ofs = effective PC for ROM
|
||||||
}
|
}
|
||||||
loadState(state) {
|
loadState(state) {
|
||||||
return Javatari.room.console.loadState(state);
|
return Javatari.room.console.loadState(state);
|
||||||
|
@ -216,12 +219,15 @@ class VCSPlatform extends BasePlatform {
|
||||||
}
|
}
|
||||||
getDebugInfo(category, state) {
|
getDebugInfo(category, state) {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case 'CPU': return (state.ca.bo ? ("BankOffset "+hex(state.ca.bo)+"\n"):"") + this.cpuStateToLongString(state.c);
|
case 'CPU': return this.cpuStateToLongString(state.c) + this.bankSwitchStateToString(state);
|
||||||
case 'Stack': return dumpStackToString(this, this.getRAMForState(state), 0x100, 0x1ff, 0x100+state.c.SP, 0x20);
|
case 'Stack': return dumpStackToString(this, this.getRAMForState(state), 0x100, 0x1ff, 0x100+state.c.SP, 0x20);
|
||||||
case 'PIA': return this.ramStateToLongString(state) + "\n" + this.piaStateToLongString(state.p);
|
case 'PIA': return this.ramStateToLongString(state) + "\n" + this.piaStateToLongString(state.p);
|
||||||
case 'TIA': return this.tiaStateToLongString(state.t);
|
case 'TIA': return this.tiaStateToLongString(state.t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bankSwitchStateToString(state) {
|
||||||
|
return (state.ca.bo !== undefined ? ("BankOffset "+hex(state.ca.bo,4)+"\n"):"");
|
||||||
|
}
|
||||||
piaStateToLongString(p) {
|
piaStateToLongString(p) {
|
||||||
return "Timer " + p.t + "/" + p.c + "\nINTIM $" + hex(p.IT,2) + " (" + p.IT + ")\nINSTAT $" + hex(p.IS,2) + "\n";
|
return "Timer " + p.t + "/" + p.c + "\nINTIM $" + hex(p.IT,2) + " (" + p.IT + ")\nINSTAT $" + hex(p.IS,2) + "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ export function VL_RANDOM_I(bits) { return 0 | Math.floor(Math.random() * (1<<bi
|
||||||
abstract class VerilatorBase {
|
abstract class VerilatorBase {
|
||||||
|
|
||||||
totalTicks = 0;
|
totalTicks = 0;
|
||||||
maxVclockLoop = 1;
|
maxVclockLoop = 0;
|
||||||
clk = 0;
|
clk = 0;
|
||||||
reset = 0;
|
reset = 0;
|
||||||
|
|
||||||
|
@ -182,7 +182,11 @@ abstract class VerilatorBase {
|
||||||
}
|
}
|
||||||
if (__VclockLoop > this.maxVclockLoop) {
|
if (__VclockLoop > this.maxVclockLoop) {
|
||||||
this.maxVclockLoop = __VclockLoop;
|
this.maxVclockLoop = __VclockLoop;
|
||||||
|
if (this.maxVclockLoop > 1) {
|
||||||
console.log("Graph took " + this.maxVclockLoop + " iterations to stabilize");
|
console.log("Graph took " + this.maxVclockLoop + " iterations to stabilize");
|
||||||
|
$("#verilog_bar").show();
|
||||||
|
$("#settle_label").text(this.maxVclockLoop+"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.totalTicks++;
|
this.totalTicks++;
|
||||||
}
|
}
|
||||||
|
@ -666,6 +670,7 @@ var VerilogPlatform = function(mainElement, options) {
|
||||||
trace_index = 0;
|
trace_index = 0;
|
||||||
if (trace_buffer) trace_buffer.fill(0);
|
if (trace_buffer) trace_buffer.fill(0);
|
||||||
if (video) video.setRotate(gen.rotate ? -90 : 0);
|
if (video) video.setRotate(gen.rotate ? -90 : 0);
|
||||||
|
$("#verilog_bar").hide();
|
||||||
}
|
}
|
||||||
tick() {
|
tick() {
|
||||||
gen.tick2();
|
gen.tick2();
|
||||||
|
|
11
src/ui.ts
11
src/ui.ts
|
@ -224,8 +224,12 @@ function getSkeletonFile(fileid:string, callback) {
|
||||||
|
|
||||||
function _createNewFile(e) {
|
function _createNewFile(e) {
|
||||||
// TODO: support spaces
|
// TODO: support spaces
|
||||||
var filename = prompt("Create New File (no spaces)", "newfile" + platform.getDefaultExtension());
|
var filename = prompt("Create New File", "newfile" + platform.getDefaultExtension());
|
||||||
if (filename && filename.length) {
|
if (filename && filename.length) {
|
||||||
|
if (filename.indexOf(" ") >= 0) {
|
||||||
|
alert("No spaces, please.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (filename.indexOf(".") < 0) {
|
if (filename.indexOf(".") < 0) {
|
||||||
filename += platform.getDefaultExtension();
|
filename += platform.getDefaultExtension();
|
||||||
}
|
}
|
||||||
|
@ -828,8 +832,9 @@ function setupDebugControls(){
|
||||||
$("#dbg_reset").click(resetAndDebug);
|
$("#dbg_reset").click(resetAndDebug);
|
||||||
$("#dbg_pause").click(pause);
|
$("#dbg_pause").click(pause);
|
||||||
$("#dbg_go").click(resume);
|
$("#dbg_go").click(resume);
|
||||||
Mousetrap.bindGlobal('ctrl+alt+p', togglePause);
|
Mousetrap.bindGlobal('ctrl+alt+p', pause);
|
||||||
Mousetrap.bindGlobal('ctrl+alt+r', resetAndDebug);
|
Mousetrap.bindGlobal('ctrl+alt+r', resume);
|
||||||
|
Mousetrap.bindGlobal('ctrl+alt+.', resetAndDebug);
|
||||||
|
|
||||||
if (platform.step) {
|
if (platform.step) {
|
||||||
$("#dbg_step").click(singleStep).show();
|
$("#dbg_step").click(singleStep).show();
|
||||||
|
|
|
@ -39,6 +39,7 @@ var _galaxian = require('gen/platform/galaxian.js');
|
||||||
var _vector = require('gen/platform/vector.js');
|
var _vector = require('gen/platform/vector.js');
|
||||||
var _williams = require('gen/platform/williams.js');
|
var _williams = require('gen/platform/williams.js');
|
||||||
var _sound_williams = require('gen/platform/sound_williams.js');
|
var _sound_williams = require('gen/platform/sound_williams.js');
|
||||||
|
var _astrocade = require('gen/platform/astrocade.js');
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -211,6 +212,14 @@ describe('Platform Replay', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
it('Should run astrocade', () => {
|
||||||
|
var platform = testPlatform('astrocade', 'cosmic.c.rom', 92, (platform, frameno) => {
|
||||||
|
if (frameno == 62) {
|
||||||
|
keycallback(Keys.VK_SPACE.c, Keys.VK_SPACE.c, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
test/roms/astrocade/cosmic.c.rom
Normal file
BIN
test/roms/astrocade/cosmic.c.rom
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user