Jump to content

BASIC 2? Why not get BASIC 7?


Recommended Posts

On 3/4/2021 at 1:21 PM, kktos said:

Nice job, Mr R 😉
I like the way you're thinking 😉
And I like it also because if we manage to write our own basic, we won't have any licence troubles. And we will have something well suited for the X16.
Would you mind starting a thread on your BASIC with some examples, docs... and so on.
We may be of assistance 😉
Cheers to you, mate !
 

It's too eccentric. I've cannibalised some of the bits into something closer to a normal BASIC. https://github.com/paulscottrobson/6502-basic . It's modular so you can basically add and remove whole chunks as you like, and it's also designed to run in paged memory.

So far :

  • 32 bit integer and string types (hooks for floating point)
  • long variable names.
  • Integer and string functions and operators, BBC Basic style indirection.
  • While/Repeat/For/Multilevel Ifs
  • Procedures
  • Locals/Parameters
  • VPEEK/VPOKE and VDEEK/VDOKE because there are so many 16 bit values.

Outstanding:

  • Inline assembler (can probably pinch most of this from atomic basic)
  • Arrays
  • Tokenising / Detokenising stuff (at the moment the tokeniser is in Python)
  • (More and fancier) X16 specific stuff.

 

Edited by paulscottrobson
Link to comment
Share on other sites

Ambitious project @paulscottrobson!

Do you intend to store programs as plain text or as tokenized files?

If plain text, I guess you could use the text editor I've been working on to write BASIC code. Please let me know if you require anything special to make that work.

EDIT: And I almost forgot. If you feel old school, there is also the LED in the downloads section. I like that a lot. It's surprisingly efficient to use.

Edited by Stefan
Link to comment
Share on other sites

14 hours ago, Stefan said:

Ambitious project @paulscottrobson!

Do you intend to store programs as plain text or as tokenized files?

If plain text, I guess you could use the text editor I've been working on to write BASIC code. Please let me know if you require anything special to make that work.

EDIT: And I almost forgot. If you feel old school, there is also the LED in the downloads section. I like that a lot. It's surprisingly efficient to use.

Well both 🙂 At present it's text editor -> Python script -> tokenised file -> BASIC, so it's acting like a runtime more than anything. I will write tokeniser/detokeniser/editor code, and it's fairly simple though slightly different to MSBasic, in that an identifier is always a single element, it doesn't tokenise TOTAL as <TO> TAL. Extending the standard load / save so it could load a text file or take it from another point in memory would be easy enough. It does still use line numbers but doesn't actually need them (except for backwards compatibility - GOTO GOSUB and RETURN are still there) but they could be just generated on the fly.

 

Edited by paulscottrobson
Link to comment
Share on other sites

On 3/3/2021 at 5:59 PM, Wertzui said:

As we are today in the lockdowns and we have to live our lives on our main PC, it would be a refreshing change to sit in front of something different and type away, no urge to open the Internet, no dayjob stuff, no stupid news and social media in reach.

Precisely. I expect the higher productivity will be those that program it on the emulator and run it on the real iron just as a final test ... but the greater satisfaction may be those who turn off the modern world and program it old school.

Mind, I wouldn't do it in Basic.

Link to comment
Share on other sites

5 hours ago, BruceMcF said:

Precisely. I expect the higher productivity will be those that program it on the emulator and run it on the real iron just as a final test ... but the greater satisfaction may be those who turn off the modern world and program it old school.

Mind, I wouldn't do it in Basic.

Depends what BASIC 🙂 People conflate the Microsoft/Dartmouth BASICs with more advanced ones.

Link to comment
Share on other sites

On 3/7/2021 at 1:57 AM, paulscottrobson said:

Depends what BASIC 🙂 People conflate the Microsoft/Dartmouth BASICs with more advanced ones.

For some it may depend, I wouldn't do it in one of the more advanced Basics either.

Link to comment
Share on other sites

16 hours ago, BruceMcF said:

For some it may depend, I wouldn't do it in one of the more advanced Basics either.

I'm not minding using an incremented BASIC.

Although ... well I *should* be doing my coding in C, shouldn't I?  I mean that's closer to my natural medium.

