Jump to content
IGNORED

FastBasic - Summer Release


dmsc

Recommended Posts

Hi!

 

Hello,

 

So, I'm a little lost.

 

How much free memory fastbasic provides ?

 

Cheers

 

Devwebcl

 

Booting the FastBasic 3.5 atr disk, loading FBI.com, entering PRINT FRE() in the editor, then pressing CTRL-R to parse/compile/execute shows 30755 after that tiny bit of code. When compiling as an executable to disk, the FRE() amount will be less (around 2K less or so) bc of the inclusion of the runtime. Using FB.COM the above sample will yield about 29467.

 

dsmc has done a fantastic job with his BASIC.

Yes, in the IDE you have about 31200 bytes free at the start, this will be used by the program source (in the editor) and the compiled code.

 

But, if you compile the program to disk (pressing CONTROL-W on the ide) you have about 37600 bytes free, because you don't have the compiler, editor and source in memory, only your program code and runtime.

 

And finally, if you compile with the cross compiler (from a PC), you will have more free memory because the cross compiler includes only the parts of the runtime that are used.

  • Like 2
Link to comment
Share on other sites

I had no clue there was a cross compiler...I must check this out! You have developed a fantastic piece of software.

Hi!

 

 

 

 

Yes, in the IDE you have about 31200 bytes free at the start, this will be used by the program source (in the editor) and the compiled code.

 

But, if you compile the program to disk (pressing CONTROL-W on the ide) you have about 37600 bytes free, because you don't have the compiler, editor and source in memory, only your program code and runtime.

 

And finally, if you compile with the cross compiler (from a PC), you will have more free memory because the cross compiler includes only the parts of the runtime that are used.

Sent from my ASUS PadFone X using Tapatalk

Link to comment
Share on other sites

Hi!

 

curiosity COMAL-80, still in use

 

https://en.wikipedia.org/wiki/COMAL

but alas not on any Atari save possibly Amiga?

Well, almost all "extended" BASICs for the Atari are really similar to COMAL, as the keywords are an extension to the BASIC ones, like "PROC/EXEC", "WHILE", "REPEAT", "IF/ELSE/ELIF/ENDIF", etc. Main difference is the ":=" for assignment in COMAL instead of "=" in BASIC.

 

Comparing FastBasic and COMAL, I think the main differences are:

- COMAL allows line numbers (but only as an editor facility)

- COMAL has procedure parameters. I did not add procedure parameters to FastBasic (yet) as my goal was 8kB for the integer version.

- FastBasic does not have GOTO, COMAL allows GOTO to labels. Adding GOTO to FastBasic is really complicated, as you have to unroll the stack to jump from inside a FOR or PROC to outside, and I don't like needing "POP" (like Atari BASIC) to fix the stack.

- FastBasic does not have CASE/WHEN. I don't think this is that useful a feature, as the same can be written with "IF/ELIF".

- FastBasic uses the Atari I/O statements (OPEN with numeric arguments and IOCB number).

 

I tend to see COMAL as another step in the evolution from the classic BASICs of the '60 to the advanced BASICs of the '90 like QuickBasic.

  • Like 3
Link to comment
Share on other sites

  • 3 months later...
  • 4 months later...

I recently learned of FastBasic.   I tried following an example from the manual but get a "parse error" with 'X' flagged in the DATA statement.  What am I doing wrong?

 

DIM X(10) BYTE
DATA X() BYTE = 2, $41, $42
? $( ADR(X) )

 

Loving the speed of the example programs.  Thanks for this, dmsc!

 

-SteveS

Edited by a8isa1
Link to comment
Share on other sites

You don't need to use the DIM statement, the DATA statement sets up the array for you.

 

Also, you can't use the $ sign like that, it's just for entering numbers in hex like you did in the DATA statement

 

Even if you were to do PRINT $10 the output would be in decimal anyway.

Edited by Preppie
Link to comment
Share on other sites

2 hours ago, Preppie said:

You don't need to use the DIM statement, the DATA statement sets up the array for you.

 

Also, you can't use the $ sign like that, it's just for entering numbers in hex like you did in the DATA statement

 

Even if you were to do PRINT $10 the output would be in decimal anyway.

ah!  didn't know about not needing the DIM. Thanks.

 

The other two lines are an example from the manual.  Works fine as typed.

 

-SteveS

Link to comment
Share on other sites

Hi!

1 hour ago, Preppie said:

I thought one of us was going crazy there, but the manual has been updated since last time I downloaded it.

 

I'll have to have a read and see if it says anything about why the cross compiler doesn't do it this way.

 

Yes, the $() function is a new addition, so it is not available in the last release (4.0), but it is in the last betas. So, you are using a newer IDE but an old cross compiler.

 

I need to do a new release soon, but I want to to finalize some things before.

 

Have Fun!

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Nice! This is another simple solution to save memory instead of having a lot of 258 bytes chunks of memory to store an array with small constant strings.

 

Previously, to save memory you could define all string data in a single string and two arrays with relative pointers and lenghts to be used with the bracket operator.

 

Now you only need the required bytes per string plus the leading byte with the length and a word array to store the memory pointers.

 

Would it be a simple way to initialize such a structure?

 

