Discuss Scratch

RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

Home Computer - the full BBC Microcomputer emulator



https://scratch.mit.edu/projects/531881458/


Background information

BBC Micros were used in schools and colleges in the 1980's. This project is a full emulation of a BBC Micro and allows you to use one from within the confines of Scratch!

Games currently included

There are over 60 games included in the project. It also has the ability to import any BBC Micro disk image from the internet!

How can I import BBC Micro game images into the project?

To import a game, first download the ssd or dsd file (which is a BBC Micro single or double-sided disk file). Now go to www.rokcoder.com/bbcmicro and drag the file into the file-drop area. It will be converted to a usable format and put into the clipboard ready to be pasted into the project when you tap the load user-disk from code icon in the emulator. Once loaded in, to play the disk you need to press and hold the shift key, tap on the break button icon and then release the shift key once the disk has started playing.

Disk images that work but not with 100% accuracy
  • Elite (doesn't do the split-screen modes which is why the bottom section doesn't look great)
  • The Oregon Trail (Scratch resolution doesn't allow for display of 80 columns so we get word-wrap on a 40 column display)
Disk images that have been found to be unplayable
  • Boffin (uses overdraw which I can emulate but which won't fit into the space I've set aside for displaying the screen image)
  • Pharoah's Curse (uses light pen position and interrupt latch which is too insane)
  • Spear of Destiny (interrupt driven palette changes mean full screen refresh every single frame - would be incredibly laggy)
What is fully implemented

Pretty much everything! The full OS, the Disk Filing System, the BASIC ROM. The entire computer is emulated!

How do I program the computer?

I thoroughly recommend reading through the remastered BBC Micro User Guide. This will take you through every step of programming BASIC on the BBC Micro and will even touch upon the subject of programming in assembly language! You can view (or download) the manual from www.rokcoder.com/bbcmicro.

Should I store my disk codes here?

By all means - this is probably the best place to put them. But please make sure you enter them as follows -
[code]
Enormously long pasted disk code
[/code]
otherwise the message you leave will be huge!

What about sideways ROMs?

Sideways ROMs are the EPROMS used to expand the BBC Micro. Two examples are BASIC and Disk Filing System which are both included in the emulator. There are many other sideways ROMs ranging from word processors to Logo implementations. The emulator supports sideways ROMs so if there are any that you would particularly like to see in the emulator then let me know and I'll add them!

The built-in debugger

You'll see the debug button at the top left of the screen when looking at games in the emulator. If you tap that button you'll see the built-in debugger. I made extensive use of this for debugging the emulator while I was working on it.

Play - this shows a trace of the 6502 code as it is executing
Step - steps through execution one instruction at a time
Step 50 - steps through in steps of 50 instructions
Frame - steps through an entire frame (with the BBC Micro running at 50 frames per second)
Set BP - allows you to set a break point in the 6502. After hitting the play button, execution will stop when it reaches a breakpoint
Watch - display the value of a memory location (2 bytes) while stepping through or playing the project
Watch BP - allows a breakpoint to be set that is activated when the contents of the given memory location are updated
Clear - empties the log window. The window fills up extremely quickly. With 1000000+ lines it is going to start using a lot of resources!
Src+OS - toggles between including OS code. Any memory addresses above $8000 exist in the OS code
Analyse - sorts through the recorded log file to sort opcodes into order of frequency of use. This allowed me to concentrate optimisation efforts

More to add…

There are a lot more details and instructions that I could (and might) add. These include how to write your own BASIC or 6502 games using the emulator. How to use the emulated disk system to save your projects and much more…

Last edited by RokCoder (May 18, 2021 22:28:23)



Scratch dabbling for fun…

samq64
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

Have you found any websites that have ssd files for download?

Edit: never mind, I found one: http://johnwbishop.com/beeb.htm

Last edited by samq64 (April 20, 2021 13:24:38)

Vract0
Scratcher
100+ posts

The Beeb - a full BBC Microcomputer emulator

Is this using the original BASIC programming language? I'm assuming it does because “PRINT -2^2” prints 4. Also, do you have a good place where I (or other scratchers) can learn at the BASIC syntax, I'm currently using this website.

Hmm… Gibberish you see, I think not, a code it is…

If you need help… Click this. Highlight some of the text and press
(((ctrl) + (shift)) + (down)
arrow key to scroll down.

-….- .-.-.- / .-.-.- -….- / -….- / -….- -….- -….- / -….- .-.-.- .-.-.- -….- .-.-.- / .-.-.- .-.-.- / -….- .-.-.- -….- .-.-.- / .-.-.- -….- / -….- -….- -….- / -..-. / .-.-.- -….- -….- .-.-.- / .-.-.- .-.-.- .-.-.- .-.-.- / -….- -….- -….- / -….- .-.-.- / .-.-.- / -….- / .-.-.- .-.-.- / -….- .-.-.- -….- .-.-.- / -..-. / .-.-.- -….- / .-.-.- -….- .-.-.- .-.-.- / .-.-.- -….- -….- .-.-.- / .-.-.- .-.-.- .-.-.- .-.-.- / .-.-.- -….- / -….- .-.-.- .-.-.- .-.-.- / .-.-.- / -….-

atleD racsO )ecaps( eeknaY racsO mrofinU )ecaps( oliK rebmevoN racsO yeksihW )ecaps( yeksihW letoH aflA ognaT )ecaps( oemoR racsO ognaT ruoF neveS )ecaps( aidnI arreiS ?

Tango Hotel India Sierra (space) India Sierra (space) November Oscar Tango (space) India Mike Papa Oscar Romeo Tango Alfa November Tango Stop

x D66 J@F 4C24<65 E96 4@56] v@@5 ;@3 J@F?8 @?6] iX r@>>6?E Q*@52Q @? >J AC@7:=6]