I guess all the PETSCII and cursor and color codes are still available... it's quite a paradigm shift, writing Commodore stuff with C.

 

 

Link to comment
Share on other sites

19 minutes ago, rje said:

I'm not minding using an incremented BASIC.

Although ... well I *should* be doing my coding in C, shouldn't I?  I mean that's closer to my natural medium.

I guess all the PETSCII and cursor and color codes are still available... it's quite a paradigm shift, writing Commodore stuff with C.

I used the X-16 as an excuse to take another run at C.

The results so far?  A PETSCII game: https://github.com/mparson/gridgame (slightly older version available in the X-16 downloads section).

I started with the X-16 as the target, but now it compiles and runs on the C-64 and 128 as well.

Link to comment
Share on other sites

3 minutes ago, Michael Parson said:

I used the X-16 as an excuse to take another run at C.

The results so far?  A PETSCII game: https://github.com/mparson/gridgame (slightly older version available in the X-16 downloads section).

I started with the X-16 as the target, but now it compiles and runs on the C-64 and 128 as well.

Ah, I saw that in the downloads section.  Perfect, thank you.

 

Link to comment
Share on other sites

7 hours ago, rje said:

I'm not minding using an incremented BASIC.

Although ... well I *should* be doing my coding in C, shouldn't I?  I mean that's closer to my natural medium.

I guess all the PETSCII and cursor and color codes are still available... it's quite a paradigm shift, writing Commodore stuff with C.

I was referring to Forth, as I do not expect R to get ported to the CX16. Programming in C for me is too much like working for a living ... if the sole other alternative was C, I might give a more advanced Basic, especially one with both an interpreter and a compiler, a shot!

Link to comment
Share on other sites

C IS the language of Atlantis, after all. 😄

Honestly, as long as whatever we get is well documented and follows the strictures of BASIC - Whether it's C64 Basic 2.0, or C64Basic2.0++ or Basic 7, or SmileBASIC, or BubbaBASIC, Grandma Tillerson's ButteryBASIC? I'm sure a well-documented, well-cookbooked community will adapt and be able to program for the machine. The real question is: is the backwards compatibility requirement in the specification a hill really worth dying on if the machine's ACTUAL specifications can't be used by its core audience (newbs and amateurs)?

Everyone involved are very smart people, so I think it'll be worked out. 🙂

Edited by Starsickle
  • Haha 1
Link to comment
Share on other sites

 

Quote

Precisely. I expect the higher productivity will be those that program it on the emulator and run it on the real iron just as a final test ... but the greater satisfaction may be those who turn off the modern world and program it old school.

Mind, I wouldn't do it in Basic.

My current development method is that I write the BASIC code in a text editor, and copy-paste the text into the emulator.

So what if you could do something similar ON the hardware itself? The X16 appears to be fast and stable enough for that.

Like, having a comfortable text editor residing in hight memory (with maybe some help with the line numbers and syntax color highlights), you can save a separate ASCII source file, and on command, it could plop the the code into the BASIC memory and you could test it, then jump back to the text editor.

It would be great ...or maybe not, but I can see myself trying to get to somewhere with that.

Link to comment
Share on other sites

1 hour ago, Wertzui said:

My current development method is that I write the BASIC code in a text editor, and copy-paste the text into the emulator.

So what if you could do something similar ON the hardware itself? The X16 appears to be fast and stable enough for that.

Like, having a comfortable text editor residing in hight memory (with maybe some help with the line numbers and syntax color highlights), you can save a separate ASCII source file, and on command, it could plop the the code into the BASIC memory and you could test it, then jump back to the text editor.

It would be great ...or maybe not, but I can see myself trying to get to somewhere with that.

I happen to be working on that very thing. I think I’ve got all the pieces pretty much worked out, now I just need to stitch them together.

Here’s the vision: in the editor, no line numbers, just labels. You’ll be editing the code in place, no separate file, no compilation translation or transpilation. The editor will just abstract away the line numbering, but will still leave a native V2 basic file that can be run, saved, and distributed without requiring the editor.

