Hacker News new | past | comments | ask | show | jobs | submit login
BBC Basic Editor (bbcmic.ro)
255 points by mnem on Nov 30, 2020 | hide | past | favorite | 50 comments



So, one of the authors here: we just announced this site on https://twitter.com/bbcmicrobot/status/1333496146400985088 after being caught a little off-guard with this HN post! We still have a bunch of things to improve on, so please let us know and file issues (https://github.com/mattgodbolt/owlet-editor/issues) and we'll try and improve things!

Thanks!


I never had a BBC Micro having grown in up the US. I was happy to discover that the BASIC on it is close to the Microsoft implementations that I am familiar with.


This is cool. It would be great if the editor linked to good docs/walkthroughs.


That's definitely the hope. The Examples tab is supposed to be more of that, currently we hacked it to point at the more complex demos, but we have some ideas on making more "tutorial" like content.


As someone who was plonked before a blinking BBC Micro cursor to entertain themselves as a kid, I consider this cheating!



I've been enjoying this account[0]--shared on HN several times--that showcases of tweet-length BBC Micro programs. Similar to dwitter.net and Processing sketches appearing under the hashtag ##つぶやきProcessing[1] and more recently #tinycode[2] they've been great quarantine diversions into code golfing on social media.

[0] https://twitter.com/bbcmicrobot

[1] https://twitter.com/tweetprocessing

[2] https://twitter.com/search?q=%23tinycode


From the 'About' section:

