sincalir
Makers of the Sincalir Sprectum computer. Now that brings back memories
The 80's are so now, as hot on the heels of the RISC OS' Raspberry Pi debut comes the equally retro-tastic news that the BASIC version used in the Sinclair ZX Spectrum can also run on the Pi. The BASIC in question is SpecBAS, is a project run by a chap called Paul Dunn. Full Pi support came to the project with the recently- …
The point?
a) It can be done.. The root of all evil, but in this case rather innocent.
b) Nostalgia. Quite a few of us commentards started out on/with this kind of BASIC, or one of it's contemporaries.
c) Education. There's several ways BASIC can be used to teach logical and programming concepts to kids who otherwise have trouble grasping said concepts *because* of it's linearity, limitations, and relative simplicity.
d) FUN. Which concept may have eluded you lately. Go get some. It's healthy.
@Grikath
Just because you can do a thing doesn't mean you should.
If you want Nostalgia then go and get an emulator, this isn't Nostalgia as it's not Sincalir BASIC at all, it's something else with the Spectrum Basic name on it.
Education? Are you kidding me? BASIC is not a great language to teach programming concepts, especially Sinclair BASIC!
and then FUN. Ah yes, I do remember that, and this may be fun for the person who is writing it but this as you know is subjective. So you could also say it's fun to criticize (correclty) someone writing Sinclair BASIC with a view that its Nostalgic, Education and ... well... because it can be done.
It's fine to teach simple programming, especially Structured with procedures. The OOP stuff can come along later when the basics (pun half intended) have been learnt.
Anything that can possibly catch the imagination of a learner is a good thing that can lead onto more afterwards. I believe it's a fallacy that BASIC somehow 'corrupts' a would-be programmer's mind. If one has any aptitude whatsoever one will soon appreciate better ways of doing things as one gains experience.
b) This is far off Spectrum basic as QL basic was. This is nothing more of a BBC Basic ripp off.
c) Sure basic is indeed educational.
D) Eh? FUN? On a dog slow overly complicated Linux distro? You're kidding are you?
Make these linuxes run as quick on the desktop as that RISC OS port does and THEN I'm really interested. But as of now, I tried Raspbian, OpenElc's etc... and all of them just suck! The only usable OS on the RPI is RISC OS... but it has seriously ommisions in multimedia and websurfing.
IMHO if all those supposedly great linux programmers put the same effort in to a collective to build a propper webbrowser, mediapplayer and a few other apps for RISC OS then they would have much more succes. As it is Linux will always remain niche even with the opportunities brought on with the RPI.
And the RISC OS folk whom still remain don't 'get it!' They keep asking 30 UKP for 'an upgrade from 3.09 to 3.12" (which should be free) or ridiculous asking prices like 150 UKP for an emailprogram or wordprocessor.
If you like BBC Basic, check here:
http://www.bbcbasic.co.uk/bbcbasic/z80basic.html
This is the same version of BBC Basic that the Z88 and NC100, NC200 ran and it's pretty damn good (for a Basic). It even includes Z80 inline assembler. There's a vanilla CP/M version, so you can run it on your old Amstrad PCW if you want (and you know you want to).
And, of course, it has been exquisitely hacked and munged to run on the Spectrum. http://mdfs.net/Software/Spectrum/BBCBasic/
R.T. Russell produce a Basic for DOS, that's equally good (inline 80186 assembler! Be afraid) and a Windows version which I have no experience of, but it's apparently Basic 4 compatible. But they're commercial. (I have no idea how you can manage to make charging thirty quid for a pretty crappy Basic by today's standard viable, but there you go.)
If you're a Linux user, try 'apt-get install brandy' for an open source version.
"Ah you deluded BBC owners. I remember you crying yourselves to sleep because your parents wouldn't buy you a Spectrum so you could play all the superior games your school mates were playing."
I doubt Speccy games will run on this "basic". Besides this isn't about games but about learn to program. Why so negative? I'd applaud ANY development on the Raspberyy Pi.
Only a couple of years ago I needed to generate a load of very similar HTML pages. I could have used a proper language but the project was so simple that it was much faster to do in the ultimate procedural language where syntactic errors were flagged up 'in flight'.
Object orientated coding is not optimal for quick & dirty one-offs. IT 'professionals' sometimes forget that.
...was about as developed as it got - and iirc there was a backwards ports of it to the Speccy that featured on one of the magazine cover tapes. I used to program in both and QL SB was fully procedurised, which was a good basis to learn for things like VisualBASIC and Delphi, both of which I had back when they were v1, stack of 3.5" floppy disks to install. My QL shareware releases were always left in SB so that others could modify and update as required, but the commercial stuff got compiled with Toolkit II and a bunch of other add-ons before release.
Really?
I believe the Sinclair BASIC method of string splitting is VASTLY superior to the crippled crappy Commodore method. I think Dunny only added those retarded commands to pander to the people unfortunate enough to have had to endure Microsoft BASIC (of which Commodore BASIC was one dialect).
The Sinclair method is clear and simple, no need to differentiate between left right and middle.
take something off the beginning? PRINT A$(TO 5)
take something off the end? PRINT A$(5 TO)
take something out of the middle? PRINT A$(3 TO 7)
And with the use of such functions as LEN, you could do all kinds of things with that simple format,.
Paris, because Sinclair string splitting was so simple even she could use it.
RANDOMIZE USR wasn't actually a command. USR was a function (having the effect of executing some Z80 code at the address provided, returning the value in the BC register when the code returned). RANDOMIZE was a command that set the seed for Sinclair BASIC's pseudo-random number generator (the RND function). Because USR was a function, it couldn't be a statement on its own, so you had to do something with the result. I'm not sure who came up with the idea of using RANDOMIZE - one advantage was that it had no side-effects (unless you planned to use RND, of course). Your other option would be to assign it to a variable (LET a = USR x) but maybe RANDOMIZE was quicker to execute? Who knows. It became a convention, anyway, so a lot of people used it without having a clue what it meant.
Less typing; RANDOMIZE was one keypress on the Spectrum's gods-forsaken excuse for a keyboard, while LET a = was at least three (I forget whether it needed any shift keys).
It's not a proper Spectrum BASIC unless it requires you to stare at the keyboard for five minutes trying to find a keyword you don't use very often.
It was to initiate the random number generator with a seed.
Use the command:
RANDOMIZE 5
or any other constant and the result returned from the random number generator would always be the same.
Sticking in USR would give an unpredictable number and therefore a random enough seed to the generator to stop any obvious repetitions.
Guessing here but the RANDOMIZE "convention" might come from the ZX81 where it may have been used in preference to the let form as it took up less memory than the LET form, both in storing the source (key words were tokenised) and possibly avoiding having to store a variable - when you've only got ~3/4kByte for your program every little counted!
Yep, RANDOMIZE was the quickest way of throwing away the result of the USR function, without taking up any memory. More critical on the ZX81 than the Spectrum. The USR function executed a bit of assembly at the given address. It actually put that address into the BC register pair, and on returning, the contents of the BC register pair came back as the function result.
ULTIMATE / ACG favoured PRINT USR to start their games, but that was on the assumtion that once running, the game never would return to BASIC, so nothing would ever be PRINTed.
Though in-line or callable Z80/6502 assembly will be a bit useless in a Pi BASIC unless you have the equivalent processor emulator.
As for BBC vs Sinclair BASIC, they both had their advantages and their gaps in language terms. The only significant difference was that BBC BASIC ran a hell of a lot faster, but that's not an issue with these implementations.
I played with Spectrum basic for a number of years, but couldn't wait to move away from the clunky/slow environment and as soon as I had saved enough pocket money I moved on to other languages. And that was my feeling in the 80's never mind now!!
With all those features bolted on it's not really Sinclair Basic anymore is it... This is someone who just knocked out a crap interpretation of BASIC and bolted a load of crap at the end of it to try and make it up to date.No one is ever going to use it., little point developing this.
Yes, you can use line numbers (in fact, as in Sinclair BASIC, you must use line numbers). Procedures were added due to demand, and they can be quite useful as they support passing parameters by reference or by value, support local variables and can be CALLed to return a result.
I kept line numbers in because I think they really force you to think differently about your code, and can be abused in all sorts of ways. There's no CASE structure, but when you can calculate a GOTO or GOSUB using an expression:
10 GO SUB var*10
Then you can simulate them quite easily.
Because line numbers are used, you can easily abuse procedures too - they use the subroutine stack like other handlers, so you could in theory jump in and out of them at will, without having to even call them. Not that I'd advocate that sort of code, but still...
Aside from all this, I'm frankly amazed at the response - a hell of a lot of people are downloading both the binaries and the source code from the websvn... Not sure I made the right choice about opening up my messy code like that, but it did enable the Pi and linux versions to be made :)
D.
"Because line numbers are used, you can easily abuse procedures too - they use the subroutine stack like other handlers, so you could in theory jump in and out of them at will, without having to even call them. Not that I'd advocate that sort of code, but still"
I never felt restricted enough to need this, but did see it done. I liked the Spectrum 16/48K Othello game (CDS Microsystems, http://www.worldofspectrum.org/infoseekid.cgi?id=0003554) so much I had a go at porting it [to AMOS BASIC on the Amiga, for speed]. To save space for the 16K machine they had subroutines that were sometimes GOTO'd to in it - the routine to determine the computer's best move thus doubled as that for the player's help, except there was a priority order to check the empty spaces in the former case but no such favourable weighting for the latter. It took a few goes to get my head around the spaghetti, and I either I became very good at beating the game as a result or failed to port it sanely ... possibly both ;)
This post has been deleted by its author
FFS - I'm gonna drive my kids around in a clapped out Austin Maxi without seat belts and ban them from shopping on Sundays because everything was better in the eighties.
Yet another ground breaking story of utter banality which could have been written as - "Man ports old code to new variant architecture"
Just this weekend I spent two hours teaching a friend's 15 year old son how to write Python. He'd never written a line of code in his life, not even an Excel macro, but by the end of it he was writing his own scripts with an understanding of types, conditions and loops. He'd already pulled in the Random module and was desperate to get his code to work with world. This was all done on his cheapo netbook using IDLE. No Pi, no BASIC required.
you'll first need to run a linux distribution with hard floating point support
Did they deliberately go out of their way to write their code so it only runs on one particular variant of Linux?
For a computer whose purpose is to educate in the fine art of computer science this is simply ridiculous.
The binary linked to on the specbas website is for hard-float ARM linux, since that is what virtually every Raspberry Pi user runs (because it is quicker than soft-float, natch). You can of course build the source to run using software floating point emulation, as has been done (by myself, and quite possibly by others too).
I don't know, but the reason I use the Sinclair-related terms is quite plainly that it is heavily based upon Sinclair BASIC. You'd see that if you tried it, both in the way that the BASIC is entered and the way the language is constructed. Sure, I could call it "A Dartmouth BASIC Remake" but although DMB is at the very roots of my implementation, it was the feel of coding on a Spectrum that I wanted to replicate.
Judging by the response in the Speccy community, I got that part right at least.
D.
Purebasic: Just like it was in the late 80-90, it is by no means perfect, it is power of C meets Basic-like syntax, even pointers are there if you need them.
Give it a go there is a demo available on the official website, it is real good.
It has a compiler 32/64Bit that can produce small and fast standalone exe files.
Kind of C meets VisualBasic 6 without activex/.net shit.
Trust me it is fun and practical, it has a lot of functionality under the hood.
There are some caveats - bear in mind that the screen resolution is a lot bigger, and that attributes have gone as each pixel is individually coloured...
But yes, it shouldn't be too hard to do - and if you have problems or find an incompatibility that shouldn't be there, feel free to drop me a line, I'm always ready to fix things that go wrong!
D.