Also: long variable names, again, abstracting away the actual implementation that will still use the 1 or 2 character variables. What it’ll do is have a dictionary of labels and variable names in rem statements that the editor will use to map the “friendly” to the actual.

I’m a fan of “less is more” in interface design, so will have minimal interface real estate.

I’m working on the assumption that V2 basic is pretty much set for the X16. Somebody please correct me if there’s a chance that a different Basic might actually make it in.

  • Like 2
Link to comment
Share on other sites

5 hours ago, x16tial said:

I happen to be working on that very thing. I think I’ve got all the pieces pretty much worked out, now I just need to stitch them together.

Here’s the vision: in the editor, no line numbers, just labels. You’ll be editing the code in place, no separate file, no compilation translation or transpilation. The editor will just abstract away the line numbering, but will still leave a native V2 basic file that can be run, saved, and distributed without requiring the editor.

Also: long variable names, again, abstracting away the actual implementation that will still use the 1 or 2 character variables. What it’ll do is have a dictionary of labels and variable names in rem statements that the editor will use to map the “friendly” to the actual.

I’m a fan of “less is more” in interface design, so will have minimal interface real estate.

I’m working on the assumption that V2 basic is pretty much set for the X16. Somebody please correct me if there’s a chance that a different Basic might actually make it in.

Yeah, that sounds a lot like how my BASIC code editor works. 

I'm starting to think that all of us who are doing basically the same thing should get together and standardize our syntax, since all of ours is probably different, and it would be good to standardize it to make code sharing easier. 

 

  • Like 2
Link to comment
Share on other sites

3 hours ago, TomXP411 said:

Yeah, that sounds a lot like how my BASIC code editor works. 

I'm starting to think that all of us who are doing basically the same thing should get together and standardize our syntax, since all of ours is probably different, and it would be good to standardize it to make code sharing easier. 

 

Not a bad idea, who all are working on something like this, besides me and you?

Link to comment
Share on other sites

1 hour ago, x16tial said:

Not a bad idea, who all are working on something like this, besides me and you?

I think @rje  has mentioned it a couple of times. He's been calling it a "transpiler".

So far, I have planned and/or implemented:
VAR LongName=LN (done⁑)
#pc #c64 #cpm #bbc - line is only emitted on this platform (done*)
#!pc #!c64 #!cpm #!bbc - line is NOT emitted on this platform (done)
@labels  (with GOTO and GOSUB @label) (done)
@@ - same line (GET A$:IF A$="" THEN @@) (done)
DO [WHILE|UNTIL] / LOOP [WHILE|UNTIL] (in progress)
IF condition BEGIN/ENDIF - multi line IF/THEN block.  (future)

*platform filters are currently one per line. I want to change that so the line can have multiple filters, like:
#pc #cpm #c64

⁑Any word in the program that does not have an entry in the token table is treated as a variable and auto-mapped. I may change this to allow easier coding for expanded BASICs. Or I may add a user-editable syntax table. 

 

 

Link to comment
Share on other sites

15 hours ago, Starsickle said:

C IS the language of Atlantis, after all. 😄

Honestly, as long as whatever we get is well documented and follows the strictures of BASIC - Whether it's C64 Basic 2.0, or C64Basic2.0++ or Basic 7, or SmileBASIC, or BubbaBASIC, Grandma Tillerson's ButteryBASIC? I'm sure a well-documented, well-cookbooked community will adapt and be able to program for the machine. The real question is: is the backwards compatibility requirement in the specification a hill really worth dying on if the machine's ACTUAL specifications can't be used by its core audience (newbs and amateurs)?

If C is the language of Atlantis, that would explain why flooding the continent was preferable to continuing to run it.

The ROM Basic is the equivalent of DOS's batch file language ... it's what is there on power up (well, boot-up on DOS).

But nobody was limited to programming on BAT files alone. Similarly, with the loading speed of the CX16, there is no need to die any any particular programming hill ... people can use whatever programming language they load onto an SD card. Indeed, if the discussed auto-exec bootup file parameter is stored on the RTC, as has long been discussed as a design goal, people can boot up into any environment they want to. 

  • Haha 1
