From 8f6e433f30437de7a1a2a8b7c2d00fb74ab102d0 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Tue, 29 Apr 2025 20:49:11 +0900 Subject: [PATCH] mon: w to accept spaces between bytes --- assets/bios/mon.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/assets/bios/mon.js b/assets/bios/mon.js index db094a3..8441132 100644 --- a/assets/bios/mon.js +++ b/assets/bios/mon.js @@ -97,14 +97,20 @@ while (1) { let arg = buf[1] if (arg == undefined) pE = "No arguments given" - else if (arg.length % 2 == 1) - pE = "Length of byte string is odd number" else { - for (let i = 0; i < arg.length; i += 2) { - let b = parseInt(arg.charAt(i)+arg.charAt(i+1), 16) - putNinc(b) + let str = buf.slice(1).join('').trim() + + if (str.length % 2 == 1) + pE = "Length of byte string is odd number" + else if (str.length == 0) + pE = "No bytes given" + else { + for (let i = 0; i < str.length; i += 2) { + let b = parseInt(str.charAt(i)+str.charAt(i+1), 16) + putNinc(b) + } + pE = undefined } - pE = undefined } } else if ("R" == cmd) {