You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- BBC star is on " (if it doesn't work for you try shift-2)
7
+
A BBC Micro emulator written in JavaScript and running in modern browsers. Emulates a 32K BBC B (with sideways RAM)
8
+
and a 128K BBC Master, along with a number of different peripherals.
12
9
13
-
To play right now, visit [https://bbc.xania.org/](https://bbc.xania.org/). To load the default disc image (Elite in
14
-
this case), press shift-F12 (which is shift-Break on the BBC).
10
+
## Table of Contents
15
11
16
-
## Getting set up to run locally
12
+
-[Keyboard Mappings](#keyboard-mappings)
13
+
-[Getting Set Up to Run Locally](#getting-set-up-to-run-locally)
14
+
-[URL Parameters](#url-parameters)
15
+
-[Patches](#patches)
16
+
-[Loading BASIC Files from GitHub Gists](#loading-basic-files-from-github-gists)
17
+
-[Things Left to Do](#things-left-to-do)
18
+
-[Tests](#tests)
19
+
-[Thanks](#thanks)
20
+
-[More Information](#more-information)
21
+
-[License](#license)
22
+
-[Contact](#contact)
17
23
18
-
jsbeeb needs to be built with webpack. If you're developing locally you'll need a recent `node` and then run `npm install` to install needed packages. `node` can be installed from https://nodejs.org/.
24
+
## Keyboard Mappings
19
25
20
-
You can then run `npm start`to get a local webserver which will autoreload on changes in the code - visit http://localhost:8080/ and off you go.
26
+
The BBC had a somewhat different-looking keyboard to a modern PC, and so it's useful to know some of the mappings:
21
27
22
-
jsbeeb uses node and webpack to afford me simple and standard web development tooling and third party library access without lots of painful copy/paste or wheel-reinventing, as well as the ability to better run tests, and "pack" up the site to make it smaller and faster to load when it's deployed to https://bbc.xania.org.
28
+
- BBC `F0` is `F10`
29
+
- BBC `Break` key is `F12`
30
+
- BBC `*` is on `"` (if it doesn't work for you try shift-2)
23
31
24
-
## URL parameters
32
+
To play right now, visit [https://bbc.xania.org/](https://bbc.xania.org/). To load the default disc image (Elite in this
33
+
case), press shift-F12 (which is shift-Break on the BBC).
4. Visit `http://localhost:8080/` in your browser.
58
+
59
+
jsbeeb uses Node.js and webpack to afford simple and standard web development tooling and third-party library access
60
+
without lots of painful copy/paste or wheel-reinventing, as well as the ability to better run tests, and "pack" up the
61
+
site to make it smaller and faster to load when it's deployed to [https://bbc.xania.org](https://bbc.xania.org).
62
+
63
+
## URL Parameters
25
64
26
65
-`autoboot` - fakes a shift break
27
66
-`disc1=XXX` - loads disc XXX (from the `discs/` directory) into drive 1
@@ -31,94 +70,124 @@ jsbeeb uses node and webpack to afford me simple and standard web development to
31
70
-`tape=XXX` - loads tape XXX (from the `tapes/` directory)
32
71
-`tape=sth:ZZZ` - loads tape ZZZ from the Stairway to Hell archive
33
72
-`patch=P` - applies a memory patch `P`. See below.
34
-
-`loadBasic=X` - loads 'X' (a resource on the webserver) as text, tokenises it and puts it in `PAGE` as if you'd typed it in to the emulator
35
-
-`embedBasic=X` - loads 'X' (a URI-encoded string) as text, tokenises it and puts it in `PAGE` as if you'd typed it in to the emulator
73
+
-`loadBasic=X` - loads 'X' (a resource on the webserver) as text, tokenises it and puts it in `PAGE` as if you'd typed
74
+
it in to the emulator
75
+
-`embedBasic=X` - loads 'X' (a URI-encoded string) as text, tokenises it and puts it in `PAGE` as if you'd typed it in
76
+
to the emulator
36
77
-`autorun` - types `*TAPE` then `*/` to run from tape. In conjunction with `loadBasic` it types `RUN`.
37
78
-`autochain` - types `*TAPE` then `CH.""` to run from tape.
38
79
-`autotype` - types whatever you put after. e.g. `&autotype=PRINT"Matt is cool"%0a` (return is URI escaped to `%0a`)
39
-
-`embed` - Remove the margins around the screen, hide most navigation entries and make the page background transparent (intended for use when running within an iframe in a third-party site).
40
-
-`cpuMultiplier=X` speeds up the CPU by a factor of `X`. May be fractional or below one to slow the CPU down. NB disc loads become unreliable with a too-slow CPU, and running too fast might cause the browser to hang.
41
-
-`sbLeft` / `sbRight` / `sbBottom` - a URL to place left of, right of, or below the cub monitor. The left and right should be around 648 high and the bottom image should be around 896 wide. Left and right wider than 300 will run into problems on smaller screens; bottom taller than 100 or so similarly.
42
-
-`videoCyclesBatch` - the number of video cycles to batch up befofre running the video emulation. Defaults to zero: anything higher leads to emulation inaccuracies. Useful for showing why accuracy is important, even if less efficient.
43
-
-`rom` - load the given URL or path as an extra ROM. If a URL is provided, that URL must allow cross-site requests. Doesn't support the sth: pseudo URL unlike `disc` and `tape`, but if given a ZIP file will attempt to use the `.rom` file assumed to be within.
80
+
-`embed` - Remove the margins around the screen, hide most navigation entries and make the page background
81
+
transparent (intended for use when running within an iframe in a third-party site).
82
+
-`cpuMultiplier=X` speeds up the CPU by a factor of `X`. May be fractional or below one to slow the CPU down. NB disc
83
+
loads become unreliable with a too-slow CPU, and running too fast might cause the browser to hang.
84
+
-`sbLeft` / `sbRight` / `sbBottom` - a URL to place left of, right of, or below the cub monitor. The left and right
85
+
should be around 648 high and the bottom image should be around 896 wide. Left and right wider than 300 will run into
86
+
problems on smaller screens; bottom taller than 100 or so similarly.
87
+
-`videoCyclesBatch` - the number of video cycles to batch up before running the video emulation. Defaults to zero:
88
+
anything higher leads to emulation inaccuracies. Useful for showing why accuracy is important, even if less efficient.
89
+
-`rom` - load the given URL or path as an extra ROM. If a URL is provided, that URL must allow cross-site requests.
90
+
Doesn't support the sth: pseudo URL unlike `disc` and `tape`, but if given a ZIP file will attempt to use the `.rom`
91
+
file assumed to be within.
44
92
- (mostly internal use) `logFdcCommands`, `logFdcStateChanges` - turn on logging in the disc controller.
45
93
46
94
## Patches
47
95
48
-
Patches can be applied by making a `patch=P` URL parameter. `P` is a sequence of semicolon separated patches of the form `@XXXX,YYYY:ZZZZZ,...` where the `@XXXX` specifies a PC address to breakpoint, the `YYYY` is the address to patch and the `ZZZZ` is the data to write at address `YYYY`. The `@` part is optional, but is handy to ensure the code you want to patch has actually loaded. For example: `patch=@31a6,0769:6e4c4d48465a` which is a patch for the default Elite image. Once the PC has reached `$31a6`, the bytes at `0769` are replaced with `6e4c4d48465a`.
96
+
Patches can be applied by making a `patch=P` URL parameter. `P` is a sequence of semicolon-separated patches of the form
97
+
`@XXXX,YYYY:ZZZZZ,...` where the `@XXXX` specifies a PC address to breakpoint, the `YYYY` is the address to patch and
98
+
the `ZZZZ` is the data to write at address `YYYY`. The `@` part is optional, but is handy to ensure the code you want to
99
+
patch has actually loaded. For example: `patch=@31a6,0769:6e4c4d48465a` which is a patch for the default Elite image.
100
+
Once the PC has reached `$31a6`, the bytes at `0769` are replaced with `6e4c4d48465a`.
49
101
50
-
## Loading BASIC files from GitHub gists
102
+
## Loading BASIC Files from GitHub Gists
51
103
52
-
- Create a gist with your code. https://gist.github.com/ - here's an [example](https://gist.github.com/mattgodbolt/fc8d6f3d6e5e015dce399013719c8341)
53
-
- Get the "Raw" link by clicking "raw" and copying the URL . In the case above that's: https://gist.githubusercontent.com/mattgodbolt/fc8d6f3d6e5e015dce399013719c8341/raw/bd5cb4314bfc3ee4330783ecf82cb329a36b915c/foo.bas
54
-
- Add that after "https://bbc.xania.org/?autorun&loadBasic=" or similar, for example, [this link](https://bbc.xania.org/?loadBasic=https://gist.githubusercontent.com/mattgodbolt/fc8d6f3d6e5e015dce399013719c8341/raw/bd5cb4314bfc3ee4330783ecf82cb329a36b915c/foo.bas&autorun)
104
+
1. Create a gist with your code. https://gist.github.com/ - here's
105
+
an [example](https://gist.github.com/mattgodbolt/fc8d6f3d6e5e015dce399013719c8341)
106
+
2. Get the "Raw" link by clicking "raw" and copying the URL. In the case above
3. Add that after "https://bbc.xania.org/?autorun&loadBasic=" or similar, for
109
+
example, [this link](https://bbc.xania.org/?loadBasic=https://gist.githubusercontent.com/mattgodbolt/fc8d6f3d6e5e015dce399013719c8341/raw/bd5cb4314bfc3ee4330783ecf82cb329a36b915c/foo.bas&autorun)
55
110
56
111
Note that every update you make means you need to make a new raw link.
57
112
58
-
## Things left to do
113
+
## Things Left to Do
59
114
60
115
If you're looking to help:
61
116
62
117
- Testing
63
-
- Play lots of games and report issues either on [github](https://github.com/mattgodbolt/jsbeeb/issues) or by email (matt@godbolt.org).
118
+
- Play lots of games and report issues either on [GitHub](https://github.com/mattgodbolt/jsbeeb/issues) or by email (
119
+
matt@godbolt.org).
64
120
- Core
65
121
- Save state ability
66
122
- Once we have this I'd love to get some "reverse step" debugging support
67
-
- Get the "boo" of the boot "boo-beep" working (disabled currently as the Javascript startup makes the sound dreadfully
68
-
choppy on Chrome at least).
123
+
- Get the "boo" of the boot "boo-beep" working (disabled currently as the JavaScript startup makes the sound
124
+
dreadfully choppy on Chrome at least).
69
125
- Save disc support
70
126
- Local discs need to be made more workable and need an "export" feature
71
127
- Multiple discs need a UI
72
128
-`git grep -i todo`
73
129
- Optimisation
74
-
- While every attempt to make things fast has been made, I'm sure there's some more clever things that can be done without
75
-
compromising emulation accuracy
130
+
- While every attempt to make things fast has been made, I'm sure there's some more clever things that can be done
131
+
without compromising emulation accuracy
76
132
77
133
## Tests
78
134
79
-
For general correctness there are several tests in the `tests` directory, including:
135
+
For general correctness, there are several tests in the `tests` directory, including:
80
136
81
-
- Klaus Dormann's exhaustive test of all documented opcodes for 6502 and 65C12.
82
-
This is brought in as a git submodule from a forked version of Klaus's original as it needed
83
-
a few tweaks to get 65C12 working.
137
+
- Klaus Dormann's exhaustive [test of all documented opcodes](https://github.com/Klaus2m5/6502_65C02_functional_tests)
138
+
for 6502 and 65C12. This is brought in as a git submodule from a forked version of Klaus's original as it needed a few
139
+
tweaks to get 65C12 working.
84
140
- hoglet's Binary Coded Decimal tests.
85
-
- A public domain Commodore 64 6502 test suite which tests every 6502 opcode (documented or
86
-
otherwise) for every possible input and flags condition.
141
+
-@dp111's [timing tests](https://github.com/dp111/6502Timing). Also brought in as a git submodule.
142
+
- A public domain Commodore 64 6502 test suite which tests every 6502 opcode (documented or otherwise) for every
143
+
possible input and flags condition.
144
+
- Some tests by @scarybeasts testing VIA and 65C12 functionality.
87
145
88
-
For timing correctness we have:
146
+
For timing correctness, we have:
89
147
90
-
- A timing test program written by Rich. It has been run on a real live BBC B and
91
-
the results are in the directory. An SSD of the same tests is in the `discs/` directory.
92
-
- Some of Kevin Edwards' protection systems (stripped of the games themselves). These are extremely
93
-
timing- and correctness-sensitive when it comes to the timers and interrupts of the BBC.
148
+
- A timing test program written by Rich. It has been run on a real live BBC B and the results are in the directory. An
149
+
SSD of the same tests is in the `discs/` directory.
150
+
- Some of Kevin Edwards' protection systems (stripped of the games themselves). These are extremely timing- and
151
+
correctness-sensitive when it comes to the timers and interrupts of the BBC.
94
152
- Some 65C12-specific read-modify-write tests written by Ed Spittles.
95
153
96
-
Tests can be run automatically if you have `node` installed - just run `make` and it'll ensure the relevant libraries are installed, then it'll run the tests.
97
-
Please note it can take a while to run the whole test suite.
154
+
Tests can be run automatically if you have `node` installed - just run `make` and it'll ensure the relevant libraries
155
+
are installed, then it'll run the tests. Please note it can take a while to run the whole test suite.
98
156
99
157
## Thanks
100
158
101
-
jsbeeb was heavily based on Sarah Walker's C [B-Em emulator](https://github.com/stardot/b-em) -- thanks to her for her hard work and for open sourcing her code. B-em is now being maintained by a group of enthusiasts - thanks to them too!
159
+
jsbeeb was heavily based on Sarah Walker's C [B-Em emulator](https://github.com/stardot/b-em) -- thanks to her for her
160
+
hard work and for open sourcing her code. B-em is now being maintained by a group of enthusiasts - thanks to them too!
102
161
103
-
Huge thanks to Richard Talbot-Watkins for his advice and help along the way in fathoming out the instruction timings, interrupt fun,
104
-
video code rewrite and for being such a good pal all these many years!
162
+
Huge thanks to Richard Talbot-Watkins for his advice and help along the way in fathoming out the instruction timings,
163
+
interrupt fun, video code rewrite and for being such a good pal all these many years!
105
164
106
-
Thanks to [Michael Borcherds](https://twitter.com/mike_geogebra) for his help; improving the keyboard layouts and handling in Javascript, reporting issues, chasing down
107
-
game bugs and much more.
165
+
Thanks to [Michael Borcherds](https://twitter.com/mike_geogebra) for his help; improving the keyboard layouts and
166
+
handling in JavaScript, reporting issues, chasing down game bugs and much more.
108
167
109
-
Thanks to [David Banks](https://github.com/hoglet67) (hoglet) for his help in testing the gnarly BCD flag behaviour on real live BBCs.
168
+
Thanks to [David Banks](https://github.com/hoglet67) (hoglet) for his help in testing the gnarly BCD flag behaviour on
169
+
real live BBCs.
110
170
111
171
Cheers to [Ed Spittles](https://github.com/BigEd) for testing various interrupt timing code on a real BBC.
112
172
113
173
Thanks to Chris Jordan for his thorough testing, bug reports, ideas and help.
114
174
115
-
A lot of the early development used the amazing [Visual 6502](http://visual6502.org/) as reference for intra-instruction timings. Amazing stuff.
175
+
A lot of the early development used the amazing [Visual 6502](http://visual6502.org/) as reference for intra-instruction
176
+
timings. Amazing stuff.
177
+
178
+
Special shout out to the users of the [6502 Forums](http://forum.6502.org/)
179
+
180
+
## More Information
181
+
182
+
I've written a lot about how the innards work on [my blog](http://xania.org) in
183
+
the [emulation](http://xania.org/Emulation-archive) section. I gave a presentation on how it all fits together at work,
184
+
and posted the [video up on YouTube](https://www.youtube.com/watch?v=37jyHQT7fXQ). I have another presentation at
0 commit comments