Link to comment
Share on other sites

On 3/9/2021 at 9:29 PM, x16tial said:

Not a bad idea, who all are working on something like this, besides me and you?

My current syntax is at https://github.com/paulscottrobson/6502-basic/blob/main/documents/Reference.pdf

That stuff is implemented as opposed to planned, though it's still pretty fragile obviously, it hasn't been bashed much. You can run programs from text source and type stuff in at the keyboard but you can't edit programs through the keyboard yet. Not that there's any point as the token tables are not set in stone(ish) yet.

There's no X16 specific stuff except some basic text I/O commands, VPOKE VPEEK() and 16 bit versions VDOKE and VDEEK(). No assembler yet. Still single index arrays (the array code needs rewriting). All the hooks are in there for floats, but no actual code yet.

Also for a consistent syntax, anything real text is in quoted strings, hence REM "this is a comment" and likewise with DATA.

Screenshot from 2021-03-10 14-49-27.png

Edited by paulscottrobson
Update
  • Like 2
Link to comment
Share on other sites

On 3/9/2021 at 5:17 PM, TomXP411 said:

VAR LongName=LN
#pc #c64 #cpm #bbc - line is only emitted on this platform (done*)
@labels  (with GOTO and GOSUB @label) (done)
@@ - same line (GET A$:IF A$="" THEN @@) (done)
DO [WHILE|UNTIL] / LOOP [WHILE|UNTIL] (in progress)
IF condition BEGIN/ENDIF - multi line IF/THEN block.  (future)

These are nice. 

I could handle the 'var' keyword instead of my current 'longvar'.

I used to allow an explicit mapping to a two letter var, but now I just gen them up, starting with A0-A9, then B0-B9, and on up.  I figure 260 unique long variables is enough.


Similarly, I could easily handle the shell-inspired octothorpe for platform-only comments.
And I could recognize @my.label.  It's easier than writing {:my.label}, which I think I borrowed from C64LIST. 

Do you allow periods in your labels?  I find it handy.
@@ is clever.

I don't have loops or code blocks.

Edited by rje
Link to comment
Share on other sites

This all started out as David Murray's dream 8-bit computer.  I think the specs and emulator are pretty close to what he outlined a year and a half ago.

So, who says a dream 8-bit computer has to be stuck with 40 year old code?  What would be the dream language?

We're using the 65c02, so we have a stack.  One stack, always at 0100-01FF.  That's a hard limit on anything that can be done in a language for the X16.

If we're not using BASIC, then the whole of zero page is open except 0000 and 0001 should be off-limits as those are going to be the ROM bank pointer and RAM bank pointer in the new version of the board.  There's also a number of zero page locations being used by the Kernal (i.e. 82 and 83 are overwritten by JSRFAR).  A number of the API subroutines use the zero page locations from 02-21, the lower addresses in particular.  We'd want to keep using the Kernal and API so, in practical terms, the zero page values from 22-7F are available for the dream language.

RAM bank 00 should also be off-limits as that is used by the Kernal and API.

Any computer language has to consider paradigm - which is really just a set of limitations imposed upon the programmer.  For instance, having local-scope variables makes those variables inaccessible to code outside the scope, and if a programmer wants access to that variable outside the scope must have some kind of PUT and GET subroutines within the scope.  It's a limitation imposed on the programmer, but it's done with the purpose of preventing the accidental use of a variable outside its scope.

And every feature that is part of the language is a trade-off.  Longer variable names or double-precision floating point numbers have advantages, but they come at a cost of increased storage for more characters in a name or more bytes used to represent the variable.

So, what sort of paradigm would people like for the Dream Language? (that's actually a pretty good name, come to think of it)  What sort of features?  Longer variable names, label identifiers, extended variable types?  Local and global variables?  File handling using something like iostream?

And heck while I'm at it, why not a dream OS?  GeckOS looks interesting

  • Like 1
Link to comment
Share on other sites

3 hours ago, rje said:

Do you allow periods in your labels?  I find it handy.
@@ is clever.

I don't see why not. My parser looks for a letter first, then either a letter, number, or underscore. I could easily add periods to that check. 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use