Jump to content

Talk:Sinclair BASIC

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Keyword grouping?

[edit]

List of functions added. Should we group them? i.e.
GO TO, GO SUB, RETURN
IF, THEN
FOR, TO, STEP, NEXT
READ, DATA, RESTORE
etc? --PopUpPirate 19:40, Feb 4, 2005 (UTC)

For the time being, I have marked the keywords to distinguish between commands, statements, commands+statements, functions, and other. I think listing BASIC keywords by "logical groups" should rather be done in the general BASIC programming language article, lest we'd have to do the listing in each and every BASIC dialect's article. Thanks for entering the keywords, BTW! :-) --Wernher 23:03, 4 Feb 2005 (UTC)
No I quite agree - good work - will try and add more tomorrow :D --PopUpPirate 01:19, Feb 5, 2005 (UTC)
Just to explain my recent revert back to the compact listing of keywords and notes (er -- I thought we agreed in this?): I reiterate my opinion that detailed listings and comments on each BASIC keyword belong in the main BASIC prog.lang. article. I believe that all the BASIC dialect articles should be formatted more or less like this one--which I suggest to be the reference article in a future BASIC dialects WikiProject (stay tuned)--i.e. summarily presented, with notes for making clear all deviations from standard BASIC (Kemeny and Kurtz).
Also -- as for having one's formatting 'brutally reverted': Believe me, I've been there too, several times. Sometimes it just has to be done, though, in the interest of keeping articles compact and/or avoiding that other similar articles be getting out of hand. Sorry if I p'd you off; nothing personal. :-) --Wernher 06:09, 15 Feb 2005 (UTC)
If you prefer the current format that's fine :D I was going to group them as per the ZX Sinclair Basic book (orange cover) from www.worldofspectrum.org but it started getting complicated! --PopUpPirate 14:36, Feb 15, 2005 (UTC)

Could somebody explain to me the difference between "commands", "statements" and "combined commands/statements"? The Spectrum makes no difference as far as I know. Cheers --Pak21 17:02, 12 December 2005 (UTC)[reply]

Oh yes, it does :-) Generally in BASIC, and as stated on p.50 of the reference listed in the article, a "command" is a keyword that can be employed in the interpreter's direct mode to initiate an action; a "statement" is similar but must be used in program lines; a "function" produces a value of some kind; and a "logical operator" is a keyword which is used to express logic in a command/statement. --Wernher 02:41, 13 December 2005 (UTC)[reply]
I don't have my copy of the orange manual handy, but it looks to me like the article is pretty broken. DIM definitely does have an effect when used in direct mode. All the other things listed as statements can be employed in direct mode, but admittedly don't have an effect. All the things listed as commands (the If1 extensions) can definitely be used in a program (and have an effect). The things listed as statements (other than DIM) don't "initiate an action" when used in a program either.
Thinking things over, I now see that the Spectrum+ manual (black) confused me quite a bit, and that we should probably regroup the keywords as follows: Let's combine the "commands", "combined c./statements", and "statements" into a single group called "commands", which denotes keywords that may be used both in direct mode and in program lines. DIM which will be moved into this group. "Functions" and "Other keywords" stay as is. A few commands are probably meaningless in direct mode, these may include CONTINUE, DATA, READ, REM and RESTORE (not sure what results these would give as direct commands; I should dig out my Speccy and check...). --Wernher 05:50, 14 December 2005 (UTC)[reply]
That makes a lot more sense to me. Of those, CONTINUE certainly does have an effect in direct mode (is it ever used in a program?) as do READ and RESTORE. DATA doesn't, and neither does REM (shockingly enough). DEF FN doesn't have an effect in direct mode either. Think that's about it. Cheers --Pak21 09:28, 14 December 2005 (UTC)[reply]

GO TO vs GOTO

[edit]

I'm not 110% sure, so I'll just go ahead and ask: are Sinclair BASIC's GO TO and GO SUB totally exhangeable with the more common (in other BASIC dialects) GOTO and GOSUB? --Wernher 06:54, 17 Feb 2005 (UTC)

