1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-05-28 08:41:30 +00:00

fixed z80 debugging; spaceinv shift register

This commit is contained in:
Steven Hugg 2017-01-14 14:16:04 -05:00
parent db4ea08933
commit b1d05bde7c
3 changed files with 19 additions and 6 deletions

View File

@ -165,7 +165,7 @@ a.dropdown-toggle {
-moz-border-radius:6px 0 6px 6px; -moz-border-radius:6px 0 6px 6px;
border-radius:6px 0 6px 6px; border-radius:6px 0 6px 6px;
} }
canvas { canvas.pixelated {
image-rendering: optimizeSpeed; /* Older versions of FF */ image-rendering: optimizeSpeed; /* Older versions of FF */
image-rendering: -moz-crisp-edges; /* FF 6.0+ */ image-rendering: -moz-crisp-edges; /* FF 6.0+ */
image-rendering: -webkit-optimize-contrast; /* Safari */ image-rendering: -webkit-optimize-contrast; /* Safari */

View File

@ -25,6 +25,7 @@ function __createCanvas(mainElement, width, height) {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
canvas.width = width; canvas.width = width;
canvas.height = height; canvas.height = height;
canvas.style.class = "emuvideo";
canvas.style.width = "100%"; canvas.style.width = "100%";
canvas.style.height = "100%"; canvas.style.height = "100%";
canvas.tabIndex = "-1"; // Make it focusable canvas.tabIndex = "-1"; // Make it focusable
@ -40,7 +41,7 @@ var RasterVideo = function(mainElement, width, height, options) {
var imageData, buf8, datau32; var imageData, buf8, datau32;
this.create = function() { this.create = function() {
canvas = __createCanvas(mainElement, width, height); self.canvas = canvas = __createCanvas(mainElement, width, height);
if (options && options.rotate) { if (options && options.rotate) {
canvas.style.transform = "rotate("+options.rotate+"deg)"; canvas.style.transform = "rotate("+options.rotate+"deg)";
} }
@ -333,6 +334,8 @@ function cpuStateToLongString_6502(c) {
+ " Y " + hex(c.Y) + " " + "SP " + hex(c.SP) + "\n"; + " Y " + hex(c.Y) + " " + "SP " + hex(c.SP) + "\n";
} }
////// 6502
var Base6502Platform = function() { var Base6502Platform = function() {
this.getOpcodeMetadata = function(opcode, offset) { this.getOpcodeMetadata = function(opcode, offset) {
@ -358,6 +361,7 @@ var Base6502Platform = function() {
} }
debugClock = 0; debugClock = 0;
debugCondition = debugCond; debugCondition = debugCond;
debugBreakState = null;
this.resume(); this.resume();
} }
this.restartDebugState = function() { this.restartDebugState = function() {
@ -499,6 +503,8 @@ function cpuStateToLongString_Z80(c) {
; ;
} }
////// Z80
var BaseZ80Platform = function() { var BaseZ80Platform = function() {
var onBreakpointHit; var onBreakpointHit;
@ -514,13 +520,14 @@ var BaseZ80Platform = function() {
debugSavedState = this.saveState(); debugSavedState = this.saveState();
} }
debugCondition = debugCond; debugCondition = debugCond;
debugBreakState = null;
this.resume(); this.resume();
} }
this.restartDebugState = function() { this.restartDebugState = function() {
if (debugCondition && !debugBreakState) { if (debugCondition && !debugBreakState && debugTargetClock > 0) {
debugSavedState = this.saveState(); debugSavedState = this.saveState();
debugTargetClock -= debugSavedState.tstates; debugTargetClock -= debugSavedState.c.tstates;
debugSavedState.tstates = 0; debugSavedState.c.tstates = 0;
this.loadState(debugSavedState); this.loadState(debugSavedState);
} }
} }

View File

@ -91,7 +91,7 @@ var SpaceInvadersPlatform = function(mainElement) {
case 2: case 2:
return inputs[addr]; return inputs[addr];
case 3: case 3:
return (bitshift_register << bitshift_offset) & 0xff; return (bitshift_register >> (8-bitshift_offset)) & 0xff;
} }
return 0; return 0;
}, },
@ -124,6 +124,12 @@ var SpaceInvadersPlatform = function(mainElement) {
video = new RasterVideo(mainElement,256,224,{rotate:-90}); video = new RasterVideo(mainElement,256,224,{rotate:-90});
audio = new SampleAudio(cpuFrequency); audio = new SampleAudio(cpuFrequency);
video.create(); video.create();
$(video.canvas).click(function(e) {
var x = Math.floor(e.offsetX * video.canvas.width / $(video.canvas).width());
var y = Math.floor(e.offsetY * video.canvas.height / $(video.canvas).height());
var addr = (x>>3) + (y*32) + 0x400;
console.log(x, y, hex(addr,4), "PC", hex(displayPCs[addr],4));
});
var idata = video.getFrameData(); var idata = video.getFrameData();
video.setKeyboardEvents(function(key,code,flags) { video.setKeyboardEvents(function(key,code,flags) {
var o = KEYCODE_MAP[key]; var o = KEYCODE_MAP[key];