Jump to content
IGNORED

FastBasic 4.0 - Tenliners'19 release


dmsc

Recommended Posts

I think I've learned how to define a language in Notepad++ (instructions).

 

It's possible to define up to eight different keywords styles.

Would you divide them? How?

 

Here are the keywords I found, in manual's order.

TIME ABS SGN RAND FRE ERR LEN VAL ASC

PADDLE PMADR PTRIG STICK STRIG KEY

ATN COS EXP EXP10 INT LOG LOG10 RND SIN SQR

STR$ CHR$

ADR DPEEK PEEK USR

GET INPUT POSITION PRINT PUT CLS

DO LOOP EXEC EXIT FOR NEXT IF THEN ELIF ELSE ENDIF PROC ENDPROC REPEAT UNTIL WHILE WEND

COLOR DRAWTO FCOLOR FILLTO GRAPHICS PLOT PMGRAPHICS PMHPOS SETCOLOR SOUND

BGET BPUT CLOSE OPEN PRINT XIO

’ / . DATA DEC DIM END INC PAUSE

DEG RAD

DPOKE MOVE -MOVE MSET POKE

 

  • Like 3
Link to comment
Share on other sites

Looks good Philson.  Quite some time back I had created a Notepad++ language set for Action! and it worked out okay.  It's not really possible to use the language add in facility in NP++ and have it work as good as the built in support, but it's still helpful and worth doing/using.

 

These days though I no longer use NP++ as use Windows as little as possible.

 

Edited by fujidude
Link to comment
Share on other sites

  • 1 month later...

I'd just like to heap a little more praise onto FastBasic and DMSC :)

 

I found a bug last night which messed up the editor with programs in excess of 465 lines.  I reported it last night and when I woke up in the morning it was fixed.

 

Awesome work DMSC - thanks.

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

I'd just like to heap a little more praise onto FastBasic and DMSC atariage_icon_smile.gif
 
I found a bug last night which messed up the editor with programs in excess of 465 lines.  I reported it last night and when I woke up in the morning it was fixed.
 
Awesome work DMSC - thanks.


I agree 100%! DSMC has done a phenomenal job with Fast BASIC. I have been off of the radar for a few months and come back to a new beta version. Good times, indeed!



Sent from my iPhone using Tapatalk
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

After my recent conquest of the command line while installing cc65 (lol) I thought I'd give this auto running from np++ a shot.  This is done by a guy blindly messing around with stuff he doesn't understand so don't blame me if anything goes wrong lol.  I know this isn't the right way but it works (to a limited degree)

 

First I installed Irgendwer's turban using the package made by ggn from here http://tiddly.mooo.com/various/turban.w10.zip you could just install notepad++ with the nppexec plugin but this sets up a nice TurboBasic package too.

 

Then I installed cc65 to C:\cc65 with the help of Wrathchild in this thread

 

and then installed the fastbasic compiler to c:\cc65\fb

 

I also put my FastBasic project file into c:\cc65\fb

 

I tried to get notepad++ to do the work but from what I can tell the nppexec plugin doesn't recognise .xex and throws up an error

So, with a bit of guess work, I edited the fb-int.bat file and inserted the following line after line 46:

 

%xexfile%

 

And in the nppExec promt when you press f6 I altered it to read:


npp_save
ENV_SET PATH=$(CURRENT_DIRECTORY);$(CURRENT_DIRECTORY)\..
fb-int.bat $(FULL_CURRENT_PATH)


Now I can code in the project file and when I press f6 or f7 the file is saved, compiled to an xex and ran :)


Problems are that you have to have the project file in the cc65\fb folder, you can't put it in a sub folder or anywhere else.  Also, if you want to do some TurboBasic programming you need to change the nppexec command back to point to the turban.bat

Not perfect but better than copy&pasting code from notepad to altirra

 

 

edit: Looking back over this thread I see Philsan got it working too, I just didn't understand what he was talking about at the time.  I still don't understand how his way works as the compiled program is a .xex not a .bas
 

Edited by Preppie
  • Like 1
Link to comment
Share on other sites

Is there a repository somewhere of "Tenliners" or other short programs written in FastBasic? Or examples that could be posted here?  P.S. maybe a little more complex than PRINT "Hello World"  ;-)  I haven't followed these FB threads too faithfully, but I have looked and didn't run across them.

 

 

Link to comment
Share on other sites

Hi!

7 hours ago, Larry said:

Is there a repository somewhere of "Tenliners" or other short programs written in FastBasic? Or examples that could be posted here?  P.S. maybe a little more complex than PRINT "Hello World"  ;-)  I haven't followed these FB threads too faithfully, but I have looked and didn't run across them.

