diff --git a/Gruntfile.js b/Gruntfile.js index 04f55b1c6..180fc0862 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -118,6 +118,7 @@ module.exports = function(grunt) { * @property {string} version * @property {Array.} c1pJSFiles * @property {Array.} pcJSFiles + * @property {Array.} pc8080Files * @property {Array.} closureCompilerExterns */ var pkg = grunt.file.readJSON("package.json"); @@ -166,7 +167,7 @@ module.exports = function(grunt) { dest: "./versions/pcjs/" + pkg.version + "/pc-dbg.js" }, "pc8080.js": { - src: pkg.pcJSFiles, + src: pkg.pc8080Files, dest: "./versions/pc8080/" + pkg.version + "/pc8080.js", options: { process: function(src, filepath) { @@ -175,7 +176,7 @@ module.exports = function(grunt) { } }, "pc8080-dbg.js": { - src: pkg.pcJSFiles, + src: pkg.pc8080Files, dest: "./versions/pc8080/" + pkg.version + "/pc8080-dbg.js" }, "tmp-c1pjs": { @@ -574,7 +575,7 @@ module.exports = function(grunt) { grunt.loadTasks("modules/grunts/prepjs/tasks"); - grunt.registerTask("preCompiler", grunt.option("rebuild")? ["concat:tmp-c1pjs", "concat:tmp-pcjs"] : ["newer:concat:tmp-c1pjs", "newer:concat:tmp-pcjs"]); + grunt.registerTask("preCompiler", grunt.option("rebuild")? ["concat:tmp-c1pjs", "concat:tmp-pcjs", "concat:tmp-pc8080"] : ["newer:concat:tmp-c1pjs", "newer:concat:tmp-pcjs", "newer:concat:tmp-pc8080"]); grunt.registerTask("compile", ["preCompiler", "closureCompiler", "replace:fix-source-maps"]); diff --git a/devices/pc8080/machine/invaders/machine.xml b/devices/pc8080/machine/invaders/machine.xml new file mode 100644 index 000000000..9d9a28b6d --- /dev/null +++ b/devices/pc8080/machine/invaders/machine.xml @@ -0,0 +1,16 @@ + + + + Space Invaders + + + + + + + + Run + Reset + + diff --git a/devices/pc8080/rom/invaders/INVADERS-E.json b/devices/pc8080/rom/invaders/INVADERS-E.json new file mode 100644 index 000000000..1352517dd --- /dev/null +++ b/devices/pc8080/rom/invaders/INVADERS-E.json @@ -0,0 +1,130 @@ +{"bytes":[ +32,195,201,22,33,132,32,126,167,202,7,7,35,126,167,192, +6,1,195,250,24,33,16,40,17,163,28,14,21,205,243,8, +62,10,50,108,32,1,190,29,205,86,24,218,55,24,205,68, +24,195,40,24,205,177,10,1,207,29,205,86,24,216,205,76, +24,195,58,24,197,6,16,205,57,20,193,201,197,58,108,32, +79,205,147,10,193,201,10,254,255,55,200,111,3,10,103,3, +10,95,3,10,87,3,167,201,33,194,32,52,35,78,205,217, +1,71,58,202,32,184,202,152,24,58,194,32,230,4,42,204, +32,194,136,24,17,48,0,25,34,199,32,33,197,32,205,59, +26,235,195,211,21,0,0,0,62,1,50,203,32,201,33,80, +32,17,192,27,6,16,205,50,26,62,2,50,128,32,62,255, +50,126,32,62,4,50,193,32,58,85,32,230,1,202,184,24, +58,85,32,230,1,194,192,24,33,17,51,62,38,0,205,255, +8,195,182,10,49,0,36,6,0,205,230,1,205,86,25,62, +8,50,207,32,195,234,10,58,103,32,33,231,32,15,208,35, +201,6,2,58,130,32,61,192,4,201,58,148,32,176,50,148, +32,211,3,201,33,0,34,195,195,1,205,216,20,195,151,21, +33,231,32,58,103,32,15,216,35,201,14,28,33,30,36,17, +228,26,195,243,8,33,248,32,195,49,25,33,252,32,195,49, +25,94,35,86,35,126,35,102,111,195,173,9,14,7,33,1, +53,17,169,31,195,243,8,58,235,32,33,1,60,195,178,9, +33,244,32,195,49,25,205,92,26,205,26,25,205,37,25,205, +43,25,205,80,25,205,60,25,195,71,25,205,220,25,195,113, +22,62,1,50,109,32,195,230,22,205,215,25,205,71,25,195, +60,25,50,193,32,201,139,25,195,214,9,33,3,40,17,190, +25,14,19,195,243,8,0,0,0,0,58,30,32,167,194,172, +25,219,1,230,118,214,114,192,60,50,30,32,219,1,230,118, +254,52,192,33,27,46,17,247,11,14,9,195,243,8,40,19, +0,8,19,14,38,2,14,17,15,14,17,0,19,8,14,13, +40,62,1,50,233,32,201,175,195,211,25,0,58,148,32,160, +50,148,32,211,3,201,33,1,39,202,250,25,17,96,28,6, +16,79,205,57,20,121,61,194,236,25,6,16,205,203,20,124, +254,53,194,250,25,201,33,114,32,70,26,230,128,168,192,55, +201,50,43,36,28,22,17,13,10,8,7,6,5,4,3,2, +1,52,46,39,34,28,24,21,19,16,14,13,12,11,9,7, +5,255,26,119,35,19,5,194,50,26,201,94,35,86,35,126, +35,78,35,70,97,111,201,197,6,3,124,31,103,125,31,111, +5,194,74,26,124,230,63,246,32,103,193,201,33,0,36,54, +0,35,124,254,64,194,95,26,201,197,229,26,182,119,19,35, +13,194,107,26,225,1,32,0,9,193,5,194,105,26,201,205, +46,9,167,200,245,61,119,205,230,25,241,33,1,37,230,15, +195,197,9,0,0,0,0,255,184,254,32,28,16,158,0,32, +28,48,16,11,8,7,6,0,12,4,38,14,21,4,17,38, +38,15,11,0,24,4,17,36,38,37,27,38,14,17,38,28, +15,11,0,24,4,17,18,38,1,20,19,19,14,13,38,14, +13,11,24,38,27,15,11,0,24,4,17,38,38,1,20,19, +19,14,13,38,38,18,2,14,17,4,36,27,37,38,7,8, +63,18,2,14,17,4,38,18,2,14,17,4,36,28,37,38, +1,0,0,16,0,0,0,0,2,120,56,120,56,0,248,0, +0,128,0,142,2,255,5,12,96,28,32,48,16,1,0,0, +0,0,0,187,3,0,16,144,28,40,48,1,4,0,255,255, +0,0,2,118,4,0,0,0,0,0,4,238,28,0,0,3, +0,0,0,182,4,0,0,1,0,29,4,226,28,0,0,3, +0,0,0,130,6,0,0,1,6,29,4,208,28,0,0,3, +255,0,192,28,0,0,16,33,1,0,48,0,18,0,0,0, +15,11,0,24,38,15,11,0,24,4,17,36,27,37,252,0, +1,255,255,0,0,0,32,100,29,208,41,24,2,84,29,0, +8,0,6,0,0,1,64,0,1,0,0,16,158,0,32,28, +0,3,4,120,20,19,8,26,61,104,252,252,104,61,26,0, +0,0,1,184,152,160,27,16,255,0,160,27,0,0,0,0, +0,16,0,14,5,0,0,0,0,0,7,208,28,200,155,3, +0,0,3,4,120,20,11,25,58,109,250,250,109,58,25,0, +0,0,0,0,0,0,0,0,0,1,0,0,1,116,31,0, +128,0,0,0,0,0,28,47,0,0,28,39,0,0,28,57, +0,0,57,121,122,110,236,250,250,236,110,122,121,57,0,0, +0,0,0,120,29,190,108,60,60,60,108,190,29,120,0,0, +0,0,0,0,25,58,109,250,250,109,58,25,0,0,0,0, +0,0,56,122,127,109,236,250,250,236,109,127,122,56,0,0, +0,0,0,14,24,190,109,61,60,61,109,190,24,14,0,0, +0,0,0,0,26,61,104,252,252,104,61,26,0,0,0,0, +0,0,15,31,31,31,31,127,255,127,31,31,31,31,15,0, +0,4,1,19,3,7,179,15,47,3,47,73,4,3,0,1, +64,8,5,163,10,3,91,15,39,39,11,75,64,132,17,72, +15,153,60,126,61,188,62,124,153,39,27,26,38,15,14,8, +13,19,18,40,18,2,14,17,4,38,0,3,21,0,13,2, +4,38,19,0,1,11,4,40,2,16,32,48,19,8,11,19, +0,8,73,34,20,129,66,0,66,129,20,34,73,8,0,0, +68,170,16,136,84,34,16,170,68,34,84,136,74,21,190,63, +94,37,4,252,4,16,252,16,32,252,32,128,252,128,0,254, +0,36,254,18,0,254,0,72,254,144,15,11,0,41,0,0, +1,7,1,1,1,4,11,1,6,3,1,1,11,9,2,8, +2,11,4,7,10,5,2,5,4,6,7,8,10,6,10,3, +255,15,255,31,255,63,255,127,255,255,252,255,248,255,240,255, +240,255,240,255,240,255,240,255,240,255,240,255,248,255,252,255, +255,255,255,255,255,127,255,63,255,31,255,15,5,16,21,48, +148,151,154,157,16,5,5,16,21,16,16,5,48,16,16,16, +5,21,16,5,0,0,0,0,4,12,30,55,62,124,116,126, +126,116,124,62,55,30,12,4,0,0,0,0,0,34,0,165, +64,8,152,61,182,60,54,29,16,72,98,182,29,152,8,66, +144,8,0,0,38,31,26,27,26,26,27,31,26,29,26,26, +16,32,48,96,80,72,72,72,64,64,64,15,11,0,24,18, +15,0,2,4,38,38,8,13,21,0,3,4,17,18,14,44, +104,29,12,44,32,28,10,44,64,28,8,44,0,28,255,14, +46,224,29,12,46,234,29,10,46,244,29,8,46,153,28,255, +39,56,38,12,24,18,19,4,17,24,39,29,26,38,15,14, +8,13,19,18,39,28,26,38,15,14,8,13,19,18,0,0, +0,31,36,68,36,31,0,0,0,127,73,73,73,54,0,0, +0,62,65,65,65,34,0,0,0,127,65,65,65,62,0,0, +0,127,73,73,73,65,0,0,0,127,72,72,72,64,0,0, +0,62,65,65,69,71,0,0,0,127,8,8,8,127,0,0, +0,0,65,127,65,0,0,0,0,2,1,1,1,126,0,0, +0,127,8,20,34,65,0,0,0,127,1,1,1,1,0,0, +0,127,32,24,32,127,0,0,0,127,16,8,4,127,0,0, +0,62,65,65,65,62,0,0,0,127,72,72,72,48,0,0, +0,62,65,69,66,61,0,0,0,127,72,76,74,49,0,0, +0,50,73,73,73,38,0,0,0,64,64,127,64,64,0,0, +0,126,1,1,1,126,0,0,0,124,2,1,2,124,0,0, +0,127,2,12,2,127,0,0,0,99,20,8,20,99,0,0, +0,96,16,15,16,96,0,0,0,67,69,73,81,97,0,0, +0,62,69,73,81,62,0,0,0,0,33,127,1,0,0,0, +0,35,69,73,73,49,0,0,0,66,65,73,89,102,0,0, +0,12,20,36,127,4,0,0,0,114,81,81,81,78,0,0, +0,30,41,73,73,70,0,0,0,64,71,72,80,96,0,0, +0,54,73,73,73,54,0,0,0,49,73,73,74,60,0,0, +0,8,20,34,65,0,0,0,0,0,65,34,20,8,0,0, +0,0,0,0,0,0,0,0,0,20,20,20,20,20,0,0, +0,34,20,127,20,34,0,0,0,3,4,120,4,3,0,0, +36,27,38,14,17,38,28,38,15,11,0,24,4,17,18,37, +38,38,40,27,38,15,11,0,24,4,17,38,38,27,38,2, +14,8,13,38,1,1,0,0,1,0,2,1,0,2,1,0, +96,16,15,16,96,48,24,26,61,104,252,252,104,61,26,0, +8,13,18,4,17,19,38,38,2,14,8,13,13,42,80,31, +10,42,98,31,7,42,225,31,255,2,17,4,3,8,19,38, +0,96,16,15,16,96,56,25,58,109,250,250,109,58,25,0, +0,32,64,77,80,32,0,0,0,0,0,255,184,255,128,31, +16,151,0,128,31,0,0,1,208,34,32,28,16,148,0,32, +28,40,28,38,15,11,0,24,4,17,18,38,28,38,2,14, +8,13,18,15,20,18,7,38,0,8,8,8,8,8,0,0] +} \ No newline at end of file diff --git a/devices/pc8080/rom/invaders/INVADERS-F.json b/devices/pc8080/rom/invaders/INVADERS-F.json new file mode 100644 index 000000000..18fd3f287 --- /dev/null +++ b/devices/pc8080/rom/invaders/INVADERS-F.json @@ -0,0 +1,130 @@ +{"bytes":[ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,205,116,20,0,197,229,26,211,4,219,3,182,119,35,19, +175,211,4,219,3,182,119,225,1,32,0,9,193,5,194,5, +20,201,0,0,205,116,20,197,229,175,119,35,119,35,225,1, +32,0,9,193,5,194,39,20,201,197,26,119,19,1,32,0, +9,193,5,194,57,20,201,0,0,0,0,0,0,0,0,0, +0,0,205,116,20,197,229,26,211,4,219,3,47,166,119,35, +19,175,211,4,219,3,47,166,119,225,1,32,0,9,193,5, +194,85,20,201,125,230,7,211,2,195,71,26,197,229,126,18, +19,35,13,194,126,20,225,1,32,0,9,193,5,194,124,20, +201,205,116,20,175,50,97,32,197,229,26,211,4,219,3,245, +166,202,169,20,62,1,50,97,32,241,182,119,35,19,175,211, +4,219,3,245,166,202,189,20,62,1,50,97,32,241,182,119, +225,1,32,0,9,193,5,194,152,20,201,175,197,119,1,32, +0,9,193,5,194,204,20,201,58,37,32,254,5,200,254,2, +192,58,41,32,254,216,71,210,48,21,58,2,32,167,200,120, +254,206,210,121,21,198,6,71,58,9,32,254,144,210,4,21, +184,210,48,21,104,205,98,21,58,42,32,103,205,111,21,34, +100,32,62,5,50,37,32,205,129,21,126,167,202,48,21,54, +0,205,95,10,205,59,26,205,211,21,62,16,50,3,32,201, +62,3,50,37,32,195,74,21,33,3,32,53,192,42,100,32, +6,16,205,36,20,62,4,50,37,32,175,50,2,32,6,247, +195,220,25,0,14,0,188,212,144,21,188,208,198,16,12,195, +90,21,58,9,32,101,205,84,21,65,5,222,16,111,201,58, +10,32,205,84,21,222,16,103,201,62,1,50,133,32,195,69, +21,120,7,7,7,128,128,128,129,61,111,58,103,32,103,201, +12,198,16,250,144,21,201,58,13,32,167,194,183,21,33,164, +62,205,197,21,208,6,254,62,1,50,13,32,120,50,8,32, +58,14,32,50,7,32,201,33,36,37,205,197,21,208,205,241, +24,175,195,169,21,6,23,126,167,194,107,22,35,5,194,199, +21,201,0,205,116,20,229,197,229,26,211,4,219,3,119,35, +19,175,211,4,219,3,119,225,1,32,0,9,193,5,194,215, +21,225,201,205,17,22,1,0,55,126,167,202,255,21,12,35, +5,194,249,21,121,50,130,32,254,1,192,33,107,32,54,1, +201,46,0,58,103,32,103,201,58,21,32,254,255,192,33,16, +32,126,35,70,176,192,58,37,32,167,192,58,239,32,167,202, +82,22,58,45,32,167,194,72,22,205,192,23,230,16,200,62, +1,50,37,32,50,45,32,201,205,192,23,230,16,192,50,45, +32,201,33,37,32,54,1,42,237,32,35,125,254,126,218,99, +22,46,116,34,237,32,126,50,29,32,201,55,201,175,205,139, +26,205,16,25,54,0,205,202,9,35,17,245,32,26,190,27, +43,26,202,139,22,210,152,22,195,143,22,190,210,152,22,126, +18,19,35,126,18,205,80,25,58,206,32,167,202,201,22,33, +3,40,17,166,26,14,20,205,147,10,37,37,6,27,58,103, +32,15,218,183,22,6,28,120,205,255,8,205,177,10,205,231, +24,126,167,202,201,22,195,237,2,33,24,45,17,166,26,14, +10,205,147,10,205,182,10,205,214,9,175,50,239,32,211,5, +205,209,25,195,137,11,49,0,36,251,175,50,21,32,205,216, +20,6,4,205,250,24,205,89,10,194,238,22,205,215,25,33, +1,39,205,250,25,175,205,139,26,6,251,195,107,25,205,202, +9,35,126,17,184,28,33,161,26,14,4,71,26,184,210,39, +23,35,19,13,194,28,23,126,50,207,32,201,58,37,32,254, +0,194,57,23,6,253,195,220,25,6,2,195,250,24,0,0, +33,155,32,53,204,109,23,58,104,32,167,202,109,23,33,150, +32,53,192,33,152,32,126,211,5,58,130,32,167,202,109,23, +43,126,43,119,43,54,1,62,4,50,155,32,201,58,152,32, +230,48,211,5,201,58,149,32,167,202,170,23,33,17,26,17, +33,26,58,130,32,190,210,142,23,35,19,195,133,23,26,50, +151,32,33,152,32,126,230,48,71,126,230,15,7,254,16,194, +164,23,62,1,176,119,175,50,149,32,33,153,32,53,192,6, +239,195,220,25,6,239,33,152,32,126,160,119,211,5,201,0, +58,103,32,15,210,202,23,219,1,201,219,2,201,219,2,230, +4,200,58,154,32,167,192,49,0,36,6,4,205,214,9,5, +194,220,23,62,1,50,154,32,205,215,25,251,17,188,28,33, +22,48,14,4,205,147,10,205,177,10,175,50,154,32,50,147] +} \ No newline at end of file diff --git a/devices/pc8080/rom/invaders/INVADERS-G.json b/devices/pc8080/rom/invaders/INVADERS-G.json new file mode 100644 index 000000000..71c26291e --- /dev/null +++ b/devices/pc8080/rom/invaders/INVADERS-G.json @@ -0,0 +1,130 @@ +{"bytes":[ +175,50,193,32,205,207,1,58,103,32,15,218,114,8,205,19, +2,205,207,1,205,177,0,205,209,25,6,32,205,250,24,205, +24,22,205,10,25,205,243,21,205,136,9,58,130,32,167,202, +239,9,205,14,23,205,53,9,205,216,8,205,44,23,205,89, +10,202,73,8,6,4,205,250,24,205,117,23,211,6,205,4, +24,195,31,8,0,0,0,17,186,26,205,243,8,6,152,219, +1,15,15,218,109,8,15,218,152,7,195,127,7,62,1,195, +155,7,205,26,2,195,20,8,58,8,32,71,42,9,32,235, +195,134,8,0,0,0,58,103,32,103,46,252,201,33,17,43, +17,112,27,14,14,205,243,8,58,103,32,15,62,28,33,17, +55,212,255,8,62,176,50,192,32,58,192,32,167,200,230,4, +194,188,8,205,202,9,205,49,25,195,169,8,6,32,33,28, +39,58,103,32,15,218,203,8,33,28,57,205,203,20,195,169, +8,219,2,230,3,198,3,201,58,130,32,254,9,208,62,251, +50,126,32,201,58,206,32,167,192,33,28,57,6,32,195,203, +20,14,3,26,213,205,255,8,209,19,13,194,243,8,201,17, +0,30,229,38,0,111,41,41,41,25,235,225,6,8,211,6, +195,57,20,58,9,32,254,120,208,42,145,32,125,180,194,41, +9,33,0,6,62,1,50,131,32,43,34,145,32,201,205,17, +22,46,255,126,201,205,16,25,43,43,126,167,200,6,21,219, +2,230,8,202,72,9,6,16,205,202,9,35,126,184,216,205, +46,9,52,126,245,33,1,37,36,36,61,194,88,9,6,16, +17,96,28,205,57,20,241,60,205,139,26,205,16,25,43,43, +54,0,62,255,50,153,32,6,16,195,250,24,33,160,29,254, +2,216,35,254,4,216,35,201,205,202,9,58,241,32,167,200, +175,50,241,32,229,42,242,32,235,225,126,131,39,119,95,35, +126,138,39,119,87,35,126,35,102,111,195,173,9,122,205,178, +9,123,213,245,15,15,15,15,230,15,205,197,9,241,230,15, +205,197,9,209,201,198,26,195,255,8,58,103,32,15,33,248, +32,216,33,252,32,201,33,2,36,54,0,35,125,230,31,254, +28,218,232,9,17,6,0,25,124,254,64,218,217,9,201,205, +60,10,175,50,233,32,205,214,9,58,103,32,245,205,228,1, +241,50,103,32,58,103,32,103,229,46,254,126,230,7,60,119, +33,162,29,35,61,194,19,10,126,225,46,252,119,35,54,56, +124,15,218,51,10,62,33,50,152,32,205,245,1,205,4,25, +195,4,8,205,239,1,205,192,1,195,4,8,205,89,10,194, +82,10,62,48,50,192,32,58,192,32,167,200,205,89,10,202, +71,10,205,89,10,194,82,10,201,58,21,32,254,255,201,58, +239,32,167,202,124,10,72,6,8,205,250,24,65,120,205,124, +9,126,33,243,32,54,0,43,119,43,54,1,33,98,32,201, +62,2,50,193,32,211,6,58,203,32,167,202,133,10,175,50, +193,32,201,213,26,205,255,8,209,62,7,50,192,32,58,192, +32,61,194,158,10,19,13,194,147,10,201,33,80,32,195,75, +2,62,64,195,215,10,62,128,195,215,10,225,195,114,0,58, +193,32,15,218,187,10,15,218,104,24,15,218,171,10,201,33, +20,43,14,15,195,147,10,50,192,32,58,192,32,167,194,218, +10,201,33,194,32,6,12,195,50,26,175,211,3,211,5,205, +130,25,251,205,177,10,58,236,32,167,33,23,48,14,4,194, +232,11,17,250,28,205,147,10,17,175,29,205,207,10,205,177, +10,205,21,24,205,182,10,58,236,32,167,194,74,11,17,149, +26,205,226,10,205,128,10,17,176,27,205,226,10,205,128,10, +205,177,10,17,201,31,205,226,10,205,128,10,205,177,10,33, +183,51,6,10,205,203,20,205,182,10,205,214,9,58,255,33, +167,194,93,11,205,209,8,50,255,33,205,127,26,205,228,1, +205,192,1,205,239,1,205,26,2,62,1,50,193,32,205,207, +1,205,24,22,205,241,11,211,6,205,89,10,202,113,11,175, +50,37,32,205,89,10,194,131,11,175,50,193,32,205,177,10, +205,136,25,14,12,33,17,44,17,144,31,205,243,8,58,236, +32,254,0,194,174,11,33,17,51,62,2,205,255,8,1,156, +31,205,86,24,205,76,24,219,2,7,218,195,11,1,160,31, +205,58,24,205,182,10,58,236,32,254,0,194,218,11,17,213, +31,205,226,10,205,128,10,205,158,24,33,236,32,126,60,230, +1,119,205,214,9,195,223,24,17,171,29,205,147,10,195,11, +11,205,10,25,195,154,25,19,0,8,19,14,38,2,14,15, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] +} \ No newline at end of file diff --git a/devices/pc8080/rom/invaders/INVADERS-H.json b/devices/pc8080/rom/invaders/INVADERS-H.json new file mode 100644 index 000000000..ea669f7bd --- /dev/null +++ b/devices/pc8080/rom/invaders/INVADERS-H.json @@ -0,0 +1,130 @@ +{"bytes":[ +0,0,0,195,212,24,0,0,245,197,213,229,195,140,0,0, +245,197,213,229,62,128,50,114,32,33,192,32,53,205,205,23, +219,1,15,218,103,0,58,234,32,167,202,66,0,58,235,32, +254,153,202,62,0,198,1,39,50,235,32,205,71,25,175,50, +234,32,58,233,32,167,202,130,0,58,239,32,167,194,111,0, +58,235,32,167,194,93,0,205,191,10,195,130,0,58,147,32, +167,194,130,0,195,101,7,62,1,50,234,32,195,63,0,205, +64,23,58,50,32,50,128,32,205,0,1,205,72,2,205,19, +9,0,225,209,193,241,251,201,0,0,0,0,175,50,114,32, +58,233,32,167,202,130,0,58,239,32,167,194,165,0,58,193, +32,15,210,130,0,33,32,32,205,75,2,205,65,1,195,130, +0,205,134,8,229,126,35,102,111,34,9,32,34,11,32,225, +43,126,254,3,194,200,0,61,50,8,32,254,254,62,0,194, +211,0,60,50,13,32,201,62,2,50,251,33,50,251,34,195, +228,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +33,2,32,126,167,194,56,21,229,58,6,32,111,58,103,32, +103,126,167,225,202,54,1,35,35,126,35,70,230,254,7,7, +7,95,22,0,33,0,28,25,235,120,167,196,59,1,42,11, +32,6,16,205,211,21,175,50,0,32,201,33,48,0,25,235, +201,58,104,32,167,200,58,0,32,167,192,58,103,32,103,58, +6,32,22,2,60,254,55,204,161,1,111,70,5,194,84,1, +50,6,32,205,122,1,97,34,11,32,125,254,40,218,113,25, +122,50,4,32,62,1,50,0,32,201,22,0,125,33,9,32, +70,35,78,254,11,250,148,1,222,11,95,120,198,16,71,123, +20,195,131,1,104,167,200,95,121,198,16,79,123,61,195,149, +1,21,202,205,1,33,6,32,54,0,35,78,54,0,205,217, +1,33,5,32,126,60,230,1,119,175,33,103,32,102,201,0, +33,0,33,6,55,54,1,35,5,194,197,1,201,225,201,62, +1,6,224,33,2,36,195,204,20,35,70,35,121,134,119,35, +120,134,119,201,6,192,17,0,27,33,0,32,195,50,26,33, +66,33,195,248,1,33,66,34,14,4,17,32,29,213,6,44, +205,50,26,209,13,194,253,1,201,62,1,195,27,2,62,1, +195,20,2,175,17,66,34,195,30,2,175,17,66,33,50,129, +32,1,2,22,33,6,40,62,4,245,197,58,129,32,167,194, +66,2,205,105,26,193,241,61,200,213,17,224,2,25,209,195, +41,2,205,124,20,195,53,2,33,16,32,126,254,255,200,254, +254,202,129,2,35,70,79,176,121,194,119,2,35,126,167,194, +136,2,35,94,35,86,229,235,229,33,111,2,227,213,233,225, +17,12,0,25,195,75,2,5,4,194,125,2,61,5,112,43, +119,17,16,0,25,195,75,2,53,43,43,195,129,2,225,35, +126,254,255,202,59,3,35,53,192,71,175,50,104,32,50,105, +32,62,48,50,106,32,120,54,5,35,53,194,155,3,42,26, +32,6,16,205,36,20,33,16,32,17,16,27,6,16,205,50, +26,6,0,205,220,25,58,109,32,167,192,58,239,32,167,200, +49,0,36,251,205,215,25,205,46,9,167,202,109,22,205,231, +24,126,167,202,44,3,58,206,32,167,202,44,3,58,103,32, +245,15,218,50,3,205,14,2,205,120,8,115,35,114,43,43, +112,0,205,228,1,241,15,62,33,6,0,210,18,3,6,32, +62,34,50,103,32,205,182,10,175,50,17,32,120,211,5,60, +50,152,32,205,214,9,205,127,26,195,249,7,205,127,26,195, +23,8,205,9,2,195,248,2,0,0,0,33,104,32,54,1, +35,126,167,195,176,3,0,43,54,1,58,27,32,71,58,239, +32,167,194,99,3,58,29,32,15,218,129,3,15,218,142,3, +195,111,3,205,192,23,7,7,218,129,3,7,218,142,3,33, +24,32,205,59,26,205,71,26,205,57,20,62,0,50,18,32, +201,120,254,217,202,111,3,60,50,27,32,195,111,3,120,254, +48,202,111,3,61,50,27,32,195,111,3,60,230,1,50,21, +32,7,7,7,7,33,112,28,133,111,34,24,32,195,111,3, +194,74,3,35,53,194,74,3,195,70,3,17,42,32,205,6, +26,225,208,35,126,167,200,254,1,202,250,3,254,2,202,10, +4,35,254,3,194,42,4,53,202,54,4,126,254,15,192,229, +205,48,4,205,82,20,225,35,52,35,35,53,53,35,53,53, +53,35,54,8,205,48,4,195,0,20,60,119,58,27,32,198, +8,50,42,32,205,48,4,195,0,20,205,48,4,213,229,197, +205,82,20,193,225,209,58,44,32,133,111,50,41,32,205,145, +20,58,97,32,167,200,50,2,32,201,254,5,200,195,54,4, +33,39,32,195,59,26,205,48,4,205,82,20,33,37,32,17, +37,27,6,7,205,50,26,42,141,32,44,125,254,99,218,83, +4,46,84,34,141,32,42,143,32,44,34,143,32,58,132,32, +167,192,126,230,1,1,41,2,194,110,4,1,224,254,33,138, +32,113,35,35,112,201,225,58,50,27,50,50,32,42,56,32, +125,180,194,138,4,43,34,56,32,201,17,53,32,62,249,205, +80,5,58,70,32,50,112,32,58,86,32,50,113,32,205,99, +5,58,120,32,167,33,53,32,194,91,5,17,48,27,33,48, +32,6,16,195,50,26,225,58,110,32,167,192,58,128,32,254, +1,192,17,69,32,62,237,205,80,5,58,54,32,50,112,32, +58,86,32,50,113,32,205,99,5,58,118,32,254,16,218,231, +4,58,72,27,50,118,32,58,120,32,167,33,69,32,194,91, +5,17,64,27,33,64,32,6,16,205,50,26,58,130,32,61, +194,8,5,62,1,50,110,32,42,118,32,195,126,6,225,17, +85,32,62,219,205,80,5,58,70,32,50,112,32,58,54,32, +50,113,32,205,99,5,58,118,32,254,21,218,52,5,58,88, +27,50,118,32,58,120,32,167,33,85,32,194,91,5,17,80, +27,33,80,32,6,16,205,50,26,42,118,32,34,88,32,201, +50,127,32,33,115,32,6,11,195,50,26,17,115,32,6,11, +195,50,26,33,115,32,126,230,128,194,193,5,58,193,32,254, +4,58,105,32,202,183,5,167,200,35,54,0,58,112,32,167, +202,137,5,71,58,207,32,184,208,58,113,32,167,202,150,5, +71,58,207,32,184,208,35,126,167,202,27,6,42,118,32,78, +35,0,34,118,32,205,47,6,208,205,122,1,121,198,7,103, +125,214,10,111,34,123,32,33,115,32,126,246,128,119,35,52, +201,17,124,32,205,6,26,208,35,126,230,1,194,68,6,35, +52,205,117,6,58,121,32,198,3,33,127,32,190,218,226,5, +214,12,50,121,32,58,123,32,71,58,126,32,128,50,123,32, +205,108,6,58,123,32,254,21,218,18,6,58,97,32,167,200, +58,123,32,254,30,218,18,6,254,39,0,210,18,6,151,50, +21,32,58,115,32,246,1,50,115,32,201,58,27,32,198,8, +103,205,111,21,121,254,12,218,165,5,14,11,195,165,5,13, +58,103,32,103,105,22,5,126,167,55,192,125,198,11,111,21, +194,55,6,201,33,120,32,53,126,254,3,194,103,6,205,117, +6,33,220,28,34,121,32,33,124,32,53,53,43,53,53,62, +6,50,125,32,195,108,6,167,192,195,117,6,33,121,32,205, +59,26,195,145,20,33,121,32,205,59,26,195,82,20,34,72, +32,201,225,58,128,32,254,2,192,33,131,32,126,167,202,15, +5,58,86,32,167,194,15,5,35,126,167,194,171,6,58,130, +32,254,8,218,15,5,54,1,205,60,7,17,138,32,205,6, +26,208,33,133,32,126,167,194,214,6,33,138,32,126,35,35, +134,50,138,32,205,60,7,33,138,32,126,254,40,218,249,6, +254,225,210,249,6,201,6,254,205,220,25,35,53,126,254,31, +202,75,7,254,24,202,12,7,167,192,6,239,33,152,32,126, +160,119,230,32,211,5,0,0,0,205,66,7,205,203,20,33, +131,32,6,10,205,95,7,6,254,195,220,25,62,1,50,241, +32,42,141,32,70,14,4,33,80,29,17,76,29,26,184,202, +40,7,35,19,13,194,29,7,126,50,135,32,38,0,104,41, +41,41,41,34,242,32,205,66,7,195,241,8,205,66,7,195, +57,20,33,135,32,205,59,26,195,71,26,6,16,33,152,32, +126,176,119,205,112,23,33,124,29,34,135,32,195,60,7,17, +131,27,195,50,26,62,1,50,147,32,49,0,36,251,205,121, +25,205,214,9,33,19,48,17,243,31,14,4,205,243,8,58, +235,32,61,33,16,40,14,20,194,87,8,17,207,26,205,243, +8,219,1,230,4,202,127,7,6,153,175,50,206,32,58,235, +32,128,39,50,235,32,205,71,25,33,0,0,34,248,32,34, +252,32,205,37,25,205,43,25,205,215,25,33,1,1,124,50, +239,32,34,231,32,34,229,32,205,86,25,205,239,1,205,245, +1,205,209,8,50,255,33,50,255,34,205,215,0,175,50,254, +33,50,254,34,205,192,1,205,4,25,33,120,56,34,252,33, +34,252,34,205,228,1,205,127,26,205,141,8,205,214,9,0] +} \ No newline at end of file diff --git a/modules/pc8080/lib/cpuops.js b/modules/pc8080/lib/cpuops.js new file mode 100644 index 000000000..19de5f42c --- /dev/null +++ b/modules/pc8080/lib/cpuops.js @@ -0,0 +1,135 @@ +/** + * @fileoverview Implements PC8080 opcode handlers. + * @author Jeff Parsons + * @version 1.0 + * Created 2016-Apr-20 + * + * Copyright © 2012-2016 Jeff Parsons + * + * This file is part of PCjs, which is part of the JavaScript Machines Project (aka JSMachines) + * at and . + * + * PCjs is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCjs. If not, + * see . + * + * You are required to include the above copyright notice in every source code file of every + * copy or modified version of this work, and to display that copyright notice on every screen + * that loads or runs any version of this software (see Computer.COPYRIGHT). + * + * Some PCjs files also attempt to load external resource files, such as character-image files, + * ROM files, and disk image files. Those external resource files are not considered part of the + * PCjs program for purposes of the GNU General Public License, and the author does not claim + * any copyright as to their contents. + */ + +"use strict"; + +if (NODE) { + var str = require("../../shared/lib/strlib"); + var Messages = require("./messages"); + var CPUDef = require("./CPUDef"); +} + +/** + * op=0x00 (NOP) + * + * @this {CPUSim} + */ +CPUDef.opNOP = function() +{ + this.nStepCycles -= 4; +}; + +/** + * op=0x01 (LXI B,d16) + * + * @this {CPUSim} + */ +CPUDef.opLXIB = function() +{ + this.regC = this.getPCByte(); + this.regB = this.getPCByte(); + this.nStepCycles -= 10; +}; + +/* + * This 256-entry array of opcode functions is at the heart of the CPU engine: stepCPU(n). + * + * It might be worth trying a switch() statement instead, to see how the performance compares, + * but I suspect that would vary quite a bit across JavaScript engines; for now, I'm putting my + * money on array lookup. + */ +CPUDef.aOps = [ + /* 0x00-0x03 */ CPUDef.opNOP, CPUDef.opLXIB, CPUDef.opNOP, CPUDef.opNOP, + /* 0x04-0x07 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x08-0x0B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x0C-0x0F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x10-0x13 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x14-0x17 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x18-0x1B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x1C-0x1F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x20-0x23 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x24-0x27 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x28-0x2B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x2C-0x2F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x30-0x33 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x34-0x37 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x38-0x3B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x3C-0x3F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x40-0x43 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x44-0x47 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x48-0x4B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x4C-0x4F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x50-0x53 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x54-0x57 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x58-0x5B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x5C-0x5F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x60-0x63 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x64-0x67 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x68-0x6B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x6C-0x6F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x70-0x73 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x74-0x77 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x78-0x7B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x7C-0x7F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x80-0x83 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x84-0x87 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x88-0x8B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x8C-0x8F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x90-0x93 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x94-0x97 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x98-0x9B */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0x9C-0x9F */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xA0-0xA3 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xA4-0xA7 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xA8-0xAB */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xAC-0xAF */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xB0-0xB3 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xB4-0xB7 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xB8-0xBB */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xBC-0xBF */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xC0-0xC3 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xC4-0xC7 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xC8-0xCB */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xCC-0xCF */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xD0-0xD3 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xD4-0xD7 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xD8-0xDB */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xDC-0xDF */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xE0-0xE3 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xE4-0xE7 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xE8-0xEB */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xEC-0xEF */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xF0-0xF3 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xF4-0xF7 */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xF8-0xFB */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, + /* 0xFC-0xFF */ CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP, CPUDef.opNOP +]; diff --git a/modules/pc8080/lib/video.js b/modules/pc8080/lib/video.js new file mode 100644 index 000000000..458d563d9 --- /dev/null +++ b/modules/pc8080/lib/video.js @@ -0,0 +1,216 @@ +/** + * @fileoverview Implements the PC8080 Video component. + * @author Jeff Parsons + * @version 1.0 + * Created 2016-Apr-20 + * + * Copyright © 2012-2016 Jeff Parsons + * + * This file is part of PCjs, which is part of the JavaScript Machines Project (aka JSMachines) + * at and . + * + * PCjs is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCjs. If not, + * see . + * + * You are required to include the above copyright notice in every source code file of every + * copy or modified version of this work, and to display that copyright notice on every screen + * that loads or runs any version of this software (see Computer.COPYRIGHT). + * + * Some PCjs files also attempt to load external resource files, such as character-image files, + * ROM files, and disk image files. Those external resource files are not considered part of the + * PCjs program for purposes of the GNU General Public License, and the author does not claim + * any copyright as to their contents. + */ + +"use strict"; + +if (NODE) { + var str = require("../../shared/lib/strlib"); + var web = require("../../shared/lib/weblib"); + var DumpAPI = require("../../shared/lib/dumpapi"); + var Component = require("../../shared/lib/component"); + var Memory = require("./memory"); + var Messages = require("./messages"); + var State = require("./state"); +} + +/** + * Video(parmsVideo, canvas, context, textarea, container) + * + * The Video component can be configured with the following (parmsVideo) properties: + * + * screenWidth: width of the screen canvas, in pixels + * screenHeight: height of the screen canvas, in pixels + * scale: true for font scaling, false (default) to center the display on the screen + * aspect + * rotate + * addr + * screenColor: background color of the screen canvas (default is black) + * + * @constructor + * @extends Component + * @param {Object} parmsVideo + * @param {Object} [canvas] + * @param {Object} [context] + * @param {Object} [textarea] + * @param {Object} [container] + */ +function Video(parmsVideo, canvas, context, textarea, container) +{ + Component.call(this, "Video", parmsVideo, Video, Messages.VIDEO); +} + +Component.subclass(Video); + +/** + * Video.init() + * + * This function operates on every HTML element of class "video", extracting the + * JSON-encoded parameters for the Video constructor from the element's "data-value" + * attribute, invoking the constructor to create a Video component, and then binding + * any associated HTML controls to the new component. + */ +Video.init = function() +{ + var aeVideo = Component.getElementsByClass(document, PCJSCLASS, "video"); + for (var iVideo = 0; iVideo < aeVideo.length; iVideo++) { + var eVideo = aeVideo[iVideo]; + var parmsVideo = Component.getComponentParms(eVideo); + + var eCanvas = document.createElement("canvas"); + if (eCanvas === undefined || !eCanvas.getContext) { + eVideo.innerHTML = "
Missing <canvas> support. Please try a newer web browser."; + return; + } + + eCanvas.setAttribute("class", PCJSCLASS + "-canvas"); + eCanvas.setAttribute("width", parmsVideo['screenWidth']); + eCanvas.setAttribute("height", parmsVideo['screenHeight']); + eCanvas.style.backgroundColor = parmsVideo['screenColor']; + + /* + * The "contenteditable" attribute on a canvas element NOTICEABLY slows down canvas drawing on + * Safari as soon as you give the canvas focus (ie, click away from the canvas, and drawing speeds + * up; click on the canvas, and drawing slows down). So the "transparent textarea hack" that we + * once employed as only a work-around for Android devices is now our default. + * + * eCanvas.setAttribute("contenteditable", "true"); + * + * HACK: A canvas style of "auto" provides for excellent responsive canvas scaling in EVERY browser + * except IE9/IE10, so I recalculate the appropriate CSS height every time the parent DIV is resized; + * IE11 works without this hack, so we take advantage of the fact that IE11 doesn't identify as "MSIE". + * + * The other reason it's good to keep this particular hack limited to IE9/IE10 is that most other + * browsers don't actually support an 'onresize' handler on anything but the window object. + */ + eCanvas.style.height = "auto"; + if (web.getUserAgent().indexOf("MSIE") >= 0) { + eVideo.onresize = function(eParent, eChild, cx, cy) { + return function onResizeVideo() { + eChild.style.height = (((eParent.clientWidth * cy) / cx) | 0) + "px"; + }; + }(eVideo, eCanvas, parmsVideo['screenWidth'], parmsVideo['screenHeight']); + eVideo.onresize(); + } + /* + * The following is a related hack that allows the user to force the machine to use a particular aspect + * ratio if an 'aspect' URL parameter is set. Initially, it's just for testing purposes until we figure + * out a better UI. And note that we use our web.onPageEvent() helper function to make sure we don't + * trample any other 'onresize' handler(s) attached to the window object. + */ + var aspect = +Component.parmsURL['aspect']; + /* + * No 'aspect' parameter yields NaN, which is falsey, and anything else must satisfy my arbitrary + * constraints of 0.3 <= aspect <= 3.33, to prevent any useless (or worse, browser-blowing) results. + */ + if (aspect && aspect >= 0.3 && aspect <= 3.33) { + web.onPageEvent('onresize', function(eParent, eChild, aspectRatio) { + return function onResizeWindow() { + /* + * Since aspectRatio is the target width/height, we have: + * + * eParent.clientWidth / eChild.style.height = aspectRatio + * + * which means that: + * + * eChild.style.height = eParent.clientWidth / aspectRatio + * + * so for example, if aspectRatio is 16:9, or 1.78, and clientWidth = 640, + * then the calculated height should approximately 360. + */ + eChild.style.height = ((eParent.clientWidth / aspectRatio)|0) + "px"; + }; + }(eVideo, eCanvas, aspect)); + window['onresize'](); + } + eVideo.appendChild(eCanvas); + + /* + * HACK: Android-based browsers, like the Silk (Amazon) browser and Chrome for Android, don't honor the + * "contenteditable" attribute; that is, when the canvas receives focus, they don't activate the on-screen + * keyboard. So my fallback is to create a transparent textarea on top of the canvas. + * + * The parent DIV must have a style of "position:relative" (alternatively, a class of "pcjs-container"), + * so that we can position the textarea using absolute coordinates. Also, we don't want the textarea to be + * visible, but we must use "opacity:0" instead of "visibility:hidden", because the latter seems to prevent + * the element from receiving events. These styling requirements are taken care of in components.css + * (see references to the "pcjs-video-object" class). + * + * UPDATE: Unfortunately, Android keyboards like to compose whole words before transmitting any of the + * intervening characters; our textarea's keyDown/keyUp event handlers DO receive intervening key events, + * but their keyCode property is ZERO. Virtually the only usable key event we receive is the Enter key. + * Android users will have to use machines that include their own on-screen "soft keyboard", or use an + * external keyboard. + * + * The following attempt to use a password-enabled input field didn't work any better on Android. You could + * clearly see the overlaid semi-transparent input field, but none of the input characters were passed along, + * with the exception of the "Go" (Enter) key. + * + * var eInput = document.createElement("input"); + * eInput.setAttribute("type", "password"); + * eInput.setAttribute("style", "position:absolute; left:0; top:0; width:100%; height:100%; opacity:0.5"); + * eVideo.appendChild(eInput); + * + * See this Chromium issue for more information: https://code.google.com/p/chromium/issues/detail?id=118639 + */ + var eTextArea = document.createElement("textarea"); + + /* + * As noted in keyboard.js, the keyboard on an iOS device tends to pop up with the SHIFT key depressed, + * which is not the initial keyboard state that the Keyboard component expects, so hopefully turning off + * these "auto" attributes will help. + */ + if (web.isUserAgent("iOS")) { + eTextArea.setAttribute("autocapitalize", "off"); + eTextArea.setAttribute("autocorrect", "off"); + } + eVideo.appendChild(eTextArea); + + /* + * Now we can create the Video object, record it, and wire it up to the associated document elements. + */ + var eContext = eCanvas.getContext("2d"); + var video = new Video(parmsVideo, eCanvas, eContext, eTextArea /* || eInput */, eVideo); + + /* + * Bind any video-specific controls (eg, the Refresh button). There are no essential controls, however; + * even the "Refresh" button is just a diagnostic tool, to ensure that the screen contents are up-to-date. + */ + Component.bindComponentControls(video, eVideo, PCJSCLASS); + } +}; + +/* + * Initialize every Video module on the page. + */ +web.onInit(Video.init); + +if (NODE) module.exports = Video; diff --git a/modules/pcjs/lib/memory.js b/modules/pcjs/lib/memory.js index 9b0499ebe..4d84f9ba9 100644 --- a/modules/pcjs/lib/memory.js +++ b/modules/pcjs/lib/memory.js @@ -110,6 +110,7 @@ function Memory(addr, used, size, type, controller, cpu) this.controller = null; this.cpu = cpu; // if a CPU reference is provided, then this must be an UNPAGED Memory block allocation this.copyBreakpoints(); // initialize the block's Debugger info (eg, breakpoint totals); the caller will reinitialize + /* * TODO: Study the impact of dirty block tracking. As noted in the paged block handlers (eg, writeBytePLE), * the original purposes were to allow saveMemory() to save only dirty blocks, and to enable the Video component diff --git a/package.json b/package.json index 29655519d..76a888d64 100644 --- a/package.json +++ b/package.json @@ -134,6 +134,7 @@ "./modules/shared/lib/defines.js", "./modules/shared/lib/dumpapi.js", "./modules/shared/lib/reportapi.js", + "./modules/shared/lib/userapi.js", "./modules/shared/lib/strlib.js", "./modules/shared/lib/usrlib.js", "./modules/shared/lib/weblib.js", @@ -141,13 +142,16 @@ "./modules/pc8080/lib/defines.js", "./modules/pc8080/lib/cpudef.js", "./modules/pc8080/lib/messages.js", + "./modules/pc8080/lib/panel.js", "./modules/pc8080/lib/bus.js", "./modules/pc8080/lib/memory.js", "./modules/pc8080/lib/cpu.js", "./modules/pc8080/lib/cpusim.js", + "./modules/pc8080/lib/cpuops.js", "./modules/pc8080/lib/rom.js", "./modules/pc8080/lib/ram.js", "./modules/pc8080/lib/keyboard.js", + "./modules/pc8080/lib/video.js", "./modules/pc8080/lib/debugger.js", "./modules/pc8080/lib/state.js", "./modules/pc8080/lib/computer.js",