Have a nice day

Execute Magical Disappearance :: #000080

Me when I get 20 views on a project.


colinmacc
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

samq64 wrote:

Have you found any websites that have ssd files for download?

Edit: never mind, I found one: http://johnwbishop.com/beeb.htm

http://bbcmicro.co.uk/ has a few…

Sample Projects

RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

Vract0 wrote:

Is this using the original BASIC programming language? I'm assuming it does because “PRINT -2^2” prints 4. Also, do you have a good place where I (or other scratchers) can learn at the BASIC syntax, I'm currently using this website.

For a downloadable guide I thoroughly recommend The BBC Micro User Guide. An older version of that guide can be viewed online here.


Scratch dabbling for fun…

whitehat1234
Scratcher
28 posts

The Beeb - a full BBC Microcomputer emulator

I don't know how to play it, it keeps reapeating the same thing over, over and over again
when green flag clicked
forever
show list [I am confuse]
if <See the same thing> then
broadcast [Explode]
end
end

when I receive [Explode]
set [Explode] to [1000000000000000000000000000000000000000000000%]
RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

whitehat1234 wrote:

I don't know how to play it, it keeps reapeating the same thing over, over and over again
Are you using the rokcoder.com link or the turbowarp one? And, if you're using the turbowarp one, are you copying the full link with all the additional parameters?


Scratch dabbling for fun…

whitehat1234
Scratcher
28 posts

The Beeb - a full BBC Microcomputer emulator

RokCoder wrote:

whitehat1234 wrote:

I don't know how to play it, it keeps reapeating the same thing over, over and over again
Are you using the rokcoder.com link or the turbowarp one? And, if you're using the turbowarp one, are you copying the full link with all the additional parameters?
em.. i don't know can you make a youtube tutorial on how…?
colinmacc
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

whitehat1234 wrote:

RokCoder wrote:

whitehat1234 wrote:

I don't know how to play it, it keeps reapeating the same thing over, over and over again
Are you using the rokcoder.com link or the turbowarp one? And, if you're using the turbowarp one, are you copying the full link with all the additional parameters?
em.. i don't know can you make a youtube tutorial on how…?

When you run the project in Scratch, it gives you a choice of link to use to run the project. Which one are you using?

Sample Projects

PizzasAreGreat
Scratcher
100+ posts

The Beeb - a full BBC Microcomputer emulator

RokCoder wrote:

whitehat1234 wrote:

I don't know how to play it, it keeps reapeating the same thing over, over and over again
Are you using the rokcoder.com link or the turbowarp one? And, if you're using the turbowarp one, are you copying the full link with all the additional parameters?
I use the rokcoder.com link and sometimes it doesn't work for me either. It thinks I am on scratch.

I need to refresh the page to make it work.

It is amazing but the paste button doesn't work well.
Below is the file I imported and the result. It cannot enter the same letter twice in a row.

Anyway, here is my disk.
555345522044495347554553532020240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004B00000003080320001923801601CC020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000D000A2E20F120224920414D2043484F53494E472041204E554D4245522042455457454E203120414E44203130220D00141420F1202254414B4520412047554553220D001E1520E9204E554D424552203D20B3283130290D00281320E92047414D454F564552203D20310D00320620F50D003C0B20E820475545530D00466120E720475545533C4E554D424552208C20F12022544F204C4F572E2054525920414741494E22208B20E72047554553203E204E554D42455220F12022544F20484947482E2054525920414741494E2E22208B2047414D454F5645523D300D00501120FD2047414D454F5645523D300D005A2720F12022434F4E475241545320594F552047554553454420544845204E554D424552220DFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Double click to copy then load it with the load user-disk from code button, enter
LOAD "GUESS"
to load it then enter
RUN
to play the game. (but yeah there are lots of grammar mistakes. Also it is my first BASIC program so please be indulgent.)

Last edited by PizzasAreGreat (April 21, 2021 08:15:42)



A cute puzzle game.
RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

For anyone who was finding they couldn't get past the link screen even when using the links, that issue is 100% fixed now


Scratch dabbling for fun…

njdavison
Scratcher
34 posts

The Beeb - a full BBC Microcomputer emulator

On Chuckie Egg I have to unmap Z then map space to jump to get the keyboard mapping to work. I'm using windows 10, Google Chrome, ENG UK keyboard. It feel like the default keyboard mapping is not right. Using default settings both Z and space act as jump action and there is no down button.