The FastBasic distribution includes some samples, see https://github.com/dmsc/fastbasic/tree/master/samples/int for integer ones and https://github.com/dmsc/fastbasic/tree/master/samples/fp for the ones that need floating point.

 

The current list is:

- ahlbench.bas: The famous "ahl" benchmark, test floating point speed.
- carrera3d.bas: My old "Carrera 3D" ten-liner, expanded and converted to FastBasic.
- draw.bas: A little drawing demo, using PLOT and DRAWTO.
- fedora.bas: Draws the "Fedora Hat" demo.

- iospeed.bas: Compares speed of different I/O methods.
- joyas.bas: A small version of my "Joyas" game, there is a version with more graphics and games in another thread of this forum.
- pi.bas: Calculates (and prints) 254 digits of PI.
- pmtest.bas: Simple demo that shows how to use Player Missile graphics.
- sieve.bas: Calculates all the primes less than 16380, this is the old "sieve" benchmark.

 

Have Fun!

 

  • Like 1
Link to comment
Share on other sites

Trying to assign variable to dpeek($10)+13

 


V2=(DPEEK(10)+13)
V3=PEEK(V2):V4=PEEK(V2+1):V5=PEEK(V2+2)
:V6=PEEK(V2+3):V7=PEEK(V2+4):V5=V5+2000
:V8=PEEK(V2+5)
? V6;":";V7;":";V8;
IF V6<13:? "am";
ELSE
? "pm";
ENDIF
? "    Atari Time     ";(V4);"-";(V3);"-";(V5)

Now I need a day of week string..

Edited by rdea6
I found that I don't need a String variable.
Link to comment
Share on other sites

  • 4 weeks later...
On ‎5‎/‎8‎/‎2019 at 9:11 PM, dmsc said:

If you want, you can send me some of your code to help converting to "no GOTOs"

10 DIM E$(38),U(12),WD$(3):X=4:E=12:Z=10:W7=7:GR. 0
20 E$="   Sun  Mon  Tue  Wed  Thr  Fri  Sat  "
30 C=(PEEK(Z)+(PEEK(Z+1)*256))+(E+1)
40 DAY=PEEK(C):MONTH=PEEK(C+1):YEAR=PEEK(C+2):IF C>3500 THEN GOSUB 160
50 RESTORE 190
60 FOR N=1 TO E:READ SX:U(N)=SX:NEXT N
70 G4=INT(YEAR/X):H=YEAR-(INT(YEAR/X)*X):FT=U(MONTH)
80 IF (H=0) AND (MONTH=1) THEN FT=6
90 IF (H=0) AND (MONTH=2) THEN FT=2
100 SX=(DAY+FT+YEAR+G4)+6:FWD=SX-(INT(SX/W7)*W7)
110 RESTORE 200
120 FOR N=0 TO FWD:READ WD$:NEXT N
130 B=X+(FWD)*(X+1):E=B+2
140 FOR N=1 TO 3:WD$(N,N)=CHR$(ASC(WD$(N,N))+128):NEXT N
150 E$(B,E)=WD$:? :? E$:? ,MONTH;"/";DAY;"/";YEAR+2000:END 
160 EW=54712
170 POKE EW,3:DAY=(PEEK(EW)*Z)+PEEK(EW):POKE EW,4:MONTH=(PEEK(EW)*Z)+PEEK(EW)
180 POKE EW,5:YEAR=(PEEK(EW)*Z)+PEEK(EW):RETURN 
190 DATA 0,3,3,6,1,4,6,2,5,0,3,5
200 DATA Sun,Mon,Tue,Wed,Thr,Fri,Sat

The read sx and read wd$  are problems for me also.

I have read the manual but I get lost because of crappy PDF reader.

Link to comment
Share on other sites

Hi!

10 hours ago, rdea6 said:

The read sx and read wd$  are problems for me also.

I have read the manual but I get lost because of crappy PDF reader.

 

This is a converted version. It works if you have RVerter and comment out the "IF C > 3500". I don't know how it reads the date from dos.

 

  graphics 0
  WD$ = "   Sun  Mon  Tue  Wed  Thr  Fri  Sat  "
  data U() byte = 0,3,3,6,1,4,6,2,5,0,3,5

  C = dpeek( 10 ) + (12 + 1)

  DAY = peek( C )
  MONTH = peek( C + 1 )
  YEAR = peek( C + 2 )

  if C > 3500
    exec readRTime
  endif

  G4 = YEAR / 4
  H = YEAR mod 4
  FT = U( MONTH - 1 )

  if ( H = 0 ) and ( MONTH = 1 ) then FT = 6
  if ( H = 0 ) and ( MONTH = 2 ) then FT = 2

  SX = ( DAY + FT + YEAR + G4 ) + 6
  FWD = SX mod 7

  B = 3 + FWD * 5
  E = B + 2

  O$ = WD$[1, B]
  for N = 1 to 3
    O$ =+ chr$(asc(WD$[B+N,1]) + 128)
  next N
  O$ =+ WD$[B+4]

  print
  print O$
  print , MONTH; "/"; DAY; "/"; YEAR + 2000

  get N
  end