BTW, I had used $[] notation as an operator instead of $() for this "function".

Link to comment
Share on other sites

Is there a beta available from the last month or so? I’d love to to try it out if there is one (it seems I have a beta from around the middle of August). 
 

It has been unusually warm here for this time of year, but that trend is supposed to break in a few days and autumn will bring her cooler weather :) With that, I’m healed from this summer’s medical procedures, and would like to help some more soon. I’d be happy to help some more with the manual (I have found mistakes I made), samples and snippets, etc.

 

Browsing a local thrift store netted me another dirt cheap Dell E6230. 25 dollars in and I’ve got a nice little dedicated Atari emulator laptop. I finally setup a real 800XL and 1050 a few days ago, along with an SIO2PC USB cable and booted Fast Basic first (image below). It was surreal to use it on a physical, real Atari.
 

I would be happy as a pig in poop to help in any manner I can. 

446E7070-79E4-43FE-874D-605B27FA0080.jpeg

  • Like 1
Link to comment
Share on other sites

Hi!

On 9/30/2019 at 7:56 AM, 777ismyname said:

Is there a beta available from the last month or so? I’d love to to try it out if there is one (it seems I have a beta from around the middle of August). 

 

Attached is current development version, so you can try it.

 

On 9/30/2019 at 9:13 AM, vitoco said:

Please forget I said that... because I think it would be most useful to combine both: $($4000)[10,3]

 

Is that possible?

 

Yes, of course :) 

 

As the "function" $() returns a string, any operator/function on strings is possible. The good thing is that it is very simple at the parser level, it simply changes the type from integer to string, so it uses no code at all.

 

Have Fun!

 

fastbasic-4.1-b3.atr fastbasic-v4.1-b3-maxosx.zip fastbasic-v4.1-b3-win32.zip fastbasic-v4.1-b3-linux64.zip

  • Like 7
Link to comment
Share on other sites

56 minutes ago, dmsc said:

As the "function" $() returns a string, any operator/function on strings is possible. The good thing is that it is very simple at the parser level, it simply changes the type from integer to string, so it uses no code at all.

Great!

 

BTW, why did you named that function as $() instead of MEM$() or something like this?

 

Edited by vitoco
Link to comment
Share on other sites

Hi!

7 hours ago, vitoco said:

Great!

 

BTW, why did you named that function as $() instead of MEM$() or something like this?

I though about naming it "PEEK$()", as it "reads a string from memory", like PEEK reads a byte, but as it is a new addition, I selected a shorter name - this also uses less bytes in the parser :P.  A nice thing is that "ADR($(1234))" is "1234", as the "ADR()" "casts" the string to an integer again.

 

I think that there are no other small BASIC dialects that allow "casting a pointer to a string", but BBC Basic for Windows have somewhat similar operators, $ and $$http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin2.html#dollar - but IMHO, without parentheses is more confusing.

 

I also though of adding a similar "%()" function that "reads a floating point from memory", for example %($DFF0) would return PI/4 - from the OS math-pack. Would that be useful?

 

Link to comment
Share on other sites

Hi!

 

I did not see this before:

On 9/30/2019 at 7:15 AM, vitoco said:

Nice! This is another simple solution to save memory instead of having a lot of 258 bytes chunks of memory to store an array with small constant strings.

 

Previously, to save memory you could define all string data in a single string and two arrays with relative pointers and lenghts to be used with the bracket operator.

 

Now you only need the required bytes per string plus the leading byte with the length and a word array to store the memory pointers.

 

Would it be a simple way to initialize such a structure?

I tried to implement the following syntax:

DATA SmallStr$() = "hello", "world", "and", "many", "more", "words"

But it is not easy currently, as you need to accumulate two arrays, one for the string memory ( 5, "hello", 5, "world", 3, "and" ...) and another one with the pointers to the lengths. Only way would be to create the address array at run-time.

 

But what is easy is this:

DATA StrMem() byte = "hello", "world", "and", "many", "more", "words"
DIM StrAdr(5)

P = ADR(StrMem)
FOR i=0 TO 5
  StrAdr(i) = P
  P = P + LEN($(P)) + 1
NEXT

FOR i=0 TO 5 : ? $(StrAdr(i)) : NEXT

Have Fun!

 

Link to comment
Share on other sites

15 hours ago, dmsc said:

I also though of adding a similar "%()" function that "reads a floating point from memory", for example %($DFF0) would return PI/4 - from the OS math-pack. Would that be useful?

It might be used to read values from any chunk of data (binary records from a file) without having to move first those bytes to a single element array to get the value. It could also be used to implement a sparse matrix. ?

 

14 hours ago, dmsc said:

But what is easy is this:


DATA StrMem() byte = "hello", "world", "and", "many", "more", "words"
DIM StrAdr(5)

P = ADR(StrMem)
FOR i=0 TO 5
  StrAdr(i) = P
  P = P + LEN($(P)) + 1
NEXT

FOR i=0 TO 5 : ? $(StrAdr(i)) : NEXT

I didn't know that you could assign strings to byte arrays. Now, it has sense. For the loop, I was thinking in the use of PEEK(P) instead of LEN($(P)).

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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...