I'm not entirely sure what you mean by "exchangable". They work the same way if that's what you mean. Note that on the ZX81, it was GOTO and GOSUB. On the ZX Spectrum it was GO TO and GO SUB. On neither computer did you actually have to type the letters G, O, ..., because all commands were bound to single keypresses ('G' and 'H' in this instance). Richard W.M. Jones 10:10, 17 Feb 2005 (UTC)
I just meant that, say, on the Spectrum, will both GO TO and GOTO work as expected? Another detail: will entering GO TO (GOTO) at edit time lead to GOTO (GO TO) being displayed when listing the program? --Wernher 11:21, 17 Feb 2005 (UTC)
No. Both machines had a strange modal entry system. When the cursor indicated "command mode" (cursor was a flashing K), pressing G or H on the keyboard would enter the keyword "GO TO" or "GO SUB" respectively. (On the ZX81 you'd see "GOTO" and "GOSUB" respectively). Unlike other BASIC interpreters, even of the time, the Sinclair machines had no lexing stage, so there was never an instance where the individual letters G, O, ..., could be entered and understood as one of the commands. Richard W.M. Jones 20:39, 17 Feb 2005 (UTC)
These machines must have a lexing stage, otherwise they wouldn't be able to accept string literals, numeric literals of more than one digit or variable names with more than one character. They just don't tokenise keywords the way most BASICs do. A keyword is just a single-character token, just like most symbols that have meaning in Sinclair BASIC. — Smjg (talk) 20:41, 18 May 2020 (UTC)[reply]

Different versions (+2, +3)

[edit]

How about the BASIC +2 and BASIC +3 versions of Sinclair BASIC? IIRC these were written/extended by Locomotive Software (who previously wrote Locomotive BASIC for the Amstrad CPC series). We should have some info (separate sections) on those versions. --Wernher 03:30, 10 Apr 2005 (UTC)

Timex extensions

[edit]

Could somebody please cite a source showing that the TS2048 either does or does not have the DELETE command? The TC2048 ROM (note the difference there) definitely does not include the DELETE command. AIUI, the TS2048 was never commercially released. --Pak21 13:43, 14 November 2005 (UTC)[reply]

  • I've now changed things to state that the TS2048 did not have the extended commands. If anyone can cite a source showing that it did, please do so and revert my change. --Pak21 16:52, 12 December 2005 (UTC)[reply]

I have a reputable source that states the TS2048 never existed. No independent verification yet though. It's not Timex BASIC though, it's T/S 2000 BASIC (source: "Timex/Sinclair 2068 Personal Color Computer User Manual" by Charles F. Durang, Timex Computer Corporation, Waterbury Connecticut 06720, 1983.). 93.96.235.195 (talk) 20:37, 10 February 2010 (UTC)[reply]

The editor screenshot with the 3DMAZE program

[edit]

Please see the Image talk:3DMAZE-line370-delay5-to-0.png to help determine how to tag this image correctly and whether its usage over here is fair use. --BACbKA 12:34, 20 January 2006 (UTC)[reply]

Precision of PI

[edit]

"Returns the value of pi to seven decimal places (3.1415927)"

I've just checked, and it doesn't return it to seven decimal places at all. It appears that whoever wrote this is/was unaware of the way computers work in binary, saw that if you execute PRINT PI then it outputs it to seven decimal places, and assumed this is the precision to which PI returns it. If the claim is taken from the cited source, then one is made to doubt the credibility of the source.

By my experiments, it seems PI returns the value of π at full machine precision. When Sinclair BASIC formats a floating-point number for output, it formats it to eight significant figures (minus any trailing zeros right of the decimal point), giving the mentioned 3.1415927.

Code Output
PRINT PI-3.1415927 -4.6566129E-8
PRINT (ACS 0)*2-PI 0

Further tests show that machine epsilon (by definition [b] there) is . The impact of this is that the value is correct to nine decimal places. — Smjg (talk) 22:46, 18 May 2020 (UTC)[reply]