From 65a284388d80c660b20fcb28590ae081c7f845c4 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sat, 1 Dec 2018 15:00:17 -0500 Subject: [PATCH] testplatforms writes PNG files to test/output; fixed astrocade minimal bios --- .gitignore | 1 + package.json | 1 + src/platform/astrocade.ts | 49 +++++++++++++++++++++++++++++---------- src/platform/vicdual.ts | 2 +- test/cli/testplatforms.js | 20 +++++++++++++--- 5 files changed, 57 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 6f3ebe83..41850320 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ blog local release gen +test/output diff --git a/package.json b/package.json index c40533b6..1326f790 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "jsdom": "^12.0.x", "lzg": "^1.0.x", "mocha": "^5.2.x", + "pngjs": "^3.3.3", "typescript": "^3.x", "wavedrom-cli": "^0.5.x" }, diff --git a/src/platform/astrocade.ts b/src/platform/astrocade.ts index a12b2c5c..1a25f26f 100644 --- a/src/platform/astrocade.ts +++ b/src/platform/astrocade.ts @@ -5,6 +5,8 @@ import { PLATFORMS, RAM, newAddressDecoder, padBytes, noise, setKeyboardFromMap, import { hex, lzgmini, stringToByteArray, rgb2bgr, clamp } from "../util"; import { MasterAudio, AY38910_Audio } from "../audio"; +// http://metopal.com/projects/ballybook/doku.php + const ASTROCADE_PRESETS = [ {id:'01-helloworlds.asm', name:'Hello World'}, {id:'02-telephone.asm', name:'Telephone'}, @@ -86,14 +88,14 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) { // default palette for (var i=0; i<8; i++) palette[i] = ASTROCADE_PALETTE[i]; - + var refreshlines = 0; - + function ramwrite(a:number, v:number) { ram.mem[a] = v; ramupdate(a, v); } - + function ramupdate(a:number, v:number) { var ofs = a*4+3; // 4 pixels per byte for (var i=0; i<4; i++) { @@ -102,13 +104,13 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) { v >>= 2; } } - + function refreshline(y:number) { var ofs = y*swidth/4; for (var i=0; i> 6; // TODO } - + function refreshall() { refreshlines = sheight; } - + class BallyAstrocadePlatform extends BaseZ80Platform implements Platform { getPresets() { @@ -185,7 +187,7 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) { if (lzgrom) bios = new lzgmini().decode(stringToByteArray(atob(lzgrom))); else - bios = padBytes([0xf3, 0x31, 0x00, 0x50, 0x21, 0x05, 0x20, 0x7e, 0x23, 0x66, 0x6f, 0xe9], 0x2000); // SP=$5000, jump to ($2005) + bios = padBytes(ASTROCADE_MINIMAL_BIOS, 0x2000); if (!arcade) { // game console membus = { @@ -302,12 +304,12 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) { readAddress(addr) { return membus.read(addr); } - + loadControls() { inputs[0x1c] = video.paddle_x & 0xff; inputs[0x1d] = video.paddle_y & 0xff; } - + advance(novideo : boolean) { this.loadControls(); for (var sl=0; sl 500); // make sure PNG is big enough + try { fs.mkdirSync("./test"); } catch(e) { } + try { fs.mkdirSync("./test/output"); } catch(e) { } + try { + fs.writeFileSync("./test/output/"+platid+"-"+romname+".png", pngbuffer); + } catch (e) { console.log(e) } + } return platform; } @@ -259,5 +275,3 @@ describe('Platform Replay', () => { }); */ }); - -