From b85b2ffbb7e435e19eea6905d68054e80fbcdee0 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Thu, 5 Mar 2026 12:01:53 +0100 Subject: [PATCH] nes: removed JQuery cli: using nodemock.ts utilities, added --info and --memdump --- src/platform/nes.ts | 53 +++++++++-------- src/tools/8bws.ts | 114 +++++++++++++++++++++++++++++++------ src/tools/nodemock.ts | 58 +++++++++++++++++++ src/tools/runmachine.ts | 23 +++----- test/cli/testplatforms.js | 1 + test/roms/gb/cpu_instrs.gb | Bin 0 -> 65536 bytes 6 files changed, 191 insertions(+), 58 deletions(-) create mode 100644 src/tools/nodemock.ts create mode 100644 test/roms/gb/cpu_instrs.gb diff --git a/src/platform/nes.ts b/src/platform/nes.ts index e03cda1d..a8f8409c 100644 --- a/src/platform/nes.ts +++ b/src/platform/nes.ts @@ -1,7 +1,7 @@ import { Platform, Base6502Platform, getOpcodeMetadata_6502, getToolForFilename_6502, Preset } from "../common/baseplatform"; import { PLATFORMS, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap, KeyFlags, EmuHalt, ControllerPoller } from "../common/emu"; -import { hex, byteArrayToString } from "../common/util"; +import { hex, byteArrayToString, replaceAll } from "../common/util"; import { CodeAnalyzer_nes } from "../common/analysis"; import { SampleAudio } from "../common/audio"; import { ProbeRecorder } from "../common/probe"; @@ -71,16 +71,17 @@ const JSNES_KEYCODE_MAP = makeKeycodeMap([ class JSNESPlatform extends Base6502Platform implements Platform, Probeable { - mainElement; + mainElement : HTMLElement; nes; - video; + video: RasterVideo; audio; - timer; + timer: AnimationTimer; poller : ControllerPoller; audioFrequency = 44030; //44100 frameindex = 0; - ntvideo; - ntlastbuf; + ntvideo: RasterVideo; + ntlastbuf: Uint32Array; + showDebugView = false; machine = { cpuCyclesPerLine: 114 }; // TODO: hack for width of probe scope @@ -93,21 +94,22 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable { start() { this.debugPCDelta = 1; - var debugbar = $("
").appendTo(this.mainElement); this.audio = new SampleAudio(this.audioFrequency); this.video = new RasterVideo(this.mainElement,256,224,{overscan:true}); this.video.create(); // debugging view this.ntvideo = new RasterVideo(this.mainElement,512,480,{overscan:false}); this.ntvideo.create(); - $(this.ntvideo.canvas).hide(); + this.ntvideo.canvas.style.display = 'none'; this.ntlastbuf = new Uint32Array(0x1000); if (Mousetrap.bind) Mousetrap.bind('ctrl+shift+alt+n', () => { - $(this.video.canvas).toggle() - $(this.ntvideo.canvas).toggle() + this.showDebugView = !this.showDebugView; + this.video.canvas.style.display = !this.showDebugView ? '' : 'none'; + this.ntvideo.canvas.style.display = this.showDebugView ? '' : 'none'; }); // toggle buttons (TODO) /* + var debugbar = $("
").appendTo(this.mainElement); $('