A simple, modern editor for BBC BASIC inspired by [BBC Micro bot](https://www.bbcmicrobot.com/)

Created by [8bitkick](https://www.github.com/8bitkick) and [mattgodbolt](https://twitter.com/mattgodbolt).

The microbot site has quite a few demos which were also published as tweets. Looks awesome!


I was confused for a minute why the British Broadcasting Corporation was developing a BASIC editor


It's for the BBC Micro. Which really _is_ named after the British Broadcasting Corporation. https://en.wikipedia.org/wiki/BBC_Micro


I've never seen one of these in person or in emulation, but on seeing the terminal font, I was immediately and subliminally motivated to type:

  PRINT "LOOK AROUND YOU ";
  GOTO 10


Thants.


thanks z2,

thz2


10 I=I+.3:J=J+.34:H=ABS(SIN(I)* 27):W=ABS(SIN(J)* 27)

20 PRINT TAB(H)"HELLO":PRINT TAB(W)"WORLD":GOTO10


I humbly suggest "5 MODE 0" for the best experience.


Oooh, much better indeed, thank you!


This is great. I was trying to pick a language to teach my kid and I wanted to start with BASIC as that's what I learned as my first language, but I couldn't find a working editor that could compile and run by click of a button. So I started with python. But I think BASIC would be easier to teach. This will allow me to do that.


How's that going? I learned on BASIC around 1990 but it was cool then because you could do things that were in-line with the fun/game state of the art.

Today what you can do in BASIC is "boring" compared to the most "basic" fun the kid can have on the iPad. Are you finding traction?

Asking for my son who's currently 4 months :)


You've maybe (probably?) heard of it but Scratch (https://scratch.mit.edu) is a good "code-like" system for when kids are really young. You still have a way to go from 4 months of course, but I imagine it might be a bit easier to gain traction with something graphical (and colorful, and animated, etc.) than with what amounts to text editing.


Yeah we tried that.


We just started. It takes time for it to click. But we are making progress. I enjoy seeing his face light up when he writes something that works as intended.


You could check out BlockStudio [0], a programming environment without text (I created it). It might make teaching/explaining computational concepts more tractable with such a young child.

[0] https://www.blockstud.io


I was going to comment on how can I finally code the games whose source code was listed in the books published by Usborne (or Editorial Plesa for Spanish-speaking folks). Urborne had this books hosted in their website, but the links have expired and no mention of the books is anywhere in their website. Internet Archive comes to the rescue: https://archive.org/details/vgmuseum_usborne-hayes_weirdgame...

Anyway, as someone who had a PC and GWBASIC or Microsoft QBASIC it was weird for me that these books mentioned all these platforms which I couldn't find anywhere around my small place in the world. Maybe now I can now run these as the author intended.


I got an old game from a magazine and pasted into the editor, didn't like for some reason.

edit:it was leading spaces before the line numbers that had broken it - got rid of them and it works.

OK so take this code below, strip off the leading spaces (thats important) and paste it into the box.

Its a helicopter game, controls are Z,X,M,K for left, right, up and down. You have to collect the asterixes.

The controls wont work in the right hand pane but if you press the JSBeeb button at the bottom it will port your code to JSBeeb where it does run

"Helicopter" by David Johnston from Acorn Computing magazine, 1994

  10 MODE1
  20 TIME=0
  30 VDU 23;8202;0;0;0;
  40 VDU 23,130,248,63,0,0,0,15,57,96
  50 VDU 23,131,0,255,16,16,16,19,215,126
  60 VDU 23,132,0,252,31,0,0,192,0,0
  70 VDU 23,133,0,0,0,0,0,48,72,132
  80 VDU 23,134,192,128,128,192,127,127,31,0
  90 VDU 23,135,63,63,63,63,255,254,254,130
  100 VDU 23,136,255,255,248,128,0,0,0,0
  110 VDU 23,137,228,132,72,48,0,0,0,0
  120 VDU 23,138,0,31,63,31,0,0,0,0
  130 VDU 23,139,130,255,255,255,0,0,0,0
  140 VDU 23,140,0,240,248,240,0,0,0,0
  150 VDU 23,141,85,85,255,0,0,0,0,0
  160 VDU 23,142,255,255,195,195,195,195,255,255
  170 VDU 23,143,24,126,126,255,255,126,126,24
  180 A=35:B=15
  190 FORZ=1TO38:PRINTTAB(Z,31);CHR$(141);:NEXT
  200 S=0
  210 BA2=0:BB2=0:BL2=0
  220 BA=-6:BB=20:BL=7
  230 BA3=0:BB3=0:BL3=0
  240 CA=0:CB=0
  250 PROCdraw
  260 QT%=TIME+8:IF INKEY(-71)=-1 THEN PROCup
  270 IF INKEY(-102)=-1 THEN PROCdown
  280 IF INKEY(-98)=-1 THEN PROCleft
  290 IF INKEY(-67)=-1 THEN PROCright
  300 PROCbuilding
  310 PROCsidec
  320 PROCcir
  330 IF (CA=A AND CB=B+2) OR (CA=A+1 AND CB=B+2) OR (CA=A+2 AND CB=B+2) THEN CA=0:S=S+10
  340 IF TIME>10000 THEN CLS:PRINT"Out of time":PRINT:PRINT"You scored ";S:GOTO1260
  350 REPEATUNTILTIME>QT%:GOTO260
  360 DEFPROCup
  370 IF B=1 THEN ENDPROC
  380 PROCundraw
  390 B=B-1
  400 IF (INKEY(-98)=-1 AND A>1) OR (INKEY(-67)=-1 AND A<35) THEN GOTO 410 ELSE PROCdraw
  410 ENDPROC
  420 DEFPROCdown
  430 IF B=28 THEN ENDPROC
  440 IF A+3>BA AND A<BA+BL AND B=BB-3 THEN PROCdie
  450 IF A+3>BA2 AND A<BA2+BL2 AND B=BB2-3 THEN PROCdie
  460 IF A+3>BA3 AND A<BA3+BL3 AND B=BB3-3 THEN PROCdie
  470 PROCundraw
  480 B=B+1
  490 IF (INKEY(-98)=-1 AND A>1) OR (INKEY(-67)=-1 AND A<35) THENGOTO500 ELSE PROCdraw
  500 ENDPROC
  510 DEFPROCleft
  520 IF A=1 THEN ENDPROC
  530 PROCsidec
  540 PROCundraw
  550 A=A-1:PROCdraw
  560 ENDPROC
  570 DEFPROCright
  580 IF A=35 THEN ENDPROC
  590 PROCundraw
  600 A=A+1:PROCdraw
  610 ENDPROC
  620 DEFPROCsidec
  630 IF B+3>BB AND A=BA+BL THEN PROCdie
  640 IF B+3>BB2 AND A=BA2+BL2 THEN PROCdie
  650 IF B+3>BB3 AND A=BA3+BL3 THEN PROCdie
  660 ENDPROC
  670 DEFPROCcir
  675 COLOUR3
  680 IF CA=0 THENGOTO730
  690 PRINTTAB(CA,CB)" "
  700 IF CA=38 THEN CA=0:GOTO740
  710 CA=CA+1
  720 PRINTTAB(CA,CB)CHR$(143)
  730 IF CA>0 THEN ENDPROC
  740 IF POINT(36,100)=2 THEN ENDPROC
  750 IF RND(10)>1 THEN ENDPROC
  760 CA=1:CB=RND(5)+20
  770 ENDPROC
  780 DEFPROCdraw
  785 COLOUR1
  790 PRINTTAB(A,B);
  800 VDU130:VDU131:VDU132:VDU133
  810 PRINTTAB(A,B+1);
  820 VDU134:VDU135:VDU136:VDU137
  830 PRINTTAB(A,B+2);
  840 VDU138:VDU139:VDU140
  850 ENDPROC
  860 DEFPROCundraw
  870 PRINTTAB(A,B);"    "
  880 PRINTTAB(A,B+1);"    "
  890 PRINTTAB(A,B+2);"   "
  900 ENDPROC
  910 DEFPROCbuilding
  915 COLOUR2
  920 IF BL=0 THENGOTO980
  930 IF BA<1 THENGOTO950
  940 FOR Z%=BB TO 30:PRINTTAB(BA,Z%);" ";:NEXT
  950 IF BA>38-BL THENGOTO970
  960 FOR Z%=BB TO 30:PRINTTAB(BA+BL,Z%)CHR$(142):NEXT
  970 BA=BA+1:IF BA=39 THEN BL=0
  980 IF BL2=0 THENGOTO1040
  990 IF BA2<1 THENGOTO1010
  1000 FOR Z%=BB2 TO 30:PRINTTAB(BA2,Z%);" ";:NEXT
  1010 IF BA2>38-BL2 THENGOTO1030
  1020 FOR Z%=BB2 TO 30:PRINTTAB(BA2+BL2,Z%)CHR$(142):NEXT
  1030 BA2=BA2+1:IF BA2=39 THEN BL2=0
  1040 IF BL3=0 THENGOTO1100
  1050 IF BA3<1 THENGOTO1070
  1060 FOR Z%=BB3 TO 30:PRINTTAB(BA3,Z%);" ";:NEXT
  1070 IF BA3>38-BL3 THENGOTO1090
  1080 FOR Z%=BB3 TO 30:PRINTTAB(BA3+BL3,Z%)CHR$(142):NEXT
  1090 BA3=BA3+1:IF BA3=39 THEN BL3=0
  1095 IF CA=1 OR CA=2 THEN ENDPROC
  1100 IF BL=0 AND (BA2>2 OR BL2=0) AND (BA3>2 OR BL3=0) THENGOTO1120
  1110 GOTO1140
  1120 IF RND(10)>1 THENGOTO1140
  1130 BL=RND(10)+5:BA=1-BL:BB=RND(10)+10
  1140 IF BL2=0 AND (BA>2 OR BL=0) AND (BA3>2 OR BL3=0) THENGOTO1160
  1150 GOTO1180
  1160 IF RND(10)>1 THENGOTO1180
  1170 BL2=RND(10)+5:BA2=1-BL2:BB2=RND(10)+10
  1180 IF BL3=0 AND (BA>2 OR BL=0) AND (BA2>2 OR BL2=0) THENGOTO1200
  1190 GOTO1220
  1200 IF RND(10)>1 THENGOTO1220
  1210 BL3=RND(10)+5:BA3=1-BL3:BB3=RND(10)+10
  1220 ENDPROC
  1230 DEFPROCdie
  1240 CLS:PRINT"You have crashed"
  1250 PRINT:PRINT"You scored ";S
  1260 FORT=1TO3000:NEXT:*FX15,1 
  1270 PRINT:PRINT"Press any key to play again"
  1280 A=GET:RUN


Also a bat and ball game here, its not very good though:

https://pastebin.com/dntnb8es


> OK so take this code below, strip off the leading spaces (thats important) and paste it into the box.

I'm sure you really mean print it out then type it in, line by line.


I'll have my friend read it out to me letter by letter while I type it in


Thanks! I'll note the leading spaces bug!


...and it should now be fixed!


Hey, this is awesome. Such a throwback! I noticed that some of the characters aren't what I'd expect, any reason?

PRINT ASC("\") " " CHR$(92) : PRINT ASC("/") " " CHR$(47)

47 prints fine, but 92 reveals a symbol "12" in super/subscript.

Some of the others are also off, e.g. the arrow sequence revealed by 10 FOR A= 1 TO 255 STEP 1 : PRINT CHR$(A) ;: NEXT

shows down arrow suffering the same.

Thanks, can't wait to see where this goes next!


Oh, discovered from the other comments here that if I do a `MODE 0` then the character set changes to what I'd expect. Will look into that. So this one works for me now, cheers :D

5 MODE 1

10 IF RND(1) > 0.5 THEN PRINT CHR$(92) ;: ELSE PRINT CHR$(47) ;:

20 GOTO 10


This is good.

Loved early BBC Micro Bot, then amazing seeing ppl pushing demoscene-level FX on it, but the code's all shrunk & obfuscated, taking away from BASIC spirit: being able to see the sequences & be inspired to learn & create, how BASIC got me in my youth & onwards :)


Is my browser bad or is there a reason whitespace is missing even from Expanded view?

Is it because the programs are supposed to fit into tweets? (Yet another way good ideas get crippled by Twitter?)


Is there any modern development system/language/whatever that lets us directly draw pixels and play notes with single commands/calls without any setup or preparation?


Check out Processing!

https://processing.org


Processing seems to use a draw() event, unlike Basic where you can just issue graphic commands anywhere as you go.


If you write your code only within the draw() function (which is pretty common), it's the same as an infinite loop around your code. If you want it to execute just once, just call noLoop() at the end of your setup.

Elsethread there's also links to tweets involving a "golfified" version of Processing if that's what you're looking for.


Cool!

The Examples tab shows the same 2 examples repeated, at least for me it does.


We are still working on it! :) It was a placeholder, we just replaced with something else, but the hope is to have some great resources for folks learning BASIC, as well as some impressive demos.


Taking "20 GOTO 10" to an entirely new level. Well played, Owlet.


Does INPUT work?


Not on this site, but click the "jsbeeb" button underneath the emulator to open the code on a full emulator.


This is great, BBC Micro Bot is the best bot on the internet :-). Now they make the entry barrier even lower.


10 PRINT doesn't seem to be working for me

> 10 PRINT CHR$(205.5+RND(1)); : GOTO 10


Isn't that just for the Commodore machines/petscii?


Indeed. RND works differently on the BBC.


Those old CGA colors. Wakes up all kind of memories.


wish it could have been called: BBE Basic Editor. Of course its BBC Basic, not BBE Basic, so there's that.


BBC BASIC Console


ah! thank you


ah yes another paradox




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: