Это видео недоступно.
Сожалеем об этом.
Sinclair BASIC vs BBC BASIC - How to fit an entire devkit inside 64K
HTML-код
- Опубликовано: 30 сен 2023
- Just how did 8 bit computers like the ZX Spectrum or BBC Micro manage to cram an entire programming language into their tiny systems, and still have space for the user's programs?
Let's compare two systems of the time - the low end ZX Spectrum that tried to cram as much computer as possible into as little as possible, and the more luxurious BBC Micro that included a complete assembly programming environment.
In the 1980s software for home computers was either written in BASIC or written in assembly language. Unlike today where we can load an IDE, write our code on multiple monitors and then run and debug our compiled code with ease, the computers of the 1980s were stuck with running BASIC. That's all there was, BASIC. Beginner's All Purpose Symbolic Instruction Language. It's all these early machines ran.
And they ran it slowly. BASIC is an interpreted language, translating each line of BASIC into machine code as it is run. This is completely different to compiled languages which do the translation all in one go. However on an 8 bit machine with only 64K of address space, this was all they could manage for the most part. If programmers wanted more out of the machine they needed to write in assembly language.
The problem with writing assembly language is that it needs compiling all in one go, which means the compiled code needs storing somewhere. And on a machine with only 64K of address space, with up to 32K of that being consumed by the system ROMs, there's nowhere to put the compiled code. Even worse, most of these machines initially used tape to store data. Early assembly programmers were reduced to hand assembling code on paper before then writing a short BASIC loader program to manually insert the machine code into RAM.
To help reduce the memory requirement of the machine's ROM code, Sinclair used a curious and unique method of keyword entry in their version of BASIC. Instead of typing out characters as normal, each key on the keyboard was assigned multiple different words. When in keyword entry mode, pressing a letter would automatically type out an entire BASIC keyword. This wasn't a time saving feature, it was a memory saving feature. Each BASIC keyword on the Spectrum takes up one byte because each keyword is assigned a character code from the Spectrum's character set, exactly the same way regular letters and numbers are.
This means that the machine only has to store codes that represent key words, effectively parsing and tokenising the BASIC instructions as they are being typed in by the user. The user literally cannot type in BASIC that won't parse unless they get hideously confused by the keyboard layout and its numerous shift key states. It was not a pleasant way to write code.
By contrast the BBC Micro had a powerful BASIC interpreter, ran its own operating system and even had a built in assembler running in the BASIC interpreter. You could mix BASIC and assembly code together and the machine would just compile the assembler and run it amongst the BASIC. The BBC also implemented "sideways ROMs" using a form of bank switching so more programs could be accessed without needing to load off tape or disk. This gave the BBC Micro much more functionality compared to the cheaper and simpler Spectrum.
It's quite interesting seeing the different tradeoffs and design choices two hardware manufacturers came up with. On one hand Sinclair were trying to make a cheap computer, and on the other hand Acorn were building a computer worthy of being used in schools across the country.
Blog Post: ncot.uk/sincla...
Support
-------
Support me by simply clicking the "like" button or pressing "subscribe"! That's it. No hard sell, just let me know you saw this video and thought it worth watching for more than 30 seconds. These videos take time and effort to make, and if people watch them they'll keep coming out.
If you think my efforts are worth a bit of pocket change, feel free to go to my Ko-fi link
ko-fi.com/ncot...
Video by Bedrijfsfilmspecialist.nl: www.pexels.com...
Video by Mikhail Nilov: www.pexels.com...
Machine icons created by Eucalyp - Flaticon: www.flaticon.c...
Code icons created by Secret Studio - Flaticon : www.flaticon.c...
Binary code icons created by Freepik - Flaticon : www.flaticon.c...
Cpu icons created by Freepik - Flaticon : www.flaticon.c...
And the award for Best Time Traveller (from the future) goes to Sophie Wilson for BBC BASIC with inline 6502 assembly language. 🏆
"Real programmers" have no idea what they are looking down their noses at.
Great video... I like the spider that drop down over the monitor on the right at 2:30
Comes in for an encore at 2:40 and 7:29 discovered at 16:29 never to be seen again... RIP Spider...
I'm a ZX Spectrum fan. The trigger for me was ZX81 manual (yes I started on ZX81). It showed an example of a BASIC program that draws a clock. It used sin and cos functions to draw a circle and I was immediately hooked up. Later I switched to Z80 assembler and pretty soon I knew all about ZX Spectrum, both hardware and software. I had a book ZX Spectrum ROM disassembly which is still available online. I can still recommend 8-bit enthusiasts to search for this book if they want to learn all the ins and outs of an 8-bit computer. Another book, perhaps that one should be read first is Rodnay Zaks Programming the Z80. I later resumed my career in IT and I can thank a lot to my initial experience on 8-bit computers.
I was a maths teacher in the 80’s in which ‘computer science’ fell under my subject area. Nice to see that hours of teaching BBC Basic has paid off for so many people. I hope your spider will help you to sort out any future programming bugs that you might come across 🕸️ 😅
I wondered if anyone else noticed. At first I thought it was a screensaver, because it moved so smoothly that it looked almost artificial…
Oh! When I wrote my first comment I‘d only seen its first, stealthy appearance at around 2:30, but obviously it overcame its stage fright and came out again. 😁
South of France. November 12, 1983. My father handed me a black box "Sinclair ZX Spectrum" and said : "Open the box, read the book and have fun".
20 minutes later on the little B/W tv I saw a message : "(c) 1982 Sinclair Research Ltd.". Thanks dad!
2:41 … spider enters… waits… exits 🕷️
I was just scanning the comments to see if anyone else had noticed!
@@TheNemorosa I thought it was actually on my TV. It was heeeeeeeuuge!! 🕷️
Spiderman: "Hello youtube"
*sees youtuber*
"OH SHI-"
My school started a computer club and we saved for an RML 380Z. Nobody had even seen a computer at that point. The next Christmas a few of the club members goto ZX80s, and the Christmas after I got a ZX81. Everything changed for me when a year later I discovered FORTH. FORTH encourages you to expend the language, and before long you are writing your own FORTH from scratch. This is a right of passage with FORTH. I recently took a FORTH I had written in my teens and made it into a BBC Micro ROM, something I always wanted to do back in the day, but didn't have the money for all the hardware you needed to burn and program ROMs. FORTH It still remains my favourite language, even though I'm a professional C++ developer these days.
380Z and FORTH....... are you my cousin or something?!?! :) ....... although, admittedly, I took an easier approach and just got myself a Jupiter Ace
@@edgeeffectSo you're the ONE who bought a Juliter Ace! I bet Jupiter Cantab had a plaque on the wall with your family details, where it was bought and how much you paid before and after VAT. Written in RPN. 😉
awesome. imo, the GENIUS of BASIC as a beginner's language is that it's POSSIBLE to hit the limits and feel the need to move on. how gratifying is that as a student of programming, especially a kid, to have seen the entire landscape of what is possible, that you see all the nook and crannies and now you want more and you understand why you want it. imo, that's the magic of 8 bit programming... peeking and poking to bare metal, understanding the memory layout, actual exposure to assembly from within basic even. imo, modern 8 bit computers with basic should absolutely be a kid's first computer.
Hard disagree, especially for Sinclair Basic. Pascal was far better if you wanted a learning language at the time.
the Agon Lite is that exact computer, and it's very affordable and readily available - the board's designer intended it it be educational and to enable all manner of educational exploration. It's probably a vaild claim to say it also has the fastest BASIC based on a Z80 port of BBC BASIC
There's a case to be made for restarting production of a couple of the 80s 8-bit machines. As fond as I am of my time on the C64, I'd be inclined to nominate the BBC micro because of its integrated assembler. The Agon Lite and X16 are both serious contenders for the return of 8-bit; unfortunately, both of them have too many modern peripherals to give the true flavour of how it used to be.
@@Ensign_Cthulhu Only in extremely small runs, don't let internet popularity fool you into thinking this is a real market on its own. There is no reason to use these machines over almost anything available now aside from nostalgia. A cheap pi clone provides all of the same learning opportunities, which is exactly why the one built into a keyboard is a successful product.
@@Ensign_Cthulhu The only thing really modern, out-of-place about the X16 is its FPGA for its graphics subsystem. Everything else harkens to the 1980s.
But it's an impossibility for maker hobbyist to implement something comparable to the C64's SID and VIC-II custom chips outside of using an FPGA - or a modern microprocessor that emulates such functionality in software.
There is NO possibility to implement those complex custom chips outside of those two approaches and, of course, no contemporary company with sufficient fab capabilities could be talked into fabbing such custom chips again just to serve a niche hobbyist market.
Therefore the only 8-bit computers that can be implemented today and avoid using a modern FPGA chip or microprocessor are going to be the Apple I and Apple II, or Z80 CP/M computers. Well, there are certainly plenty of kits and such around for those, but most people aren't enticed by that alone. They want the cool graphics and sound capabilities of the C64 and Atari 8-bit computers to play with - to run more enticing games and even learn to develop such themselves.
So the X16 went the FPGA route for graphics and with a real hardware sound chip. The Agon Lite went with an ESP32 microprocessor to achieve its graphics and sound capabilities (is a dual core cpu so a core is pinned for graphics and the other pinned for sound).
The Agon has a Z80 port of BBC BASIC, which supports inline assembly. It's easy on the pocket book for any retro hobbyist.
The X16 delivers more of the entire experience and its graphics subsystem puts it nearly in the league of Amiga 2D graphics. A bit more spendy so will be for the retro hobbyist that's somewhat more steeply into the hobby.
At the risk of being pedantic, BASIC interpreters never converted programs to machine code. Instead they tokenised the lines as they were entered. On running they looked at each token and processed them on the fly. So a PRINT token would call a routine that would look at the following tokens for variables or expressions then evaluate them and print the values or results.
One feature that seems to be unique to BASIC is that the tokenised code can be easily turned back into ASCII for listing or editing. That meant it had to store things such as variable names and line numbers which probably made it a lot slower than something such as the Pascal P code system.
There are some that convert to Java byte code.
Remember when every computer course had to teach the distinction between compiled and interpreted? But just to be even more pedantic: variable names were also tokenized in most cases, with the tokens being indexes to a symbol table holding the actual name strings. Also, a big reason most 8-bit BASICs were slow was because most of them followed the model of Bill Gates' interpreter, which used a linked-list format to store the lines, so that a list of nodes (one for each line, potentially thousands) had to be searched to find the right line number every time a GOTO or GOSUB was encountered. :/
@@gregmark1688 The ZX80 and ZX81 basic left symbols names in plain text in your code. A lot of basics stored the length of the line at the start of the line rather than the address of the next line. With a line length limit of 255, you save a byte per line.
My TRS80 did it in only 12k, but had to leave out some functions to do this. It also had this awful "garbage collector" to tidy up string variables to get rid of fragments, which caused programs to "freeze" for a moment or 6. Incidently, the Pascal P system ran slower than one compiled directly into native code. Similarly, the Psion Organiser's OPL language is a sort of BASIC that "tranalates" into a sort of P code they call Q code, which makes it faster than direct interpritation - the ROM interprets the Q code, which is much smaller than native 6303 code would have been.
@@roysainsbury4556 The Synclair ZX80 fit BASIC into 4K. They did this by mostly "leaving out *ALL* the functions. It was a 16 bit integer BASIC with nearly no string processing.
There also was one waaay back when that ran on a micro controller that was really tiny but had a significant collection of functions. This is not counting the fact that LXYZ$(A$,2) did the LEFT$ function.
Your TRS80 and many others shows that given the incentive, programs can fit in small space and still be very useful. Today the "hello world" program would likely be several Meg.
It's great to see vids like this. Retro tutorials and info are enjoyed by a small but enthusiastic group who appreciate it
What I love the most, is the spider hanging on it's web at 2:33., right next to you. I guess she wanted to know about BASIC too. I've even scratched my screen thinking it was on my monitor...
I've had countless PCs and laptops over the years. I really which I'd kept my BBC computer, so easily interfaced, such a clever language. I hand disassembled the Basic ROMs, very tidy structure, I learned so much from it. Later, Pascal and Forth.
I loved cranking out BASIC code on my CoCo II and later on my Osbourne followed by the Tandy HX and 286 and finally the 486sx.
Good times !
The spider made an appearance after about two minutes, then left to sit and watch the rest of the video haha
My first computer (and social life destroyer!) was a ZX Spectrum 48k, Christmas 1983 (still own it today). Before that I had been introduced to programming in Asda of all places - seeing older kids typing things in and copying them when I finally got to have a go. Many a weekend shopping trip was then spent writing basic programs in the various shops that had computers on display back in the day - until staff/security/parents moved me on...fun times.
Very similar story for me! Christmas eve in bed and could hear someone turn up and was talking to my parents. I came downstairs in the morning and my Acorn Electron was already sitting below the living room TV! I had no tape leads (they forgot them!) so I had to learn Basic on Christmas and Boxing day at my nans house. I never looked back, and have been in Software Development ever since.
Started on a Spectrum 48k dead skin. Its sill in my loft today, and yes I built as a career as a Software Dev and an IT Consultant
My first computer was a TI-994/a left in the trash across the street, with one crappy game, and no storage. I wrote my source files in a notebook, and typed them in every time I wanted to work on it. I'm a successful web developer today.
I borrowed a ZX 81 when an apprentice colleague brought it to work and offered to lend it me. I got hooked very quickly, and bought a Spectrum as soon as he asked for it back. It launched a programming career initially in games for sixteen years, and then more serious stuff, which lasted over 37 years. I worked on games (mostly in assembler) for just about everything, including the consoles and Acorn's Arm based systems from the very start. I retired this year from it all having reached 66 a few months ago.
Always love watching your videos! Thanks. I was a ZX Spectrum owner. 48K and hated how to enter BASIC with keywords. I must admit I would have loved even an Electron, to get into Assembly language programming in basic. It was such a neat idea.
I learned BASIC on a PDP-11, so the moment a Sinclair Spectrum came in, I already knew my way about. Sure, the machine had quirks - but it wasn't that bad. Note, I didn't restrict myself to ZX Basic alone. I did Forth, Pascal, Z80 assembly, Prolog and later even C on that machine. I've ported TI/99 4a BASIC programs - and lots of ZX81 BASIC programs (including the quirky "graphics").
I ported several PDP-11 BASIC programs to ZX Basic as well. One of them I later even *reconverted* to my own Forth compiler. Speaking of Forth, I developed a quite capable BASIC in that Forth. And I can tell you once you've assembled a token, you *still* convert it to a "number" in order to speed up later (parsing and semantics) operations.
you got spidy in the background.. LOL
Loved the guest appearance of the spider!😂
Top notch writing and presentation
Mine was the ZX81 then the ZX Spectrum great I was 14years old loved them both
Just to point out - BBC Basic was also tokenized even though it didn't use Sinclair's hunt and peck method of keyboard entry. In fact, I'm pretty sure all the widely available BASIC interpreters used tokenized representations of code to save space.
Yes, this is correct. I started off using a Commodore PET and soon discovered that the BASIC keywords were all tokenised. What was really weird, though, was that the Disk commands in BASIC 4.0 were tokenised to different values compared to those that were added (along with the graphic commands) to the C16 and Plus/4 with their BASIC 3.5 and the later C128 with its BASIC 7.0. This meant that you could load a program written for a BASIC 4 PET onto a BASIC 3.5 or 7.0 device to find that any Disk commands would come up as different keywords - very confusing!
Was the source code on the Beeb stored in tokenised form? I recall people writing BASIC on there with no spaces to save space. It was harder to read, but it still worked. Did keywords like PRINT only take a single byte, like on the Spectrum?
@@Inaflap Yep - when a line of BASIC code was entered it was parsed and stored in a tokenized form.
You can test this by typing in something like 10 PRINT "HELLO" and then changing the PRINT token with ?(PAGE+5)=&F2 which will result in 10 PROC "HELLO"
Oh yes, so it does. Ta. @@EdCourtenay
The difference is that it still had to tokenize it, it just did it right after input instead of when interpreting. The ZX Spectrum didn't have to tokenize at all, because you entered the tokens directly. Basically, the task of tokenizing was delegated to the user.
My first exposure to computers was an HP 2114A minicomputer with a Teletype 35 terminal at a nearby community college. Programming was done in HP BASIC. The interpreter used 6 kbytes, leaving just 2 kbytes for user programs. Personal computers were just a gleam in the eye of a few enthusiasts.
Sinclair: "Time is money, we don't have the time to add joystick commands, so here's a readout of IN 31 and an INKEY$ command"
Users: "What if we need to go into Assembly mode?"
Sinclair: "Not my problem"
Great presentation.
BBC Basic was often hailed as one of the fastest implementations on an 8-bit microcomputer, and one of the resons for that was that it used a whole 16K for the interpreter alone, with another 16K ROM for the operating system.
Compare that to the Spectrum's 16K total ROM for both tasks. There are several other reasons for Sinclair BASIC being slow, but that's almost a book's worth in itself.
That was for more than just speed. By separating the OS and the BASIC interpreter the machine didn't actually need BASIC to be installed to be useable.
Instead of a BASIC ROM you could have a word processor ROM, a terminal emulator ROM, etc and the machine would be limited to that specific function.
Alternatively you could have a another programming language added as another ROM and choose which one to use.
All the ROMs would occupy the same 16k address space of the 6502. By switching between the ROMs (known as sideways ROMs) in that address space the different application would be run.
Just like the CP/M machines, the OS provided the interface with the hardware whilst the application[1] (in the BBC case from a ROM instead of loaded from disk) used that interface.
[1]Application like GWBASIC of the IBM PC.
It turns out that, when the benchmarks are normalised against CPU speed, 6502 BBC Basic wasn't actually much, if any faster than many other 6502 versions of BASIC. The BBC Micro used a fast 2 MHz 6502 (for the time) plus new and expensive 4 MHz memory, which gave it a hig speed boost. Of course, Sinclair and standard Atari BASIC were notably slow, along with several others, where cost was a consideration but functionality was important. Commodore were the worst, throwing out BASIC performance AND funtionality! 😁
@@another3997
Using the fast, expensive, 4 MHz memory gave the BBC a speed boost as both CPU and other hardware could access it at full 2MHz speed, unlike, say, a QL where the bottom 32k of memory was slower than the rest of memory for the 68k8 processor as the CPU had to wait if the screen display hardware needed to access it.
The Acorn Atom (precursor of the BBC) didn't interlace the memory access hence why you'd get "snow" on the screen if the CPU was accessing it at the same time as the display hardware; unless you waited for the screen flyback (blank period between displayed "frames") to update the screen memory.
Hi - Started with Timex/Sinclair 1000 my dad bought at a grocery store in 1983 for $50! Then went to the T/S 2068 and C64 from there as the 80's went on. Learned to program and do some machine code
It was amazing time my first 65 or 28 bit processor was Apple 2 the way we learned to hack the basic to extend it with new commands to write assembly code in order to fit the program inside it to make it to run fast it was amazing however when Merlin came writing assembler became a joy
I was born in the mid nineties, so I can just barely remember a time without computers, but only vaguely. I don't remember the first time I used one, BUT I do remember the first time I began programming. It was on the Texas Instruments TI-84 series of calculators.
We were required to use them for pre-calculus class, and one of my frinds showed me some bizarre text adventure he had made in an afternoon in BASIC. I absolutely loved this idea, and started to explore the features of the calculator's BASIC more and more, eventually making my own text games and programs to solve the quadratic formula for me and such. That one little already out-dated calculator totally changed my life
That spider dropping down like "Oh crap, he's recording. I'm outta here"
I played with my friend’s Casio pocket computer during history class and then got a ZX Spectrum for Christmas 1982. It came early and I was allowed to check it out for one weekend and put it back until Christmas. I was allowed to keep the manuals and read them back to front.
It was in 1980, with the ZX80 and Sinclair Basic, at least that's when I got my first computer.
Prior to that, 1978 through to 1979, very limited access to the school computer room, which had a BBC Micro. My maths wasn't quite good enough to be granted access to the club!
Then there was a visit to the Tandy electronics shop which had various computers - we could look, but not touch!
My sole motivation was gaming and trying to make games, which I did, with at least some success - obsessing over platformers, text based adventure, trying and failing to code pacman, but managing to code a very rudimentary space invaders.
I'm now a software engineer.
I too started on the ZX80. I made a "StarTrek" game that I shared with some others. Funny story: When you started the program it would ask you what level to run at. Levels went from 0=Beginner..9=CaptainKirk,10=impossible. All they really did was set the relative strength of your weapons. A friend of mine said it didn't work because as soon as it started he got blown up and lost. I asked him what level he tried. He said level 10. I suggested that it was called impossible for a reason.
Great Video brought back so many memory's . I was given a zx81 with a 16k ram pack by my uncle. I had hours of fun learning and writing programs and when they actually ran the sense of achievement was amazing. I studied the Ziolog manual from front to back meticulous from front to back so many times lol. And as I got better the battle became not to run out of space. It made you really think about streamlining your programs to do as much as you could with the little space you had. But it was fun. Thanks 😊
I had a similar experience. My parents bought me a Philips MSX 2. With green monochrome screen.
I remember the blinking cursor when there was no disk inserted. It sparked my interest in writing basic programs with the MSX-BASIC book that came with it.
I coded in assembly language for years before writing a program in a high-level language. (That program modeled the air standard Brayton cycle for a thermodynamics class. The need for floating point math forced the change.) I was wowed at all the things an HLL took care of automatically! Conditional branching was fall-off-a-log easy! Never had to perform tests on the condition code register again! No more self-modifying code!
2:30 The spider made me check to see if I had something crawling on my screen
BBC Micro for me. I'd been banging on about getting a ZX81 for a couple of years. The school I was at had got the BBCs in to replace the PETs a year after I started. Loved writing stuff on it in basic, a sprite generator, a stupid platform game.
You lucked out, i had fun with the ZX81, but learning on it was crippling.
Hmmm...sounds a bit like my school. We had 3 PETs, 2 in the Maths department and 1 in the Chemistry department. The physics department got a ZX81 and a Spectrum (I late bought the ZX81 - my first computer purchase, but started on the PETs). The computers were then all collated together behind the Maths department.
@@cigmorfil4101 It was a weird time, no-one knew what they were and where they should fit in into the curriculum. You basically (pun) had to learn it yourself.
@@jonwest776
More than a weird time - it was a frustrating time.
Born a couple of years earlier and computers would not have been at school; born a couple of years later and there was more opportunity to learn about them at school - either way my career path would have been clearer and (very likely) much different.
My first year Uni computing module (a short course at the end of the year after the main course exams had finished) project was done on a PET - I knew more about the PET than lecturer did (he used the Uni's main mini- computer system and knew very little about micros). I used 6502 machine Code and got the answer in seconds, others used basic and took around 15 minutes to run ^_^.
@@cigmorfil4101 even so, Although I couldn't program assembly, I had no fear of learning software. We were both at a time when the student was inspired/knew more than the teacher.
2:29 a spider joins the video XD
Dad got himself a ZX81 back in 1981 for himself. I must have been 2 at the time, but I was a precocious kid. Apparently I'd hack his programs so they said "Peter is ace" rather than "Dad is ace". I have no memory of this. My earliest memories are of a 16k rubber key speccy which I'd write my own simple programs on.
Can't wait to see the video on FORTH. It is, as you say, a very odd language, almost a sort of high level assembler. I sometimes have to use bits of paper to represent the stack to get it right. If you don't, you get all sorts of inexplicable results, and one implementation I used crashed the machine if you forgot to make sure the stack was empty before qutting! That version is odd in itself because you compile an entire program stored in a source file, rather than using "screens".
You asked what was you first exposure to a computer, and I think I have a more unique story than most others.
First was a long time ago, about 1970-1971. My father worked for a company that made the old glass type 'pcb' boards, and I around 6-7 years old would go in to the office with him on Saturdays.
They had a timeshare service to a Sperry computer, paper tty and the old style headset style acoustic modems. I would watch fascinated the computer techs working on the one TTY console.
On one of these Saturdays, the computer tech set me up in one of the executives offices, with a 'newfangled' calculator, that while it only did math functions, was connected to the computer by some sort of interface.
Being the 'genius' 7 year old I was, I played with this calculator entering the sort of math questions I 7 year old would know the answer to. Things like 1+2 or 7-3.
When suddenly the little printer spat out in text "Why are you wasting my time, stop it with the stupid questions."
Now with 50+ years of backwards experience I can tell one of the operators must have been pranking me, but to my 7 year old mind, the computer had insulted me! Well, I would never let that stand! So from that moment on, I become 'The' computer nerd, reading every book I could get my hand on the things, pretending a manual typewriter we had at home was a computer, and about a year after they came out, built my own Comic Elf single board (256 bytes) computer, which I would have hours of fun programming the one LED on the board flash in different ways.
Some comercial games on the sprectrum were actually in basic, they were very good too all things considdred. Carnell Software Ltd IIRC did a couple.
I have coded a bunch of CPC games, which has less than 48K (42K if you used firmware) to work with as 16K is for the screen. It's such a tight fit, I had to use a lot of data compression to get all the data into memory, and decompress when needed to a buffer, and optimisation is key. You can't afford to be careless or wasteful with space and resources, as you can on modern programming.
13:30 Sorry, but the Commodore Pet, Apple ][, Acorn BBC micro all used a single byte to store each keyword as well. It wasn't unique to Sinclair.
What was unique was entering of a keyword with a "single" key press.
The other machines I mentioned above all rans a tokenadiser which took the text entered and converted it into tokens. (The Apple ][ parser was particularly aggressive as it allowed that no spaces needed to be input, so would find tokens in the middle of variable names.)
The only micro I know which didn't store the keywords as tokens was the Acorn Atom (precursor to the BBC and Electron - this latter a cut down BBC). It stored the whole text entered, but it allowed abbreviations which were the first few letters followed by a full stop, which reduced the program size and decreased interpretation time.
The same abbreviation method is used with the BBC micro, but it is clear that it tokenadised the code as when listed the full keyword was displayed.
The Commodore PET (and those which use Commodore's Microsoft basic) in its token table noted the end of each token by the top bit being set. The tokenadising routine used a method which had a side effect that if you set the top bit of the input (by shifting the relevant letter) it could recognise the token. Thus abbreviations for the basic keywords of typing the first few characters and shifting the last. As the file commands (PRINT# and INPUT#) has the # character as part of the token, they had to come before the standard keywords. Thus pR would give PRINT# and iN would give INPUT#. There was no possible abbreviation for INPUT. Similarly there would be no abbreviation for PRINT, but as it was such a heavily used command an exception was made in that the tokenadising routine checked for a question mark "?" character first and if found converted it into the PRINT token .
The maximum length of input on a Commodore PET was 80 characters. By using abbreviations and the ? for PRINT, lines longer than this when listed could be entered but not later [directly] edited.
Had a BBC Micro, model B with the user guide, advanced user guide and several other books, double disk drives, color monitor and a 16K sideways ram expansion. Had an Electron as well, later on. One game, if you never tried it, that you really, really, really should look up for the Electron is Tynesoft's Kastle. That one is very much amazing.
Blimey, that lot would have cost as much as a 3 year old family car. 😂 My parents bought me a Sinclair ZX81 and a cassette recorder for my 14th birthday in late 1981, and a 16K Rampack for Christmas. Had my Dad not died too long after, I suspect I'd have had a Spectrum a couple of years after that. I got a BMX instead, but I was introduced to Atari 8 bits by a relative, and they absolutely blew my mind.
Contrary to popular belief, the original BASIC created at Dartmouth College's by Kemeny and Kurtz, was a compiled language, not interpreted. Therefore BASIC being "slow" isn't a function of the language itself, but because someone decided to make interpreted versions suitable for small, hobbyist microcomputers. That's what many people were exposed to. BASIC was designed to be small, easily learned and ideal for students to quickly solve problems and test ideas etc, and it's actually good at that. Sinclair's ZX80 had a 4K ROM based OS and BASIC. Lack of "structure" and readability were solved by better versions as home computers became cheaper and more powerful, and both are as much a function of the programmer as they are the language.
7:25 Uh oh. For no real reason, I opened a C64 emulator on my Windows computer and typed that exact program, ran it, watched HELLO flicker down the screen, then closed it. This morning RUclips recommended this video. Google knows all.
Shortly after this video, the spider came back as the spidernator and killed NCOT
the shirt is a little extravagant
I enjoyed many an evening in the 80's/early 90's typing stuff in firstly on a BBC Micro and then an Acorn Electron. Good times except for when you were sure you'd typed it in *PERFECTLY* only to find in the next months magazine, *IT HAD BEEN PRINTED WRONG!!!* 😫😫😫
Well, Forth sort of lives on in the form of Postscript. Well, it's not exactly forth, but built on the same principles.
Also worth noting is that the ZX spectrum did not only contain a BASIC interpreter, but also a stack-based bytecode interpreter for math that was started with one of the rst assembly instructions (I don't remember which one) and was used by the BASIC interpreter. Unfortunately my search-fu is not good enough to find a link to it (I'm sure some documentation of it exists somewhere on the web). Note that the bytecode was "inline" with the machine code. The rst assembly command was directly followed by the bytecode, and when the interpreter was terminated, machine code execution continued with the next byte after the bytecode instruction.
The maths based stack package was in the earlier ZX81. The Spectrum (aka ZX82) was really a ZX81 with better graphics, and "proper" hardware to handle the screen as opposed to relying on the Z80 CPU to generate it (which is why the ZX80 was slow, and the ZX81 had two modes: in FAST mode the screen updating was switched off and the CPU could spend more time running the user programs).
I'm guessing that the keywords for the maths functions were converted in to a command for the stack based maths package. (I'm not sure if there was an instruction to execute a single command - the QL had a similar stack which allowed a single command or a string of commands to be executed.)
If you've ever come across PickBasic (the programming language of a Pick based [DBMS] system), it's "compiles" the source text to a tokenadised program but at the same time rearranges expressions to use a (reverse polish) stack.
My first programmable computer was the Atari 800. 8k RAM with an expansion card to 16k. I learned BASIC on it! :)
UK101 :-) > BBC a > upgraded BBC a > Archimedes > Risc PC... I would have gone on, but Acorn folded. I wrote code, lots of it. I wrote tutor WIMP programming articles in high street mags... Ho hum.
I have written an extended basic back in the days in Z80 Asm
Added a lot of bbc commands in like VDU and more..
Sometime late '80's (1987 or 1988) I got a Canon X-07 and a photocopied BASIC manual for the holiday. I didn't get any peripherals, so I had no way of permanently store anything, so battery changes had to be done quick, and if I ran out of space I had to delete an older program I didn't use. Later I found out there was a ton of peripherals, including cassette tape drive, line paper printer, NULL-modem, and more, but by that time I had gotten a 12.5MHz 80286 PC computer with two floppy disks and 5MB of hard drive.
You've got it totally wrong there mate. I think you'll find it was Santa and not your parents who setup the acorn electron. Nice vid.
many other computers also stored the individual commands as single or 2 byte 'tokens' just didnt have you enter them in tokenised form , there are now 'modded' versions of the rom for the 48k spectrum that has the spelled out entry system , they are tokenised once enter is pressed and when editing a line the tokens are present in the line .. someone has even made a bbc basic rom for the spectrum but it requires a bank switched rom box for the 48k machine, or will fit directly into 128 machine as is, unfortunately it doesnt implement any graphics commands, there should be ways round it, such as machine code calls to the semi hidden spectrum rom ,but no doubt awkward/cumbersome to do it!
over a dozen languages? Yup. A partial list of available in the 80s
BASIC - over a dozen flavors: Applesoft, Apple Integer Basic, Microsoft Basic, Microsoft Q-Basic, Commodore Basic - PET, Commodore Basic C64/128, VAX Basic, IBM Basic, MS Basic for CP/M, MS Old Basic for CP/m, Atari Basic, Amiga Basic, BBC Basic, Sinclair Basic for ZX80/81 & TS1000, Sinclair Spectrum Basic, TRS Basic Levels I-III, S-Basic for CP/M, MS Quick Basic, GW Basic.... But most of those were system specific... Many BASIC programs required revisions to work on all 5 major platforms: BBC, Spectrum, Apple, MS-DOs, and C64. And even more on the TRS-80, TI99/4 & TI99/4a, Atari, Oh, and Microsoft QuickBasic was a runt-time-compiler, not an interpreter. SBasic for CP/M was a compiler-only flavor.
Other languages of the time include: COBOL, APL, C, ALGOL, BCPL, Forth, Fortran, Pascal, DIBOL, LISP, LOGO, Pearl, Pilot, Scheme, TUTOR... and I skipped the ones I'd not heard of.
I also left out the various shell scripting languages... because in 1985, most were using MS-DOS Batch File language, or implementing in BASIC, with a tiny few using various unix shells.
Man, brings back memories... Which reminds me, I need to finish a program. In QB64, which is a modern 64 bit reimplementation of the QuickBasic language....
Since I am young, for me it was getting a Raspberry Pi 1 Model B on christmas 2012 as a 10 year old, I remember i getting it along with a dodgy lcd monitor, I started learning python and c on it and now I am still doing python and c 😅
What is the spiders name in the background at 2.30ish?
Hey, thanks for the video, You mentioned magazines with codes. Could you make a video on those, and sources where it's possible to find them on an internet?
I once wanted to try porting a simple game to a PC, but couldn't find any magazine...
Only knew a little bit of Basic back in the day. Just enough to get the C64 to play games or maybe do a type in once in a while. If the type in was wrong I usually never figured it out. I'm studying Python now. It's slow going but pretty rewarding. The big difference is that even besides the online class I'm taking there is so many videos with good explanations. Too bad there wasn't that in 1986.
Keep that spider around... it will be handy if you do a video on "threads". 😂
5:15 Is that a tea bag?
Computer SpaceGames - I had that book
How many times did I try to kill that spider?
Too many and yet not enough.
My first memory as a child is my father hovering over large circuit boards. I think HP fabricated them for him. He build this monstrosity. it was huge (for a 4 year old) it was taller than i was. It took a launch sequence to start. I felt like i was launching the space ship. It took two 8 inch floppies. It could call two HP to communicate so we were lucky and had a second phone line.
A really enjoyable video as always.
I saved up my pocket money. Bought a ZX81. Typed a buggy program in from a magazine. And stared at the code (for weeks) until i eventually worked out how to fix the game. At some point i got bored of BASIC and bought the ROM disassembly and started the learning curve all over again.
It wasn’t a new or clever trick. The earliest Microsoft interpreters did this already, but they tokenised code from the full text line into memory when the user pressed enter. The only thing that was different was that Sinclair didn’t bother to write this tokenisation code
i whittled away many a evening entering programs from the manual into the old speccy
I have source files larger than 64k *targeting* machines with 64k of address space :-) Not hard to do given asm is less compact than its machine code equivalent.
I had a Vic 20 first 5k of ram. In basic each line you typed used 40 chars of ram no matter what. I remember combining lines because I would run out of ram to type it or worse to run it.
Really enjoy your videos, but I think the Elk was a couple of years later🙂
64k memory! And using an 88k floppy !
I helpe a teacher build a IMSAI 8080 S100 computer from KIT boards(basically a better ALTAIR 8800) . It took SO MANY hours of slodering(NO SOCKETS for anything, dumb as hell and expensive and time consuming diagnosing fried chips). It used a surplus Dumb termanl from the Air Force base. It started with MS MBasic and a casset for loading EVERYTHING INCLUDING BASIC. The first one I got for myself was a TRS-80 Model I.
I had a Sinclair ZX81 then I had a Sinclair ZX Spectrum + 🙂🚂🚂🚂
Spider! at 2:30. (Sorry, I was listening.)
Never understood what Fourth was, or Pascal. Definitely interested on your take.
64k?! I had to *expand* the RAMon my Acorn Atom to 4kb!
is that spider that drops over his left shoulder at 02:30 real?
And I find my own answer at about 16:30....
I think all keywords are tokenised to save ram regardless of the method of input. It doesn't seem like it would save ROM space anyway since it still needs to store the characters to display for each token? It just seems like a bad attempt at providing shortcuts.
BBC BASIC had a simple code readability command called LISTO, which adjusted the output of the LIST command.
Setting Bit 1 added a space between the line number and the rest of the line (leading spaces are normally stripped on entry, Bit 2 indented the contents of FOR...NEXT loops by two spaces, and Bit 3 did the same for REPEAT...UNTIL loops. In both cases, each additional level of nesting added an extra two spaces.
Each could be set independently, so LISTO 0 would turn everything off, LISTO 7 would turn everything on, and you could have any combination between the two.
I never liked BBC basic, Sinclair basic had already burrowed itself into my brain, and the single key keyword system meant I could enter code extremely quickly.
I can't believe that I actually agree with Bill Gates, but I agree with his statement that, "640k ought to be enough for anybody." Everything else is unnecessary and cosmetic.
Hallelujah
It wasn't basic or asm. Maybe on that platform. But C or B or A were also around.
High school, Philips main frames..
Speccy BASIC used it's weird keyword entry system because of the awful keyboard on the standard 48K model. You couldn't type in separate letters at any sort of speed. Other BASICs also used 1-byte tokens for keywords, but they did the tokenising once you'd typed a line in, and let you do that normally a letter at a time.
You could, I'm kinda sad you didn't know this as a kid, have typed it all in in 128 mode. It would almost certainly have worked fine. But then if you'd needed 48K mode, you could've typed it in 128 mode, typed in "SPECTRUM", and it would have landed in 48 mode with the program you'd typed still there.
The Speccy was an upgraded ZX81 which also used the keywords system.
The ZX81 was an upgraded ZX80.
IIRC the ZX80 had the keyword system (to save on ROM size) and the ZX81 would have kept the same system as the main difference was the addition of floating point. The ZX82 (aka Spectrum) would have kept as much as possible of the previous routines to avoid having to re-write code that worked (as there was little development time), only adding extra for the new hardware.
It wasn't until the QL which used a different main CPU that the keyword entry system was removed. Later versions of the Spectrum then also offered the option of using the Sinclair "standard" one-press keyword system or typing the tokens in full (but not in the 48k mode).
JavaScript is the new BASIC
You look like alastair from Supernatural
Good video. Subbing for the Forth vid
@02:35 Insy wincy spider
CATS!!!!!!!!!!
Sinclair Basic, that damn keyboard and tapes were terribly damaging to learn on.
I do admit aspects of the design were clever, but using it really wasn't.
There's a reason that the UK has a disproportionate number of programmers, and it's beige!
More often it's black with a rainbow on the lower right corner. Those coding on the Beeb were mostly doing so because it was on the school curriculum. Most kids coding on the Speccy were doing it because they found it interesting.
@@Inaflap I'd have given my left leg for a bit of coding on my curriculum, I think I only used a computer during actual lessons once or twice. it was lunchtimes and after school that I got my chance, So I did most of my early programming with a pen!
The beige computer use started well before the BBC micro. The acorn atom preceeded it and used much the same basic interpreter including the built in ability to use embedded assembly language in your code.
That in turn had originated from the Acorn system 1 which was a 2 board computer (the second board was the calculator style display & hexadecimal keyboard). That used a 6502 processor with 128 bytes of ram on one of the peripheral chips. That was the origin of acorn's expansion bus connector and potentially gave access to the entire processor address space.
First!
You might have been better sticking with the Electron and then jumping to a business system like a PC or old CP/M machine to build your career as the Electron was a professional standards machine cut down, and the Sinclair more a toy built to be barely acceptable for a low price.