proc readRTime
  EW = $D5B8
  poke EW, 3
  DAY = ( peek( EW ) * 10 ) + peek( EW )
  poke EW, 4
  MONTH = ( peek( EW ) * 10 ) + peek( EW )
  poke EW, 5
  YEAR = ( peek( EW ) * 10 ) + peek( EW )
endproc

 

Have Fun!

  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
10 REM COLORBARS
20 GRAPHICS 10
30 FOR B=1 TO 8:REM BAR LOOP
40   READ C:POKE 704+B,C:COLOR B
50   FOR X=B*8 TO X+8:PLOT X,0:DRAWTO
X,185:NEXT X:NEXT B
60 GOTO 60:REM DO NOTHING-EXIT W/BREAK
KEY
70 REM COLOR DATA
80 DATA 14,250,168,212,84,66,146,2

I modified this small basic program from @mytek's colorbar program but the output screen are different.  @dmsc could you explain why? 

coolbar.thumb.png.7311fb88b47faff917f77912826526fc.png colorbar.thumb.png.4e3144499381734414d991870e2bc145.png

top picture is fast basic and bottom Turbobasic.

and this is the fastbasic code.

DATA C() BYTE =14,250,168,212,84,66,146,2

GRAPHICS 10

FOR B=1 TO 8

POKE 704+B,C(B)

COLOR B

FOR X=B*8 TO X+8
PLOT X,0
DRAWTO X,185
NEXT X
NEXT B

GET B

 

Link to comment
Share on other sites

18 minutes ago, Roydea6 said:

I modified this small basic program from @mytek's colorbar program but the output screen are different.

You're indexing the C array from 1 to 8 instead of 0 to 7? I assume FastBASIC arrays are indexed from 0 onward, so you're actually taking colours starting at the second array element and getting the eighth colour from uninitialised RAM or program code. To fix, change:

POKE 704+B,C(B)

to:

POKE 704+B,C(B-1)
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Hi!

On 11/25/2019 at 5:09 AM, funkheld said:

fastbasic should also be able to edit the asm-source-code without having to convert it to give it fb in a line of code (data line).

greeting

 

Sorry, I don't understand what you are proposing. Perhaps if you post some source code with what do you mean?

 

Have Fun!

 

Link to comment
Share on other sites

Hi!

2 hours ago, funkheld said:

so in the way in fastbasic:

 

code
lda # 34
sta 2000
endcode

So, you want an assembler as part of the FastBasic IDE.

 

This would be possible, but with some limitations:

- Access to FastBasic variables would be difficult - as they are not at a fixed memory address.
- You would need some way to call your code, so you also need access the assembler variables from FastBasic.

- It would mean about 1KB extra memory usage in the IDE.

 

This is why I added the possibility to link external ASM files in the cross-compiler, so you can have all your assembly code in a separate file and simply pass the ASM file to the FastBasic compiler - without modifying the FastBasic language.

 

I could add a special syntax only to the cross compiler that would pass you assembly to CA65 under the hood, but I don't want to make the two languages different, one of the big advantages of FastBasic over other languages is that you can do all your development in the Atari itself.

 

Have Fun!

 

  • Like 1
Link to comment
Share on other sites

On ‎10‎/‎7‎/‎2019 at 5:25 AM, dmsc said:

This is a converted version.

I have another question about imbedded strings.

DIM AA$(255)
aa$(1,255):aa$(1,100)="1 through 100":aa$(101,200)="101 through 200":aa$(201,255)="201 through 255"

I have tried but keep getting parsing errors and at byte 186 I need to put a chr$(34)

Link to comment
Share on other sites

I have't done a lot with strings in FastBasic but if you read the manual you'll see that you don't need to DIM a string unless you want it to have elements eg.

 

DIM a$(9)

a$(1)="hello"

a$(2)="atari"

a$(3)="world"

?a$(2)

 

display = atari

 

To break up strings you need square brackets eg.

 

a$="hello atari world"
b$=a$[7,5]
?b$

 

display = atari

 

I'm sure DMSC will pop by and help, but reading the manual is always the best starting point.

  • Like 1
  • Thanks 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.
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...