5 ms·
In the replies underneath, someone ran it on a real Acorn Electron computer (6502 at 1 MHz), where it completed in 8 hours and 40 minutes. Not too bad really.
by LeoPanthera 3y ago
In the replies underneath, someone ran it on a real Acorn Electron computer (6502 at 1 MHz), where it completed in 8 hours and 40 minutes. Not too bad really.
- kragen 3y agothat's astounding; i would have guessed months or years
- LeoPanthera 3y agoBBC BASIC is surprisingly efficient for an interpreted language. It kind of had to be, running on processors that slow.
- KerrAvon 3y agoSome good discussion of that on The BBC BASIC wiki entry: https://en.wikipedia.org/wiki/BBC_BASIC https://en.wikipedia.org/wiki/BBC_BASIC (paragraph beginning "Due to a number of optimizations[…]".
- crimbles 3y agoAlso you could swap out hot spots with assembly trivially as it had an inline assembler. And you had indirect pointers in it!
- mavhc 3y agoThe OP's code has REM based assembly it in to save space
- kragen 3y agois that assembly or is that the dithering table
- alphabetter 3y agoYes, the REM is the lookup table used in line 70. Because BBC Basic had a built-in assembler it was pretty uncommon for BBC programs to inline machine code as raw data (unlike some other computers from BITD).
- londons_explore 3y agojust a table of constants.
- kragen 3y agoall the basics i used on processors that slow were surprisingly inefficient, even for an interpreted languages i thought they had to be, running on processors with that little memory. though later on i learned about forth, which is surprisingly efficient for an interpreted language a more likely explanation is that sophie wilson was just a better hacker than bill gates and paul allen
- iainmerrick 3y agoYeah, BBC BASIC is really good. Both the language design and the implementation. I loved it at the time, and the more I think back on it the more impressed I am. Like it had a very decent suite of floating-point routines, which if I remember right were very performant. In a 32KB ROM!
- forinti 3y agoBasic was actually a 16KB ROM. MOS occupied another 16KB ROM.
- iainmerrick 3y agoDang, you're right, I was misremembering.
- crq-yml 3y agoSome of the improvement in BBC BASIC over Microsoft's BASIC is attributable to the larger ROM(the first Altair BASIC was just 4k), but it's also that the BBC Micro's 6502 and DRAM was clocked higher than contemporaries. It's just a faster, more refined 8-bit machine all around.
- bunabhucan 3y agoI recreated a mandlebrot zoom I saw in a library book in bbc basic and the last image took two weeks. I had 8 of them saved on a floppy and that would slideshow them for a 2fps "movie"
- kragen 3y agothat is fucking awesome, you are a legend
- PlunderBunny 3y agoI'm running this on a BBC micro emulator running at period-accurate speed, and it's taking just under a minute to draw one line. So I think it's going to finish in about 4 hours, which would make sense - approximately twice as fast as the Acorn Electron.
- PlunderBunny 3y agoUpdate: Finished in only 2 hours 30 minutes.
- deleted 3y ago[deleted]
- tom_ 3y agoThe Electron runs extra slowly in MODE 1 as the video system needs 100% of the RAM bandwidth to form the display. The CPU essentially ends up paused during the visible portion of each scan line, so the effective speed is probably more like 0.6 MHz.
- Sharlin 3y agoI wonder how much of that it spent just computing those square roots.
- araes 3y agoDoes anybody happen to know what SQR algorithm BBC Basic uses? http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin7.html#printhash http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin7.html#printha... does not seem to have the actual algorithm. Intel's optimization manual has suggestions for fast versions at 15.12.3 (recommended by @James https://stackoverflow.com/a/2637823/10981777 https://stackoverflow.com/a/2637823/10981777) Don't look especially long to implement for 22-bit approximation. https://software.intel.com/content/www/us/en/develop/download/intel-64-and-ia-32-architectures-optimization-reference-manual.html https://software.intel.com/content/www/us/en/develop/downloa... Also, what's the SQRD? Not finding that referred to anywhere.
- Sharlin 3y agoSQRD is just SQR D :)
- araes 3y agoThanks. So much more of that code makes sense now. IFD, SGNU, FORN, FORM. FORM especially. So many codes now have the word FORM as a special word. What a nightmare to read though if you don't know what it's supposed to be written like. Is it a: "FORM=" or a "FOR M=" ? Is it: "S GNU:G", "SG NU:G", "SGN U:G"? SQRD totally looks like some special kind of square root implementation.
- Sharlin 3y agoYeah, early BASICs tended to let you skip the spaces, and in fact it sometimes did have a measurable effect on parsing/execution speed. And of course on file size too… Additionally, at least C64 Basic had two-character shorthands for all keywords.