Featured Projects
RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

PizzasAreGreat wrote:

RokCoder wrote:

whitehat1234 wrote:

I don't know how to play it, it keeps reapeating the same thing over, over and over again
Are you using the rokcoder.com link or the turbowarp one? And, if you're using the turbowarp one, are you copying the full link with all the additional parameters?
I use the rokcoder.com link and sometimes it doesn't work for me either. It thinks I am on scratch.
I need to refresh the page to make it work.

This is fixed now

PizzasAreGreat wrote:

It is amazing but the paste button doesn't work well.

That's fixed now, too. Thanks for bringing it to my attention! Double letters shouldn't cause you any more problems.

PizzasAreGreat wrote:

enter
LOAD "GUESS"
to load it then enter
RUN
to play the game. (but yeah there are lots of grammar mistakes. Also it is my first BASIC program so please be indulgent.)

It's fantastic to see someone using the emulator to create programs - thanks for making my day! What's even better is that it's a lovely program and works really well.

As a side note, you can load and run a program in one step by typing CHAIN “GUESS”


Scratch dabbling for fun…

RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

njdavison wrote:

On Chuckie Egg I have to unmap Z then map space to jump to get the keyboard mapping to work. I'm using windows 10, Google Chrome, ENG UK keyboard. It feel like the default keyboard mapping is not right. Using default settings both Z and space act as jump action and there is no down button.
I've fixed the mapping now - thanks for pointing it out. I'd missed the “.” from the BBC mapping originally and must have neglected to update Chuckie mappings when it was fixed. Personally I prefer the original keys but most Scratchers seem to want arrow keys to do movement.

(Defaults will work properly now, too, for the game - feels so much better playing it that way!)

Last edited by RokCoder (April 21, 2021 11:07:22)



Scratch dabbling for fun…

njdavison
Scratcher
34 posts

The Beeb - a full BBC Microcomputer emulator

Testing the SOUND command
Ambulance from the BBC Micro Music Masterclass
To run this code in the BBC Micro emulator:
  1. From the command prompt enter AUTO (the auto number command)
  2. Enter the BASIC code below
    P=100
    FOR A=0 TO 15
    SOUND 1,-A,P+A,8
    SOUND 1,-A,P-20+A,8
    NEXT
    FOR A=15 TO 0 STEP-1
    SOUND 1,-A,P+A,8
    SOUND 1,-A,P-20+A,8
    NEXT
  3. Press ESCAPE when finished
  4. Enter LIST to check the program
  5. Enter RUN to run the program

Featured Projects
samq64
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

In the random hints and tips it mentions two things on your site that don't exist. Is that a mistake, or have you just not finished the site?
njdavison
Scratcher
34 posts

The Beeb - a full BBC Microcomputer emulator

Is there anything more satisfying than the sound of a Cobra Mk III pulse laser echoing in the emptiness of space?
  1. Load the user disk code below
    55534552204449534C415345522020240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004B00000003080320001923803C00CC020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000D000A29E220312C312C302C3131312C2D382C342C312C382C382C2D322C302C2D312C3131322C34340D001411D4202631322C312C302C2631300DFF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  2. Enter LOAD “LASER”
  3. Enter LIST to view the BASIC program
    10 ENVELOPE 1,1, 0,111,-8, 4, 1, 8, 8,-2,0, -1,112, 44
    20 SOUND &12,1,0,&10
  4. Enter RUN to hear the sound of a Cobra Mk III pulse laser echoing in the emptiness of space

Featured Projects
RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

samq64 wrote:

In the random hints and tips it mentions two things on your site that don't exist. Is that a mistake, or have you just not finished the site?
I've not had time to update the website accordingly. I'll modify the tips to point to the forum for now. Thanks for reminding me!


Scratch dabbling for fun…

njdavison
Scratcher
34 posts

The Beeb - a full BBC Microcomputer emulator

Is there a way to “Paste”/Import BASIC commands containing comma(,) characters?
I realise this is a scratch bug, import list ignores everything after the comma on a line.
Typing envelope commands was a 2 person job back in the day.
E.g. PRINT TAB(X,Y) SOUND C,A,P,D ENVELOPE…

Featured Projects
RokCoder
Scratcher
1000+ posts

The Beeb - a full BBC Microcomputer emulator

njdavison wrote:

Is there a way to “Paste”/Import BASIC commands containing comma(,) characters?
I realise this is a scratch bug, import list ignores everything after the comma on a line.
Typing envelope commands was a 2 person job back in the day.
E.g. PRINT TAB(X,Y) SOUND C,A,P,D ENVELOPE…
@kriblo has asked @garbomuffin if he can remove the CSV import format from TurboWarp so it might be possible in a few days time. @garbomuffin already fixed a few Scratch bugs that were in the way of the emulation working properly (bugs in the the sound playback preventing me from emulating the sound chip and in the keyboard handler preventing me from using shift-key combos accurately). He's been extremely helpful!


Scratch dabbling for fun…

Powered by DjangoBB