New SpecBAS available - Procedures and Functions.

edited December 2010 in Sinclair Miscellaneous
Go here:

http://www.zxspectrum4.net/forum/viewtopic.php?f=6&t=17

And get the latest if you're interested. I've added procedures and functions (DEF PROC and speccy-style DEF FN).

D.
Post edited by Dunny on

Comments

  • edited December 2010
    Your steaming ahead with this, I can't wait till I can get some proper time on the computer to start porting some apps and games with it :)

    Can I ask your advice on something please Dunny?... I seem to have found myself in the predicament that after Chrimbo, if I'm well enough, that I'm gonna have to write a BASIC programming language myself.

    I never thought I'd do anything so complex or silly, as I'm not really clever enough, but have to I do... so I had a bit read of Game Scripting Mastery as they have a chapter on writing a lexer, parser etc etc

    I think the book said there were two main ways, top down or bottom up IIRC, what would you say would be 1/ easiest for me, 2/ generally the better approach?

    anywayz, I'd appreciate any answer you could give me, as the thought of having to do this scares me a little, hehe :)
  • edited December 2010
    CKay wrote: »
    Can I ask your advice on something please Dunny?... I seem to have found myself in the predicament that after Chrimbo, if I'm well enough, that I'm gonna have to write a BASIC programming language myself.

    I think the book said there were two main ways, top down or bottom up IIRC, what would you say would be 1/ easiest for me, 2/ generally the better approach?

    I didn't really read any books or owt, so I don't know what "top-down" or "bottom-up" are :)

    Basically, Sinclair BASIC can be divided into two areas - Keywords and Parameters. I use a stack-based system for everything.

    LET a=2*4 breaks down as [4, 2, *, a, VAR_ASSIGN] - which is a modified Reverse-polish-notation expression. Look up conversions from "infix" to "postfix" to get an idea of how this is done for expressions. Converting to RPN makes brackets redundant, and is very easy to interpret. The above expression becomes:

    Add "4" to the Stack
    Add "2" to the Stack
    Take the top two items on the stack and multiply them, and replace them with the result.
    Add the variable "a" to the stack
    take the variable from the top of the stack, and assign the value at the top of the stack to that variable.

    All very easy. You need two stacks, naturally - the queue of tokens to be interpreted, and the output stack used for calculations.

    Keywords that take more than one parameter are simple too - PRINT for example. You just keep converting each expression and adding them to the stack. When you interpret, you just keep doing the calculations until you hit the PRINT token, at which point all the expressions are sitting on the calculation stack ready for you to PRINT one at a time.

    You could have a gander at the SpecBAS source, but it can be very hard to follow - my commenting isn't great. It really is very simple though.

    D.
  • edited December 2010
    Dunny is far too modest...
    I wanna tell you a story 'bout a woman I know...
  • edited December 2010
    Thanks for continuing on this Dunny!... Looking forward to trying this one out... Incidently, how did we jump from 301 to 550??? Often wondered how the version numbers work...
  • edited December 2010
    New v587 is up - should be much more stable, thanks to my fixing a really stupid (but very hard to find) bug!

    D.
  • edited December 2010
    Thank you so much Dunny for the full description :) I?ve just wiki?d RPN and along with your explanation and the chapter in Game Scripting Mastery I think I can now start on something that I didn?t have the faintest clue how to do :)

    karingal?s right, you are far too modest, you?ve no idea what kind of cut down convoluted language I was gonna come up with as I couldn?t figure out how to work out this problem... anyways, good luck both with SpecOS and SpecBasic and I really hope you get your Pandora by Christmas by some flook of luck, this is my first post from mine as a mate brought his wifi router down and you?re in for such a treat ...

    P.S, had mine for nearly six months so far and no problems so far so don?t go believing all the horror stories on gp32x.com ;)

    P.P.S. 87 percent charge left, hotfix 4, new notaz wifi hack, wifi on, underclocked to 366 MHz, Fuse running in background and 12 hours 37 remaining battery life :D wait till you get yours dude
  • edited December 2010
    CKay wrote: »
    Thank you so much Dunny for the full description :) I?ve just wiki?d RPN and along with your explanation and the chapter in Game Scripting Mastery I think I can now start on something that I didn?t have the faintest clue how to do :)

    Get yerself into #spin (pm me for the channel key) on irc.coldfront.net when you're ready to start - I'm in there most of the time and there are others who can also help a lot. Most of my impetus to continue comes from their encouragement and their contribution of ideas.
    I really hope you get your Pandora by Christmas by some flook of luck, this is my first post from mine as a mate brought his wifi router down and you?re in for such a treat ...

    P.S, had mine for nearly six months so far and no problems so far so don?t go believing all the horror stories on gp32x.com ;)

    P.P.S. 87 percent charge left, hotfix 4, new notaz wifi hack, wifi on, underclocked to 366 MHz, Fuse running in background and 12 hours 37 remaining battery life :D wait till you get yours dude

    Please, just ... stop that! It's too painful to read. Looking at the updates recently, even though mine should be in the next 100, I doubt I'll get it before February. Ah well, here's hoping :)

    SpecBAS will be ported to Pandora sharpish when I get it! Coding games for the Panda in a heavily extended Sinclair BASIC? Heaven!

    D.
  • edited December 2010
    Dunny wrote: »
    Get yerself into #spin (pm me for the channel key) on irc.coldfront.net when you're ready to start - I'm in there most of the time and there are others who can also help a lot. Most of my impetus to continue comes from their encouragement and their contribution of ideas.



    Please, just ... stop that! It's too painful to read. Looking at the updates recently, even though mine should be in the next 100, I doubt I'll get it before February. Ah well, here's hoping :)

    SpecBAS will be ported to Pandora sharpish when I get it! Coding games for the Panda in a heavily extended Sinclair BASIC? Heaven!

    D.
    lol, I seem to remember you and mel inviting me onto spin back in 2004, perhaps after 6 years I should do, for a coder it?s a long time for me o figure it out ;)

    I?m always fightened of othe peoples ideas, have always stayed away from online aticles for coding and tried to muddle along and achive something in my on simple nonestandard way and so most of time if someone says can you add this I?m like yes but it?ll take me 4 years to figure out what you?re on about and 2 years to figure out how to do it, lmao :D seriously had a look at your forum before and the suggestion nevermind the solutions are waay over my head, but I guess that?s what you mean by hitting spin :)

    I figure you?ll get your Pandora first week of Jan, you?re soo close in line and things really do seem to be shaping up finally, really do hope at least another customers get their by Chrimbo though, be pshing it mind with Christmas post etc etc

    Can?t wait till you get SpecBas onto Pandora, got my Amiga disks backed up to adfs recently and so have lots of stuff I could port :)
  • edited December 2010
    Yeah, you stop that now!.. Your depressing me!!!!... Im tired from 'aving my tongue hanging out me mouth while drooling all that time while waiting ... hell, Iv even given up looking at that blasted forum, knowing that I can't do nowt in updating the firmware or try out the emulators until my package arrives!!!!!

    ...?!!!...

    SpecBAS is a large part of the reason I ordered mine... and thankfully the Windows version goes some way in holding back the withdrawal symptoms until me Pandora arrives...

    ;)
  • edited December 2010
    Just a quick note to say that the latest version of SpecBAS has been built for linux (many thanks to Piez for his hard work) and is being hosted now at

    http://www.reallyquick.co.uk/specbas

    Includes all the new updates - sound, procedures, functions and bugfixes.

    D.
Sign In or Register to comment.