From e4a9a7bbfdf5f43e762d36ba298c4f59d16b2683 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Sun, 27 Nov 2022 12:06:14 +1300 Subject: [PATCH] Don't load DFS by default DFS was an add-on to the original hardware and isn't really useful with the bot. Loading it by default raises PAGE by 2816 bytes. Even in the best case of MODE7 and rocket mode, that's a 10% reduction in the available RAM to BBC BASIC. In MODE2 and with the GXR loaded it's a whopping 35% reduction. Support enabling DFS via an emoji, which is probably only really useful as a way to allow easily running programs written for older versions of the bot which assume the value of PAGE or the screen contents. --- client.js | 9 ++++++--- docs/user guide.md | 5 +++++ parser.js | 8 +++++++- test.js | 10 +++++----- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/client.js b/client.js index ab2efdc..da9e42d 100755 --- a/client.js +++ b/client.js @@ -111,8 +111,10 @@ var clientID = "Cli0"; var IBP = 0x02E1; // input pointer var OBP = 0x02D8; // output pointer - var page = ( c.flags.includes("gxr.rom") ) ? "1c00" : "1900"; - var end = parseInt(page,16) + tokenised.length; + var page = 0xE00; + if (c.flags.includes("gxr.rom")) page += 0x300; + if (c.useDFS) page += 0xB00; + var end = page + tokenised.length; var endLow = (end & 0xff).toString(16); var endHigh = ((end >>> 8) & 0xff).toString(16); @@ -120,7 +122,7 @@ var clientID = "Cli0"; var commands = "'"+ ["breakat 725000", "c", - "loadmem ../tmp/tweet.bas "+page, // paste tokenised program into PAGE + "loadmem ../tmp/tweet.bas "+page.toString(16), // paste tokenised program into PAGE "loadmem ../tmp/keys.bin "+keyboardBuffer, // 0x03E0 OS 1.2 "writem 02e1 e4", // Advance pointer 4 bytes "writem 0000 "+endLow, // LOWMEM @@ -140,6 +142,7 @@ var clientID = "Cli0"; } let beebjit_cmd = "cd beebjit && ./beebjit -fast -headless -frames-dir ../tmp/ " + c.flags + " -commands " + commands; + if (!c.useDFS) beebjit_cmd += " -no-dfs"; await exec(beebjit_cmd ); console.log(beebjit_cmd); } else // JSbeeb diff --git a/docs/user guide.md b/docs/user guide.md index 41a1cb6..f4527bb 100644 --- a/docs/user guide.md +++ b/docs/user guide.md @@ -30,6 +30,11 @@ Bot execution modes \* The bot runs 3 hours equivalent 6502 execution in just a few seconds thanks to Beebjit! +Other emojis commands + +* 🖬 or 💾 loads the DFS ROM. By default the bot doesn't do this - DFS was an add-on to the original hardware and isn't very useful with the bot. This is mostly provided as a way to allow easily running programs written for older versions of the bot which always loaded the DFS ROM. | + + ### Unexpected behavior with 🎬 mode animations We use the beebjit `-fast` parameter to achive very fast emulation in the accelerated modes, the only downside being some unexpected 'relativistic' effects if your code relies on external timers. In this mode CPU time is accelerated several thousandfold and decoupled from timing of BBC Micro peripherals and timers which remain emulated in real-time. This means flashing colours in the palette, and `*FX 19` or `INKEY` based timing will not work well! diff --git a/parser.js b/parser.js index 971c267..f0195cd 100644 --- a/parser.js +++ b/parser.js @@ -64,7 +64,8 @@ var one_hour = 2000000*60*60; compressed: false, input: "", mode: 1, - isBASIC: true + isBASIC: true, + useDFS: false } @@ -107,6 +108,11 @@ var one_hour = 2000000*60*60; c.mode = 0; return c; + case "🖬": + case "💾": // Not really period appropriate, but probably the more common "floppy disk" emoji. + c.useDFS = true; + break; + default: c.input += graphemes[i]; var g = graphemes[i].codePointAt(0); diff --git a/test.js b/test.js index 94cd22d..b574257 100644 --- a/test.js +++ b/test.js @@ -33,7 +33,7 @@ function Tests(since_id){ */ { name: "CHARACTERS", - text: "10 PRINT“>&<&lt;”'SPC39\"|\"\n20 VDU 23,1,0;0;0;0;\n", // Tests twitter HTML escapes for <,&,> and OS X auto "" + text: "💾10 PRINT“>&<&lt;”'SPC39\"|\"\n20 VDU 23,1,0;0;0;0;\n", // Tests twitter HTML escapes for <,&,> and OS X auto "" mediaType: "image/png", checksum: "c3f630a42cc39990a6e38c574a93f6c79b3c5a8a" }, @@ -67,13 +67,13 @@ function Tests(since_id){ }, { name: "YOUONLYRUNONCE", // Check that an explicit RUN suppresses an implicit one. - text: '1PRINT"HELLO":!-512=&B000B\nRUN', + text: '🖬1PRINT"HELLO":!-512=&B000B\nRUN', mediaType: "image/png", checksum: "28222f638d2c0b97e7e03d0e54561ab7364bd445" }, { name: "NOLINENOS", // Test no line numbers -> tokeniser. - text: "P.\"HELLO\";\nV.279;0;0;0;0;32\nP.\"WORLD\"", + text: "💾P.\"HELLO\";\nV.279;0;0;0;0;32\nP.\"WORLD\"", mediaType: "image/png", checksum: "5c3db47017774d43ad27c9916af332d471e273e6" }, @@ -81,7 +81,7 @@ function Tests(since_id){ name: "TOKENS", // Test tokens -> tokeniser. text: "\xf1~\u0190\n\xef279;0;0;0;0;\n", mediaType: "image/png", - checksum: "27760d3701f31e398df07429364ef0ebcc8b2434" + checksum: "649072777ed9938fddaed9a57c27f07f2945c0fb" }, /* FIXME: @-mentions are not currently removed for mastodon { @@ -103,7 +103,7 @@ function Tests(since_id){ }, { name: "TOKENISE_LONG", // Test tokenisation handles a long input - text: "0PRINT" + (":PRINT".repeat(125)), + text: "💾0PRINT" + (":PRINT".repeat(125)), mediaType: "image/gif", checksum: "b1099ab5729e3fdabb1aa12c05aae77f18e6ee83" },