diff --git a/index.html b/index.html
index bf00a0ab..b8a4f792 100644
--- a/index.html
+++ b/index.html
@@ -165,7 +165,7 @@ a.dropdown-toggle {
-moz-border-radius:6px 0 6px 6px;
border-radius:6px 0 6px 6px;
}
-canvas {
+canvas.pixelated {
image-rendering: optimizeSpeed; /* Older versions of FF */
image-rendering: -moz-crisp-edges; /* FF 6.0+ */
image-rendering: -webkit-optimize-contrast; /* Safari */
diff --git a/src/emu.js b/src/emu.js
index 028de4b1..8c32cd50 100644
--- a/src/emu.js
+++ b/src/emu.js
@@ -25,6 +25,7 @@ function __createCanvas(mainElement, width, height) {
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
+ canvas.style.class = "emuvideo";
canvas.style.width = "100%";
canvas.style.height = "100%";
canvas.tabIndex = "-1"; // Make it focusable
@@ -40,7 +41,7 @@ var RasterVideo = function(mainElement, width, height, options) {
var imageData, buf8, datau32;
this.create = function() {
- canvas = __createCanvas(mainElement, width, height);
+ self.canvas = canvas = __createCanvas(mainElement, width, height);
if (options && options.rotate) {
canvas.style.transform = "rotate("+options.rotate+"deg)";
}
@@ -333,6 +334,8 @@ function cpuStateToLongString_6502(c) {
+ " Y " + hex(c.Y) + " " + "SP " + hex(c.SP) + "\n";
}
+////// 6502
+
var Base6502Platform = function() {
this.getOpcodeMetadata = function(opcode, offset) {
@@ -358,6 +361,7 @@ var Base6502Platform = function() {
}
debugClock = 0;
debugCondition = debugCond;
+ debugBreakState = null;
this.resume();
}
this.restartDebugState = function() {
@@ -499,6 +503,8 @@ function cpuStateToLongString_Z80(c) {
;
}
+////// Z80
+
var BaseZ80Platform = function() {
var onBreakpointHit;
@@ -514,13 +520,14 @@ var BaseZ80Platform = function() {
debugSavedState = this.saveState();
}
debugCondition = debugCond;
+ debugBreakState = null;
this.resume();
}
this.restartDebugState = function() {
- if (debugCondition && !debugBreakState) {
+ if (debugCondition && !debugBreakState && debugTargetClock > 0) {
debugSavedState = this.saveState();
- debugTargetClock -= debugSavedState.tstates;
- debugSavedState.tstates = 0;
+ debugTargetClock -= debugSavedState.c.tstates;
+ debugSavedState.c.tstates = 0;
this.loadState(debugSavedState);
}
}
diff --git a/src/platform/spaceinv.js b/src/platform/spaceinv.js
index 69d458e5..fefb3acb 100644
--- a/src/platform/spaceinv.js
+++ b/src/platform/spaceinv.js
@@ -91,7 +91,7 @@ var SpaceInvadersPlatform = function(mainElement) {
case 2:
return inputs[addr];
case 3:
- return (bitshift_register << bitshift_offset) & 0xff;
+ return (bitshift_register >> (8-bitshift_offset)) & 0xff;
}
return 0;
},
@@ -124,6 +124,12 @@ var SpaceInvadersPlatform = function(mainElement) {
video = new RasterVideo(mainElement,256,224,{rotate:-90});
audio = new SampleAudio(cpuFrequency);
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();
video.setKeyboardEvents(function(key,code,flags) {
var o = KEYCODE_MAP[key];