jsbeeb 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +15 -0
- package/.git-blame-ignore-revs +3 -0
- package/.github/copilot-instructions.md +94 -0
- package/.github/workflows/claude-issue-triage.yml +105 -0
- package/.github/workflows/claude.yml +63 -0
- package/.github/workflows/release-please.yml +75 -0
- package/.github/workflows/test-and-deploy.yml +86 -0
- package/.gitmodules +6 -0
- package/.husky/pre-commit +1 -0
- package/.idea/codeStyleSettings.xml +9 -0
- package/.idea/codeStyles/Project.xml +62 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/compiler.xml +22 -0
- package/.idea/copyright/profiles_settings.xml +3 -0
- package/.idea/encodings.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/jsLinters/jshint.xml +85 -0
- package/.idea/jsLinters/jslint.xml +15 -0
- package/.idea/jsbeeb.iml +11 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +7 -0
- package/.idea/runConfigurations/Debug.xml +5 -0
- package/.idea/scopes/scope_settings.xml +5 -0
- package/.idea/vcs.xml +8 -0
- package/.prettierignore +4 -0
- package/.prettierrc.json +1 -0
- package/.release-please-manifest.json +3 -0
- package/.vscode/launch.json +14 -0
- package/.vscode/settings.json +6 -0
- package/CHANGELOG.md +32 -0
- package/CLAUDE.md +136 -0
- package/COPYING +674 -0
- package/Dockerfile +22 -0
- package/Makefile +30 -0
- package/README.md +259 -0
- package/docker/nginx-default.conf +10 -0
- package/docs/pal-comb-filter-research.md +129 -0
- package/docs/pal-simulation-design.md +368 -0
- package/eslint.config.js +35 -0
- package/index.html +954 -0
- package/jsconfig.json +10 -0
- package/package.json +102 -0
- package/public/discs/README.Irq-Timing +3 -0
- package/public/discs/README.bcdtest +5 -0
- package/public/discs/README.elite +6 -0
- package/public/discs/README.eng_test +3 -0
- package/public/discs/README.protection +7 -0
- package/public/favicon.ico +0 -0
- package/public/images/botbar.png +0 -0
- package/public/images/cub-monitor.png +0 -0
- package/public/images/jsbeeb-example.png +0 -0
- package/public/images/placeholder.png +0 -0
- package/public/images/red-off-16.png +0 -0
- package/public/images/red-on-16.png +0 -0
- package/public/images/sb/CD-left.jpg +0 -0
- package/public/images/sb/CD-right.jpg +0 -0
- package/public/images/sidebar.png +0 -0
- package/public/images/tv.png +0 -0
- package/public/images/yellow-off-16.png +0 -0
- package/public/images/yellow-on-16.png +0 -0
- package/public/jsbeeb-icon.png +0 -0
- package/public/robots.txt +3 -0
- package/public/roms/ADFS1-53.rom +0 -0
- package/public/roms/BASIC.ROM +0 -0
- package/public/roms/README +4 -0
- package/public/roms/a01/BASIC1.rom +0 -0
- package/public/roms/ample.rom +0 -0
- package/public/roms/ats-3.0.rom +0 -0
- package/public/roms/b/DFS-0.9.rom +0 -0
- package/public/roms/b/DFS-1.2.rom +0 -0
- package/public/roms/b1770/dfs1770.rom +0 -0
- package/public/roms/b1770/zADFS.ROM +0 -0
- package/public/roms/bp/dfs.rom +0 -0
- package/public/roms/bp/zADFS.ROM +0 -0
- package/public/roms/bpos.rom +0 -0
- package/public/roms/compact/adfs210.rom +0 -0
- package/public/roms/compact/basic48.rom +0 -0
- package/public/roms/compact/basic486.rom +0 -0
- package/public/roms/compact/os51.rom +0 -0
- package/public/roms/compact/utils.rom +0 -0
- package/public/roms/deos.rom +0 -0
- package/public/roms/master/anfs-4.25.rom +0 -0
- package/public/roms/master/mos.txt +68819 -0
- package/public/roms/master/mos3.20 +0 -0
- package/public/roms/os.rom +0 -0
- package/public/roms/os01.rom +0 -0
- package/public/roms/tube/6502Tube.rom +0 -0
- package/public/roms/tube/ARMeval_100.rom +0 -0
- package/public/roms/tube/BIOS.ROM +0 -0
- package/public/roms/tube/ReCo6502ROM_816 +0 -0
- package/public/roms/tube/Z80_120.rom +0 -0
- package/public/roms/us/USBASIC.rom +0 -0
- package/public/roms/us/USDNFS.rom +0 -0
- package/public/roms/usmos.rom +0 -0
- package/public/sounds/disc525/motor.wav +0 -0
- package/public/sounds/disc525/motoroff.wav +0 -0
- package/public/sounds/disc525/motoron.wav +0 -0
- package/public/sounds/disc525/seek.wav +0 -0
- package/public/sounds/disc525/seek2.wav +0 -0
- package/public/sounds/disc525/seek3.wav +0 -0
- package/public/sounds/disc525/step.wav +0 -0
- package/public/teletext/txt0.dat +0 -0
- package/public/teletext/txt1.dat +0 -0
- package/public/teletext/txt2.dat +0 -0
- package/public/teletext/txt3.dat +0 -0
- package/release-please-config.json +13 -0
- package/run-container.sh +92 -0
- package/src/6502.js +1347 -0
- package/src/6502.opcodes.js +1411 -0
- package/src/acia.js +261 -0
- package/src/adc.js +149 -0
- package/src/analogue-source.js +21 -0
- package/src/app/app.js +175 -0
- package/src/app/electron.js +20 -0
- package/src/app/preload.js +8 -0
- package/src/app-bench.js +33 -0
- package/src/basic/multiline-tetris +9 -0
- package/src/basic-tokenise.js +104 -0
- package/src/canvas.js +177 -0
- package/src/cmos.js +141 -0
- package/src/config.js +165 -0
- package/src/ddnoise.js +138 -0
- package/src/disc-drive.js +371 -0
- package/src/disc-hfe.js +396 -0
- package/src/disc.js +997 -0
- package/src/econet/L3FS.dat +0 -0
- package/src/econet/scsi.dat +0 -0
- package/src/econet.js +714 -0
- package/src/fake6502.js +32 -0
- package/src/fdc.js +248 -0
- package/src/filestore.js +666 -0
- package/src/gamepad-source.js +59 -0
- package/src/gamepads.js +268 -0
- package/src/google-drive.js +160 -0
- package/src/intel-fdc.js +1717 -0
- package/src/jsbeeb.css +363 -0
- package/src/keyboard.js +411 -0
- package/src/lib/README +1 -0
- package/src/lib/webgl-debug.js +911 -0
- package/src/main.js +1759 -0
- package/src/microphone-input.js +149 -0
- package/src/models.js +200 -0
- package/src/mouse-joystick-source.js +107 -0
- package/src/music5000-worklet.js +43 -0
- package/src/music5000.js +207 -0
- package/src/scheduler.js +148 -0
- package/src/serial.js +31 -0
- package/src/soundchip.js +314 -0
- package/src/sth.js +59 -0
- package/src/tapes.js +265 -0
- package/src/teletext.js +348 -0
- package/src/teletext_adaptor.js +172 -0
- package/src/teletext_data.js +1064 -0
- package/src/touchscreen.js +86 -0
- package/src/tube.js +349 -0
- package/src/url-params.js +256 -0
- package/src/utils.js +1090 -0
- package/src/via.js +702 -0
- package/src/video-filters/pal-composite.js +94 -0
- package/src/video-filters/passthrough-filter.js +70 -0
- package/src/video-filters/shaders/pal-composite.frag.glsl +147 -0
- package/src/video-filters/shaders/pal-composite.vert.glsl +8 -0
- package/src/video-filters/shaders/passthrough.frag.glsl +6 -0
- package/src/video-filters/shaders/passthrough.vert.glsl +7 -0
- package/src/video.js +794 -0
- package/src/wd-fdc.js +1344 -0
- package/src/web/audio-handler.js +146 -0
- package/src/web/audio-renderer.js +115 -0
- package/src/web/debug.js +529 -0
- package/tests/integration/RmwX.asm +47 -0
- package/tests/integration/TestInstructionsSource +27 -0
- package/tests/integration/TestTimingsResults +27 -0
- package/tests/integration/TestTimingsSource +61 -0
- package/tests/integration/bcd.js +23 -0
- package/tests/integration/dormann.js +101 -0
- package/tests/integration/dp111timing.js +42 -0
- package/tests/integration/ensure-submodules.js +25 -0
- package/tests/integration/nops.bas +119 -0
- package/tests/integration/nops.js +24 -0
- package/tests/integration/protection.js +26 -0
- package/tests/integration/rmw.js +69 -0
- package/tests/integration/teletext/expected_bug_469.png +0 -0
- package/tests/integration/teletext/expected_flash_0.png +0 -0
- package/tests/integration/teletext/expected_flash_1.png +0 -0
- package/tests/integration/teletext/expected_hoglet_held_char.png +0 -0
- package/tests/integration/teletext/expected_reveal_flash_0.png +0 -0
- package/tests/integration/teletext/expected_reveal_flash_1.png +0 -0
- package/tests/integration/teletext.js +126 -0
- package/tests/integration/timings.js +56 -0
- package/tests/integration/via.js +1125 -0
- package/tests/suite/README.md +7 -0
- package/tests/suite/Test Suite 2.15.txt +373 -0
- package/tests/suite/bin/ start +0 -0
- package/tests/suite/bin/adca +0 -0
- package/tests/suite/bin/adcax +0 -0
- package/tests/suite/bin/adcay +0 -0
- package/tests/suite/bin/adcb +0 -0
- package/tests/suite/bin/adcix +0 -0
- package/tests/suite/bin/adciy +0 -0
- package/tests/suite/bin/adcz +0 -0
- package/tests/suite/bin/adczx +0 -0
- package/tests/suite/bin/alrb +0 -0
- package/tests/suite/bin/ancb +0 -0
- package/tests/suite/bin/anda +0 -0
- package/tests/suite/bin/andax +0 -0
- package/tests/suite/bin/anday +0 -0
- package/tests/suite/bin/andb +0 -0
- package/tests/suite/bin/andix +0 -0
- package/tests/suite/bin/andiy +0 -0
- package/tests/suite/bin/andz +0 -0
- package/tests/suite/bin/andzx +0 -0
- package/tests/suite/bin/aneb +0 -0
- package/tests/suite/bin/arrb +0 -0
- package/tests/suite/bin/asla +0 -0
- package/tests/suite/bin/aslax +0 -0
- package/tests/suite/bin/asln +0 -0
- package/tests/suite/bin/aslz +0 -0
- package/tests/suite/bin/aslzx +0 -0
- package/tests/suite/bin/asoa +0 -0
- package/tests/suite/bin/asoax +0 -0
- package/tests/suite/bin/asoay +0 -0
- package/tests/suite/bin/asoix +0 -0
- package/tests/suite/bin/asoiy +0 -0
- package/tests/suite/bin/asoz +0 -0
- package/tests/suite/bin/asozx +0 -0
- package/tests/suite/bin/axsa +0 -0
- package/tests/suite/bin/axsix +0 -0
- package/tests/suite/bin/axsz +0 -0
- package/tests/suite/bin/axszy +0 -0
- package/tests/suite/bin/bccr +0 -0
- package/tests/suite/bin/bcsr +0 -0
- package/tests/suite/bin/beqr +0 -0
- package/tests/suite/bin/bita +0 -0
- package/tests/suite/bin/bitz +0 -0
- package/tests/suite/bin/bmir +0 -0
- package/tests/suite/bin/bner +0 -0
- package/tests/suite/bin/bplr +0 -0
- package/tests/suite/bin/branchwrap +0 -0
- package/tests/suite/bin/brkn +0 -0
- package/tests/suite/bin/bvcr +0 -0
- package/tests/suite/bin/bvsr +0 -0
- package/tests/suite/bin/cia1pb6 +0 -0
- package/tests/suite/bin/cia1pb7 +0 -0
- package/tests/suite/bin/cia1ta +0 -0
- package/tests/suite/bin/cia1tab +0 -0
- package/tests/suite/bin/cia1tb +0 -0
- package/tests/suite/bin/cia1tb123 +0 -0
- package/tests/suite/bin/cia2pb6 +0 -0
- package/tests/suite/bin/cia2pb7 +0 -0
- package/tests/suite/bin/cia2ta +0 -0
- package/tests/suite/bin/cia2tb +0 -0
- package/tests/suite/bin/cia2tb123 +0 -0
- package/tests/suite/bin/clcn +0 -0
- package/tests/suite/bin/cldn +0 -0
- package/tests/suite/bin/clin +0 -0
- package/tests/suite/bin/clvn +0 -0
- package/tests/suite/bin/cmpa +0 -0
- package/tests/suite/bin/cmpax +0 -0
- package/tests/suite/bin/cmpay +0 -0
- package/tests/suite/bin/cmpb +0 -0
- package/tests/suite/bin/cmpix +0 -0
- package/tests/suite/bin/cmpiy +0 -0
- package/tests/suite/bin/cmpz +0 -0
- package/tests/suite/bin/cmpzx +0 -0
- package/tests/suite/bin/cntdef +0 -0
- package/tests/suite/bin/cnto2 +0 -0
- package/tests/suite/bin/cpuport +0 -0
- package/tests/suite/bin/cputiming +0 -0
- package/tests/suite/bin/cpxa +0 -0
- package/tests/suite/bin/cpxb +0 -0
- package/tests/suite/bin/cpxz +0 -0
- package/tests/suite/bin/cpya +0 -0
- package/tests/suite/bin/cpyb +0 -0
- package/tests/suite/bin/cpyz +0 -0
- package/tests/suite/bin/dcma +0 -0
- package/tests/suite/bin/dcmax +0 -0
- package/tests/suite/bin/dcmay +0 -0
- package/tests/suite/bin/dcmix +0 -0
- package/tests/suite/bin/dcmiy +0 -0
- package/tests/suite/bin/dcmz +0 -0
- package/tests/suite/bin/dcmzx +0 -0
- package/tests/suite/bin/deca +0 -0
- package/tests/suite/bin/decax +0 -0
- package/tests/suite/bin/decz +0 -0
- package/tests/suite/bin/deczx +0 -0
- package/tests/suite/bin/dexn +0 -0
- package/tests/suite/bin/deyn +0 -0
- package/tests/suite/bin/eora +0 -0
- package/tests/suite/bin/eorax +0 -0
- package/tests/suite/bin/eoray +0 -0
- package/tests/suite/bin/eorb +0 -0
- package/tests/suite/bin/eorix +0 -0
- package/tests/suite/bin/eoriy +0 -0
- package/tests/suite/bin/eorz +0 -0
- package/tests/suite/bin/eorzx +0 -0
- package/tests/suite/bin/finish +0 -0
- package/tests/suite/bin/flipos +0 -0
- package/tests/suite/bin/icr01 +0 -0
- package/tests/suite/bin/imr +0 -0
- package/tests/suite/bin/inca +0 -0
- package/tests/suite/bin/incax +0 -0
- package/tests/suite/bin/incz +0 -0
- package/tests/suite/bin/inczx +0 -0
- package/tests/suite/bin/insa +0 -0
- package/tests/suite/bin/insax +0 -0
- package/tests/suite/bin/insay +0 -0
- package/tests/suite/bin/insix +0 -0
- package/tests/suite/bin/insiy +0 -0
- package/tests/suite/bin/insz +0 -0
- package/tests/suite/bin/inszx +0 -0
- package/tests/suite/bin/inxn +0 -0
- package/tests/suite/bin/inyn +0 -0
- package/tests/suite/bin/irq +0 -0
- package/tests/suite/bin/jmpi +0 -0
- package/tests/suite/bin/jmpw +0 -0
- package/tests/suite/bin/jsrw +0 -0
- package/tests/suite/bin/lasay +0 -0
- package/tests/suite/bin/laxa +0 -0
- package/tests/suite/bin/laxay +0 -0
- package/tests/suite/bin/laxix +0 -0
- package/tests/suite/bin/laxiy +0 -0
- package/tests/suite/bin/laxz +0 -0
- package/tests/suite/bin/laxzy +0 -0
- package/tests/suite/bin/ldaa +0 -0
- package/tests/suite/bin/ldaax +0 -0
- package/tests/suite/bin/ldaay +0 -0
- package/tests/suite/bin/ldab +0 -0
- package/tests/suite/bin/ldaix +0 -0
- package/tests/suite/bin/ldaiy +0 -0
- package/tests/suite/bin/ldaz +0 -0
- package/tests/suite/bin/ldazx +0 -0
- package/tests/suite/bin/ldxa +0 -0
- package/tests/suite/bin/ldxay +0 -0
- package/tests/suite/bin/ldxb +0 -0
- package/tests/suite/bin/ldxz +0 -0
- package/tests/suite/bin/ldxzy +0 -0
- package/tests/suite/bin/ldya +0 -0
- package/tests/suite/bin/ldyax +0 -0
- package/tests/suite/bin/ldyb +0 -0
- package/tests/suite/bin/ldyz +0 -0
- package/tests/suite/bin/ldyzx +0 -0
- package/tests/suite/bin/loadth +0 -0
- package/tests/suite/bin/lsea +0 -0
- package/tests/suite/bin/lseax +0 -0
- package/tests/suite/bin/lseay +0 -0
- package/tests/suite/bin/lseix +0 -0
- package/tests/suite/bin/lseiy +0 -0
- package/tests/suite/bin/lsez +0 -0
- package/tests/suite/bin/lsezx +0 -0
- package/tests/suite/bin/lsra +0 -0
- package/tests/suite/bin/lsrax +0 -0
- package/tests/suite/bin/lsrn +0 -0
- package/tests/suite/bin/lsrz +0 -0
- package/tests/suite/bin/lsrzx +0 -0
- package/tests/suite/bin/lxab +0 -0
- package/tests/suite/bin/mmu +0 -0
- package/tests/suite/bin/mmufetch +0 -0
- package/tests/suite/bin/nmi +0 -0
- package/tests/suite/bin/nopa +0 -0
- package/tests/suite/bin/nopax +0 -0
- package/tests/suite/bin/nopb +0 -0
- package/tests/suite/bin/nopn +0 -0
- package/tests/suite/bin/nopz +0 -0
- package/tests/suite/bin/nopzx +0 -0
- package/tests/suite/bin/oneshot +0 -0
- package/tests/suite/bin/oraa +0 -0
- package/tests/suite/bin/oraax +0 -0
- package/tests/suite/bin/oraay +0 -0
- package/tests/suite/bin/orab +0 -0
- package/tests/suite/bin/oraix +0 -0
- package/tests/suite/bin/oraiy +0 -0
- package/tests/suite/bin/oraz +0 -0
- package/tests/suite/bin/orazx +0 -0
- package/tests/suite/bin/phan +0 -0
- package/tests/suite/bin/phpn +0 -0
- package/tests/suite/bin/plan +0 -0
- package/tests/suite/bin/plpn +0 -0
- package/tests/suite/bin/rlaa +0 -0
- package/tests/suite/bin/rlaax +0 -0
- package/tests/suite/bin/rlaay +0 -0
- package/tests/suite/bin/rlaix +0 -0
- package/tests/suite/bin/rlaiy +0 -0
- package/tests/suite/bin/rlaz +0 -0
- package/tests/suite/bin/rlazx +0 -0
- package/tests/suite/bin/rola +0 -0
- package/tests/suite/bin/rolax +0 -0
- package/tests/suite/bin/roln +0 -0
- package/tests/suite/bin/rolz +0 -0
- package/tests/suite/bin/rolzx +0 -0
- package/tests/suite/bin/rora +0 -0
- package/tests/suite/bin/rorax +0 -0
- package/tests/suite/bin/rorn +0 -0
- package/tests/suite/bin/rorz +0 -0
- package/tests/suite/bin/rorzx +0 -0
- package/tests/suite/bin/rraa +0 -0
- package/tests/suite/bin/rraax +0 -0
- package/tests/suite/bin/rraay +0 -0
- package/tests/suite/bin/rraix +0 -0
- package/tests/suite/bin/rraiy +0 -0
- package/tests/suite/bin/rraz +0 -0
- package/tests/suite/bin/rrazx +0 -0
- package/tests/suite/bin/rtin +0 -0
- package/tests/suite/bin/rtsn +0 -0
- package/tests/suite/bin/sbca +0 -0
- package/tests/suite/bin/sbcax +0 -0
- package/tests/suite/bin/sbcay +0 -0
- package/tests/suite/bin/sbcb +0 -0
- package/tests/suite/bin/sbcb(eb) +0 -0
- package/tests/suite/bin/sbcix +0 -0
- package/tests/suite/bin/sbciy +0 -0
- package/tests/suite/bin/sbcz +0 -0
- package/tests/suite/bin/sbczx +0 -0
- package/tests/suite/bin/sbxb +0 -0
- package/tests/suite/bin/secn +0 -0
- package/tests/suite/bin/sedn +0 -0
- package/tests/suite/bin/sein +0 -0
- package/tests/suite/bin/shaay +0 -0
- package/tests/suite/bin/shaiy +0 -0
- package/tests/suite/bin/shsay +0 -0
- package/tests/suite/bin/shxay +0 -0
- package/tests/suite/bin/shyax +0 -0
- package/tests/suite/bin/staa +0 -0
- package/tests/suite/bin/staax +0 -0
- package/tests/suite/bin/staay +0 -0
- package/tests/suite/bin/staix +0 -0
- package/tests/suite/bin/staiy +0 -0
- package/tests/suite/bin/staz +0 -0
- package/tests/suite/bin/stazx +0 -0
- package/tests/suite/bin/stxa +0 -0
- package/tests/suite/bin/stxz +0 -0
- package/tests/suite/bin/stxzy +0 -0
- package/tests/suite/bin/stya +0 -0
- package/tests/suite/bin/styz +0 -0
- package/tests/suite/bin/styzx +0 -0
- package/tests/suite/bin/taxn +0 -0
- package/tests/suite/bin/tayn +0 -0
- package/tests/suite/bin/trap1 +0 -0
- package/tests/suite/bin/trap10 +0 -0
- package/tests/suite/bin/trap11 +0 -0
- package/tests/suite/bin/trap12 +0 -0
- package/tests/suite/bin/trap13 +0 -0
- package/tests/suite/bin/trap14 +0 -0
- package/tests/suite/bin/trap15 +0 -0
- package/tests/suite/bin/trap16 +0 -0
- package/tests/suite/bin/trap17 +0 -0
- package/tests/suite/bin/trap2 +0 -0
- package/tests/suite/bin/trap3 +0 -0
- package/tests/suite/bin/trap4 +0 -0
- package/tests/suite/bin/trap5 +0 -0
- package/tests/suite/bin/trap6 +0 -0
- package/tests/suite/bin/trap7 +0 -0
- package/tests/suite/bin/trap8 +0 -0
- package/tests/suite/bin/trap9 +0 -0
- package/tests/suite/bin/tsxn +0 -0
- package/tests/suite/bin/txan +0 -0
- package/tests/suite/bin/txsn +0 -0
- package/tests/suite/bin/tyan +0 -0
- package/tests/suite/cbm-hackers-post.html +178 -0
- package/tests/suite/cbm-hackers-post.md +78 -0
- package/tests/test-machine.js +288 -0
- package/tests/test-suite.js +147 -0
- package/tests/test.css +7 -0
- package/tests/unit/gzip/test-1 +0 -0
- package/tests/unit/gzip/test-1.gz +0 -0
- package/tests/unit/gzip/test-2 +0 -0
- package/tests/unit/gzip/test-2.gz +0 -0
- package/tests/unit/gzip/test-3 +0 -0
- package/tests/unit/gzip/test-3.gz +0 -0
- package/tests/unit/gzip/test-4 +0 -0
- package/tests/unit/gzip/test-4.gz +0 -0
- package/tests/unit/test-adc.js +307 -0
- package/tests/unit/test-bcd.js +30 -0
- package/tests/unit/test-cmos.js +266 -0
- package/tests/unit/test-disc-drive.js +85 -0
- package/tests/unit/test-disc-hfe.js +347 -0
- package/tests/unit/test-disc.js +232 -0
- package/tests/unit/test-fifo.js +35 -0
- package/tests/unit/test-gamepad-source.js +67 -0
- package/tests/unit/test-gzip.js +22 -0
- package/tests/unit/test-intel-fdc.js +93 -0
- package/tests/unit/test-keyboard.js +410 -0
- package/tests/unit/test-mouse-joystick-source.js +128 -0
- package/tests/unit/test-scheduler.js +190 -0
- package/tests/unit/test-serial.js +154 -0
- package/tests/unit/test-teletext-adaptor.js +359 -0
- package/tests/unit/test-tokenise.js +65 -0
- package/tests/unit/test-url-params.js +398 -0
- package/tests/unit/test-utils.js +276 -0
- package/tests/unit/test-video.js +498 -0
- package/tests/unit/test-zip.js +56 -0
- package/tests/unit/zip/test-mixed.zip +0 -0
- package/tests/unit/zip/test-rom.zip +0 -0
- package/tests/unit/zip/test-ssd.zip +0 -0
- package/tools/fir-generator.js +80 -0
- package/tools/vite-plugin-fir-shader.js +131 -0
- package/vite.config.js +34 -0
package/src/acia.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Some info:
|
|
3
|
+
// http://www.playvectrex.com/designit/lecture/UP12.HTM
|
|
4
|
+
// https://books.google.com/books?id=wUecAQAAQBAJ&pg=PA431&lpg=PA431&dq=acia+tdre&source=bl&ots=mp-yF-mK-P&sig=e6aXkFRfiIOb57WZmrvdIGsCooI&hl=en&sa=X&ei=0g2fVdDyFIXT-QG8-JD4BA&ved=0CCwQ6AEwAw#v=onepage&q=acia%20tdre&f=false
|
|
5
|
+
// http://www.classiccmp.org/dunfield/r/6850.pdf
|
|
6
|
+
|
|
7
|
+
export class Acia {
|
|
8
|
+
constructor(cpu, toneGen, scheduler, rs423Handler) {
|
|
9
|
+
this.cpu = cpu;
|
|
10
|
+
this.toneGen = toneGen;
|
|
11
|
+
this.rs423Handler = rs423Handler;
|
|
12
|
+
|
|
13
|
+
this.sr = 0x00;
|
|
14
|
+
this.cr = 0x00;
|
|
15
|
+
this.dr = 0x00;
|
|
16
|
+
|
|
17
|
+
this.rs423Selected = false;
|
|
18
|
+
this.motorOn = false;
|
|
19
|
+
this.tapeCarrierCount = 0;
|
|
20
|
+
this.tapeDcdLineLevel = false;
|
|
21
|
+
this.hadDcdHigh = false;
|
|
22
|
+
this.serialReceiveRate = 0;
|
|
23
|
+
this.serialReceiveCyclesPerByte = 0;
|
|
24
|
+
|
|
25
|
+
this.setSerialReceive(19200);
|
|
26
|
+
this.txCompleteTask = scheduler.newTask(() => {
|
|
27
|
+
this.sr |= 0x02; // set the TDRE
|
|
28
|
+
});
|
|
29
|
+
this.runTapeTask = scheduler.newTask(() => this.runTape());
|
|
30
|
+
this.runRs423Task = scheduler.newTask(() => this.runRs423());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
updateIrq() {
|
|
34
|
+
if (this.sr & this.cr & 0x80) {
|
|
35
|
+
this.cpu.interrupt |= 0x04;
|
|
36
|
+
} else {
|
|
37
|
+
this.cpu.interrupt &= ~0x04;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
reset() {
|
|
42
|
+
// TODO: testing on a real beeb seems to suggest that reset also
|
|
43
|
+
// clears CR bits (i.e. things stop working until CR is rewritten
|
|
44
|
+
// with sane value). This disagrees with the datasheet.
|
|
45
|
+
// CTS and DTD are based on external inputs so leave them alone.
|
|
46
|
+
this.sr &= 0x08 | 0x04;
|
|
47
|
+
// Reset clears the transmit register so raise the empty bit.
|
|
48
|
+
this.sr |= 0x02;
|
|
49
|
+
this.hadDcdHigh = false;
|
|
50
|
+
this.updateIrq();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
tone(freq) {
|
|
54
|
+
if (!freq) this.toneGen.mute();
|
|
55
|
+
else this.toneGen.tone(freq);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setMotor(on) {
|
|
59
|
+
if (on && !this.motorOn) {
|
|
60
|
+
this.runTape();
|
|
61
|
+
} else if (!on && this.motorOn) {
|
|
62
|
+
this.toneGen.mute();
|
|
63
|
+
this.runTapeTask.cancel();
|
|
64
|
+
this.setTapeCarrier(false);
|
|
65
|
+
}
|
|
66
|
+
this.motorOn = on;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
read(addr) {
|
|
70
|
+
if (addr & 1) {
|
|
71
|
+
this.sr &= ~0xa1;
|
|
72
|
+
this.hadDcdHigh = false;
|
|
73
|
+
this.updateIrq();
|
|
74
|
+
return this.dr;
|
|
75
|
+
} else {
|
|
76
|
+
let result = (this.sr & 0x7f) | (this.sr & this.cr & 0x80);
|
|
77
|
+
// MC6850: "A low CTS indicates that there is a Clear-to-Send
|
|
78
|
+
// from the modem. In the high state, the Transmit Data Register
|
|
79
|
+
// Empty bit is inhibited".
|
|
80
|
+
if (result & 0x08) {
|
|
81
|
+
result &= ~0x02;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// MC6850: "It remains high after the DCD input is returned low
|
|
85
|
+
// until cleared by first reading the Status Register and then
|
|
86
|
+
// the Data Register".
|
|
87
|
+
// Testing on a real machine shows that only the Data Register
|
|
88
|
+
// read matters, and clears the "saw DCD high" condition.
|
|
89
|
+
if (this.hadDcdHigh) {
|
|
90
|
+
result |= 0x04;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
write(addr, val) {
|
|
98
|
+
if (addr & 1) {
|
|
99
|
+
this.sr &= ~0x02;
|
|
100
|
+
// It's not clear how long this can take; it's when the shift register is loaded.
|
|
101
|
+
// That could be straight away if not already tx-ing, but as we don't really tx,
|
|
102
|
+
// be conservative here.
|
|
103
|
+
this.txCompleteTask.reschedule(2000);
|
|
104
|
+
this.updateIrq();
|
|
105
|
+
if (this.rs423Selected && this.rs423Handler) this.rs423Handler.onTransmit(val);
|
|
106
|
+
} else {
|
|
107
|
+
if ((val & 0x03) === 0x03) {
|
|
108
|
+
// According to the 6850 docs writing 3 here doesn't affect any CR bits, but
|
|
109
|
+
// just resets the device.
|
|
110
|
+
this.reset();
|
|
111
|
+
} else {
|
|
112
|
+
this.cr = val;
|
|
113
|
+
this.setSerialReceive(this.serialReceiveRate);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
selectRs423(selected) {
|
|
119
|
+
this.rs423Selected = !!selected;
|
|
120
|
+
if (this.rs423Selected) {
|
|
121
|
+
// RS423 selected.
|
|
122
|
+
// CTS is always high, meaning not Clear To Send. This is
|
|
123
|
+
// because we don't yet emulate anything on the "other end",
|
|
124
|
+
// so there is nothing to pull CTS low.
|
|
125
|
+
this.sr |= 0x08;
|
|
126
|
+
} else {
|
|
127
|
+
// Cassette selected.
|
|
128
|
+
// CTS is always low, meaning actually Clear To Send.
|
|
129
|
+
this.sr &= ~0x08;
|
|
130
|
+
}
|
|
131
|
+
this.dcdLineUpdated();
|
|
132
|
+
this.runRs423Task.ensureScheduled(this.rs423Selected, this.serialReceiveCyclesPerByte);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
dcdLineUpdated() {
|
|
136
|
+
// AUG: "It will always be low when the RS423 interface is selected".
|
|
137
|
+
const level = this.rs423Selected ? false : this.tapeDcdLineLevel;
|
|
138
|
+
|
|
139
|
+
if (level && !(this.sr & 0x04)) {
|
|
140
|
+
// DCD interrupts on low -> high level change.
|
|
141
|
+
this.sr |= 0x84;
|
|
142
|
+
this.hadDcdHigh = true;
|
|
143
|
+
} else if (!level && this.sr & 0x04) {
|
|
144
|
+
this.sr &= ~0x04;
|
|
145
|
+
}
|
|
146
|
+
this.updateIrq();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
setTapeCarrier(level) {
|
|
150
|
+
if (!level) {
|
|
151
|
+
this.tapeCarrierCount = 0;
|
|
152
|
+
this.tapeDcdLineLevel = false;
|
|
153
|
+
} else {
|
|
154
|
+
this.tapeCarrierCount++;
|
|
155
|
+
// The tape hardware doesn't raise DCD until the carrier tone
|
|
156
|
+
// has persisted for a while. The BBC service manual opines,
|
|
157
|
+
// "The DCD flag in the 6850 should change 0.1 to 0.4 seconds
|
|
158
|
+
// after a continuous tone appears".
|
|
159
|
+
// Star Drifter doesn't load without this.
|
|
160
|
+
// We use 0.174s, measured on an issue 3 model B.
|
|
161
|
+
// Testing on real hardware, DCD is blipped, it lowers about
|
|
162
|
+
// 210us after it raises, even though the carrier tone
|
|
163
|
+
// may be continuing.
|
|
164
|
+
this.tapeDcdLineLevel = this.tapeCarrierCount === 209;
|
|
165
|
+
}
|
|
166
|
+
this.dcdLineUpdated();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
receive(byte) {
|
|
170
|
+
byte |= 0;
|
|
171
|
+
if (this.sr & 0x01) {
|
|
172
|
+
// Overrun.
|
|
173
|
+
// TODO: this doesn't match the datasheet:
|
|
174
|
+
// "The Overrun does not occur in the Status Register until the
|
|
175
|
+
// valid character prior to Overrun has been read."
|
|
176
|
+
console.log("Serial overrun");
|
|
177
|
+
this.sr |= 0xa0;
|
|
178
|
+
} else {
|
|
179
|
+
// If bit 7 contains parity, mask it off.
|
|
180
|
+
this.dr = byte & (this.cr & 0x10 ? 0xff : 0x7f);
|
|
181
|
+
this.sr |= 0x81;
|
|
182
|
+
}
|
|
183
|
+
this.updateIrq();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
setTape(tape) {
|
|
187
|
+
this.tape = tape;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
rewindTape() {
|
|
191
|
+
if (this.tape) {
|
|
192
|
+
console.log("rewinding tape");
|
|
193
|
+
this.tape.rewind();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
secondsToCycles(sec) {
|
|
198
|
+
return Math.floor(2 * 1000 * 1000 * sec) | 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
numBitsPerByte() {
|
|
202
|
+
const wordLength = this.cr & 0x10 ? 8 : 7;
|
|
203
|
+
let stopBits, parityBits;
|
|
204
|
+
switch ((this.cr >>> 2) & 7) {
|
|
205
|
+
case 0:
|
|
206
|
+
stopBits = 2;
|
|
207
|
+
parityBits = 1;
|
|
208
|
+
break;
|
|
209
|
+
case 1:
|
|
210
|
+
stopBits = 2;
|
|
211
|
+
parityBits = 1;
|
|
212
|
+
break;
|
|
213
|
+
case 2:
|
|
214
|
+
stopBits = 1;
|
|
215
|
+
parityBits = 1;
|
|
216
|
+
break;
|
|
217
|
+
case 3:
|
|
218
|
+
stopBits = 1;
|
|
219
|
+
parityBits = 1;
|
|
220
|
+
break;
|
|
221
|
+
case 4:
|
|
222
|
+
stopBits = 2;
|
|
223
|
+
parityBits = 0;
|
|
224
|
+
break;
|
|
225
|
+
case 5:
|
|
226
|
+
stopBits = 1;
|
|
227
|
+
parityBits = 0;
|
|
228
|
+
break;
|
|
229
|
+
case 6:
|
|
230
|
+
stopBits = 1;
|
|
231
|
+
parityBits = 1;
|
|
232
|
+
break;
|
|
233
|
+
case 7:
|
|
234
|
+
stopBits = 1;
|
|
235
|
+
parityBits = 1;
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
return wordLength + stopBits + parityBits;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
rts() {
|
|
242
|
+
// True iff CR6 = 0 or CR5 and CR6 are both 1.
|
|
243
|
+
return (this.cr & 0x40) === 0 || (this.cr & 0x60) === 0x60;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
setSerialReceive(rate) {
|
|
247
|
+
this.serialReceiveRate = rate;
|
|
248
|
+
this.serialReceiveCyclesPerByte = this.secondsToCycles(this.numBitsPerByte() / rate);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
runTape() {
|
|
252
|
+
if (this.tape) this.runTapeTask.reschedule(this.tape.poll(this));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
runRs423() {
|
|
256
|
+
if (!this.rs423Handler) return;
|
|
257
|
+
const rcv = this.rs423Handler.tryReceive(this.rts());
|
|
258
|
+
if (rcv >= 0) this.receive(rcv);
|
|
259
|
+
this.runRs423Task.reschedule(this.serialReceiveCyclesPerByte);
|
|
260
|
+
}
|
|
261
|
+
}
|
package/src/adc.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BBC Micro Analogue to Digital Converter (ADC)
|
|
3
|
+
* Handles input from analogue sources through various channels
|
|
4
|
+
*
|
|
5
|
+
* @typedef {import('./analogue-source.js').AnalogueSource} AnalogueSource
|
|
6
|
+
*/
|
|
7
|
+
export class Adc {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new ADC
|
|
10
|
+
* @param {object} sysvia - System VIA interface
|
|
11
|
+
* @param {object} scheduler - Scheduler for timing operations
|
|
12
|
+
*/
|
|
13
|
+
constructor(sysvia, scheduler) {
|
|
14
|
+
this.sysvia = sysvia;
|
|
15
|
+
this.task = scheduler.newTask(this.onComplete.bind(this));
|
|
16
|
+
this.status = 0x40;
|
|
17
|
+
this.low = 0x00;
|
|
18
|
+
this.high = 0x00;
|
|
19
|
+
|
|
20
|
+
// Initialize channel sources (one source per channel)
|
|
21
|
+
this.channelSources = [null, null, null, null];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Reset the ADC state
|
|
26
|
+
*/
|
|
27
|
+
reset() {
|
|
28
|
+
this.status = 0x40;
|
|
29
|
+
this.low = 0x00;
|
|
30
|
+
this.high = 0x00;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Set the source for a specific channel
|
|
35
|
+
* @param {number} channel - The channel number (0-3)
|
|
36
|
+
* @param {AnalogueSource} source - The source to assign to the channel
|
|
37
|
+
* @returns {boolean} True if the assignment was successful
|
|
38
|
+
*/
|
|
39
|
+
setChannelSource(channel, source) {
|
|
40
|
+
if (channel < 0 || channel > 3) {
|
|
41
|
+
console.error(`ADC: Invalid channel number: ${channel}`);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Dispose of the old source if one exists and is different
|
|
46
|
+
const oldSource = this.channelSources[channel];
|
|
47
|
+
if (oldSource && oldSource !== source) {
|
|
48
|
+
oldSource.dispose();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Set the channel source
|
|
52
|
+
this.channelSources[channel] = source;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get the source for a specific channel
|
|
58
|
+
* @param {number} channel - The channel number (0-3)
|
|
59
|
+
* @returns {AnalogueSource|null} The source for the channel or null if none
|
|
60
|
+
*/
|
|
61
|
+
getChannelSource(channel) {
|
|
62
|
+
if (channel < 0 || channel > 3) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return this.channelSources[channel];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Clear the source for a specific channel
|
|
70
|
+
* @param {number} channel - The channel number (0-3)
|
|
71
|
+
* @returns {boolean} True if successful
|
|
72
|
+
*/
|
|
73
|
+
clearChannelSource(channel) {
|
|
74
|
+
if (channel < 0 || channel > 3) {
|
|
75
|
+
console.error(`ADC: Invalid channel number: ${channel}`);
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const source = this.channelSources[channel];
|
|
80
|
+
if (source) {
|
|
81
|
+
source.dispose();
|
|
82
|
+
this.channelSources[channel] = null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Clear all sources
|
|
90
|
+
*/
|
|
91
|
+
clearSources() {
|
|
92
|
+
// Dispose and clear all channel sources
|
|
93
|
+
for (let i = 0; i < 4; i++) {
|
|
94
|
+
const source = this.channelSources[i];
|
|
95
|
+
if (source) {
|
|
96
|
+
source.dispose();
|
|
97
|
+
this.channelSources[i] = null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Read from the ADC registers
|
|
104
|
+
* @param {number} addr - The address to read from
|
|
105
|
+
* @returns {number} The value at the address
|
|
106
|
+
*/
|
|
107
|
+
read(addr) {
|
|
108
|
+
switch (addr & 3) {
|
|
109
|
+
case 0:
|
|
110
|
+
return this.status;
|
|
111
|
+
case 1:
|
|
112
|
+
return this.high;
|
|
113
|
+
case 2:
|
|
114
|
+
return this.low;
|
|
115
|
+
default:
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
return 0x40;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Write to the ADC control register
|
|
123
|
+
* @param {number} addr - The address to write to
|
|
124
|
+
* @param {number} val - The value to write
|
|
125
|
+
*/
|
|
126
|
+
write(addr, val) {
|
|
127
|
+
if ((addr & 3) !== 0) return;
|
|
128
|
+
// 8 bit conversion takes 4ms whereas 10 bit conversions take 10ms, according to AUG
|
|
129
|
+
this.task.cancel();
|
|
130
|
+
this.task.schedule(val & 0x08 ? 20000 : 8000);
|
|
131
|
+
this.status = (val & 0x0f) | 0x80;
|
|
132
|
+
this.sysvia.setcb1(true);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Called when the ADC conversion is complete
|
|
137
|
+
*/
|
|
138
|
+
onComplete() {
|
|
139
|
+
const channel = this.status & 0x03;
|
|
140
|
+
|
|
141
|
+
const source = this.channelSources[channel];
|
|
142
|
+
const val = source ? source.getValue(channel) : 0x8000;
|
|
143
|
+
|
|
144
|
+
this.status = (this.status & 0x0f) | 0x40 | ((val >>> 10) & 0x03);
|
|
145
|
+
this.low = val & 0xff;
|
|
146
|
+
this.high = (val >>> 8) & 0xff;
|
|
147
|
+
this.sysvia.setcb1(false);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base interface for analog input sources for the BBC Micro's ADC
|
|
3
|
+
* @abstract
|
|
4
|
+
*/
|
|
5
|
+
export class AnalogueSource {
|
|
6
|
+
/**
|
|
7
|
+
* Get the current value for the specified channel
|
|
8
|
+
* @param {number} channel - The ADC channel (0-3)
|
|
9
|
+
* @returns {number} A value between 0 and 0xffff
|
|
10
|
+
*/
|
|
11
|
+
getValue(_channel) {
|
|
12
|
+
throw new Error("Method not implemented");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Clean up resources when source is no longer needed
|
|
17
|
+
*/
|
|
18
|
+
dispose() {
|
|
19
|
+
// Optional cleanup method
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/app/app.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { app, BrowserWindow, dialog, Menu, shell, nativeImage } from "electron";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { ArgumentParser } from "argparse";
|
|
6
|
+
|
|
7
|
+
const isMac = process.platform === "darwin";
|
|
8
|
+
|
|
9
|
+
function getArguments() {
|
|
10
|
+
// Heinous hack to get "built" versions working
|
|
11
|
+
let args;
|
|
12
|
+
if (path.basename(process.argv[0]) === "jsbeeb")
|
|
13
|
+
// Is this ia "built" version?
|
|
14
|
+
args = process.argv.slice(1);
|
|
15
|
+
else args = process.argv.slice(2);
|
|
16
|
+
|
|
17
|
+
// Filter out Chrome switches that appear in process.argv. The snap wrapper
|
|
18
|
+
// adds --no-sandbox for compatibility, and `--disable-gpu` might be useful.
|
|
19
|
+
// Note that we don't support snap any more, but these seemed useful to leave.
|
|
20
|
+
const ignoredChromeFlags = ["--no-sandbox", "--disable-gpu"];
|
|
21
|
+
return args.filter((arg) => !ignoredChromeFlags.includes(arg));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const parser = new ArgumentParser({
|
|
25
|
+
prog: "jsbeeb",
|
|
26
|
+
add_help: true,
|
|
27
|
+
description: "Emulate a Beeb",
|
|
28
|
+
});
|
|
29
|
+
parser.add_argument("--noboot", {
|
|
30
|
+
action: "store_true",
|
|
31
|
+
help: "don't autoboot if given a disc image",
|
|
32
|
+
});
|
|
33
|
+
parser.add_argument("disc1", {
|
|
34
|
+
nargs: "?",
|
|
35
|
+
help: "image to load in drive 0",
|
|
36
|
+
});
|
|
37
|
+
parser.add_argument("disc2", {
|
|
38
|
+
nargs: "?",
|
|
39
|
+
help: "image to load in drive 1",
|
|
40
|
+
});
|
|
41
|
+
const args = parser.parse_args(getArguments());
|
|
42
|
+
|
|
43
|
+
function getFileParam(filename) {
|
|
44
|
+
try {
|
|
45
|
+
return "file://" + fs.realpathSync(filename);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
console.error("Unable to open file " + filename);
|
|
48
|
+
throw e;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function createWindow() {
|
|
53
|
+
const iconPath = path.join(import.meta.dirname, "..", "..", "public", "jsbeeb-icon.png");
|
|
54
|
+
const icon = nativeImage.createFromPath(iconPath);
|
|
55
|
+
|
|
56
|
+
const win = new BrowserWindow({
|
|
57
|
+
width: 1280,
|
|
58
|
+
height: 1024,
|
|
59
|
+
icon: icon,
|
|
60
|
+
webPreferences: {
|
|
61
|
+
preload: path.join(import.meta.dirname, "preload.js"),
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const query = {};
|
|
66
|
+
if (args.disc1 && !args.noboot) query.autoboot = true;
|
|
67
|
+
if (args.disc1) query.disc1 = getFileParam(args.disc1);
|
|
68
|
+
if (args.disc2) query.disc2 = getFileParam(args.disc2);
|
|
69
|
+
await win.loadFile("dist/index.html", { query });
|
|
70
|
+
|
|
71
|
+
app.on("activate", function () {
|
|
72
|
+
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
app.on("window-all-closed", function () {
|
|
77
|
+
if (process.platform !== "darwin") app.quit();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
app.whenReady()
|
|
81
|
+
.then(createWindow)
|
|
82
|
+
.catch((e) => {
|
|
83
|
+
console.error("Unhandled exception", e);
|
|
84
|
+
app.exit(1);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
function makeLoader(drive) {
|
|
88
|
+
return async (_, browserWindow) => {
|
|
89
|
+
const result = await dialog.showOpenDialog(browserWindow, {
|
|
90
|
+
title: "Load a disc image",
|
|
91
|
+
filters: [
|
|
92
|
+
{ name: "Disc images", extensions: ["ssd", "dsd"] },
|
|
93
|
+
{ name: "ZIPped disc images", extensions: ["zip"] },
|
|
94
|
+
],
|
|
95
|
+
properties: ["openFile"],
|
|
96
|
+
});
|
|
97
|
+
if (!result.canceled) {
|
|
98
|
+
browserWindow.webContents.send("load", {
|
|
99
|
+
drive,
|
|
100
|
+
path: getFileParam(result.filePaths[0]),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const template = [
|
|
107
|
+
// { role: 'appMenu' }
|
|
108
|
+
...(isMac
|
|
109
|
+
? [
|
|
110
|
+
{
|
|
111
|
+
label: app.name,
|
|
112
|
+
submenu: [
|
|
113
|
+
{ role: "about" },
|
|
114
|
+
{ type: "separator" },
|
|
115
|
+
{ role: "services" },
|
|
116
|
+
{ type: "separator" },
|
|
117
|
+
{ role: "hide" },
|
|
118
|
+
{ role: "hideothers" },
|
|
119
|
+
{ role: "unhide" },
|
|
120
|
+
{ type: "separator" },
|
|
121
|
+
{ role: "quit" },
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
]
|
|
125
|
+
: []),
|
|
126
|
+
// { role: 'fileMenu' }
|
|
127
|
+
{
|
|
128
|
+
label: "File",
|
|
129
|
+
submenu: [
|
|
130
|
+
{
|
|
131
|
+
label: "Load disc 0",
|
|
132
|
+
click: makeLoader(0),
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: "Load disc 1",
|
|
136
|
+
click: makeLoader(1),
|
|
137
|
+
},
|
|
138
|
+
isMac ? { role: "close" } : { role: "quit" },
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
// { role: 'editMenu' }
|
|
142
|
+
{
|
|
143
|
+
label: "Edit",
|
|
144
|
+
submenu: [{ role: "paste" }],
|
|
145
|
+
},
|
|
146
|
+
// { role: 'viewMenu' }
|
|
147
|
+
{
|
|
148
|
+
label: "View",
|
|
149
|
+
submenu: [
|
|
150
|
+
{ role: "reload" },
|
|
151
|
+
{ role: "forcereload" },
|
|
152
|
+
{ role: "toggledevtools" },
|
|
153
|
+
{ type: "separator" },
|
|
154
|
+
{ role: "resetzoom" },
|
|
155
|
+
{ role: "zoomin" },
|
|
156
|
+
{ role: "zoomout" },
|
|
157
|
+
{ type: "separator" },
|
|
158
|
+
{ role: "togglefullscreen" },
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
role: "help",
|
|
163
|
+
submenu: [
|
|
164
|
+
{
|
|
165
|
+
label: "Learn More",
|
|
166
|
+
click: async () => {
|
|
167
|
+
await shell.openExternal("https://github.com/mattgodbolt/jsbeeb/");
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
];
|
|
173
|
+
|
|
174
|
+
const menu = Menu.buildFromTemplate(template);
|
|
175
|
+
Menu.setApplicationMenu(menu);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Electron integration for jsbeeb desktop application.
|
|
4
|
+
// Handles IPC communication for loading disc images from Electron's main process.
|
|
5
|
+
|
|
6
|
+
export let initialise = function () {};
|
|
7
|
+
|
|
8
|
+
function init(args) {
|
|
9
|
+
const { loadDiscImage, processor } = args;
|
|
10
|
+
const electron = window.nodeRequire("electron");
|
|
11
|
+
electron.ipcRenderer.on("load", async (event, message) => {
|
|
12
|
+
const { drive, path } = message;
|
|
13
|
+
const image = await loadDiscImage(path);
|
|
14
|
+
processor.fdc.loadDisc(drive, image);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (typeof window.nodeRequire !== "undefined") {
|
|
19
|
+
initialise = init;
|
|
20
|
+
}
|
package/src/app-bench.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { fake6502 } from "./fake6502.js";
|
|
4
|
+
import * as models from "./models.js";
|
|
5
|
+
import * as disc from "./fdc.js";
|
|
6
|
+
|
|
7
|
+
function benchmarkCpu(cpu, numCyclesPerRep, numTimes) {
|
|
8
|
+
console.log(`Benchmarking over ${numCyclesPerRep / 1000000}M cpu cycles, ${numTimes} times`);
|
|
9
|
+
for (let time = 0; time < numTimes; ++time) {
|
|
10
|
+
const startTime = Date.now();
|
|
11
|
+
cpu.execute(numCyclesPerRep);
|
|
12
|
+
const endTime = Date.now();
|
|
13
|
+
const msTaken = endTime - startTime;
|
|
14
|
+
const virtualMhz = numCyclesPerRep / msTaken / 1000;
|
|
15
|
+
console.log(
|
|
16
|
+
`${time}: Took ${msTaken}ms to execute ${numCyclesPerRep / 1000000}M cycles; Virtual ${virtualMhz.toFixed(2)}MHz`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function main() {
|
|
22
|
+
const discName = "elite";
|
|
23
|
+
const cpu = fake6502(models.findModel("B"));
|
|
24
|
+
await cpu.initialise();
|
|
25
|
+
const data = await disc.load("discs/" + discName + ".ssd");
|
|
26
|
+
cpu.fdc.loadDisc(0, disc.discFor(cpu.fdc, discName, data));
|
|
27
|
+
cpu.sysvia.keyDown(16);
|
|
28
|
+
cpu.execute(10 * 1000 * 1000);
|
|
29
|
+
cpu.sysvia.keyUp(16);
|
|
30
|
+
benchmarkCpu(cpu, 100 * 1000 * 1000, 10);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main().then(() => {});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
0d=d:IFd VDUd:p=POINT(64*POS,1E3-VPOS*32):RETURN ELSEMODE2:GCOL0,-9:CLG
|
|
2
|
+
1d=9:REPEATVDU30:REPEATGOSUBFALSE:IFPOS=15VDU28,5,VPOS,14;11,26:IF0ELSEIFp=0PRINT:UNTIL0ELSEUNTILVPOS=25
|
|
3
|
+
2b=ABSRND MOD7:k=0:VDU31,9,3
|
|
4
|
+
3REPEATg=9-INKEY6MOD3
|
|
5
|
+
4FORl=TRUE TO1:o=l ANDSGNo
|
|
6
|
+
5IFo=l COLOURb-15:VDUl EORg:k=k+(g=7AND9-6*l)
|
|
7
|
+
6IF0ELSEFORf=0TO11:d=f/3OR2EORd:GOSUBFALSE
|
|
8
|
+
7IF2^((f+k)MOD12)AND975AND&C2590EC/8^b VDU2080*ABSl;:o=o+p:IF0ELSENEXT,
|
|
9
|
+
8VDU20:UNTILo*LOGg:UNTIL0
|