Jump to content

Photo

Preview - New integer basic interpreter

basic compiler interpreter

59 replies to this topic

#26 pirx OFFLINE  

pirx

    Moonsweeper

  • 447 posts
  • Location:Poland

Posted Fri Jun 30, 2017 7:17 AM

i'd love to code one minimalistic basic interpreter and call it "Basic BASIC"



#27 dmsc OFFLINE  

dmsc

    Moonsweeper

  • Topic Starter
  • 473 posts
  • Location:Viņa del Mar, Chile

Posted Fri Jun 30, 2017 7:33 AM

Hi!
 

But errmmm,
 
Fast Basic is not a good name, since there already exists a Basic with that name for approx. 20 or more years - Fast Basic by Tom Hunt (has no extra commands, it is just about 10%-30% faster than Atari Basic)...


Well, I'm really bad at naming things, so no surprise there is another BASIC with the same name.
 

I believe that this project deserves a unique name.
Flying Basic, FlyBasic, DMSC Basic, FI Basic, Jet Basic, Citus Basic...


Mmmm.... not sure I like any of those :P (and, what "Citus" means?)
 

i'd love to code one minimalistic basic interpreter and call it "Basic BASIC"


Ha, this is a great name ;)

#28 baktra OFFLINE  

baktra

    Dragonstomper

  • 596 posts
  • Location:Czech republic

Posted Fri Jun 30, 2017 7:43 AM

Mmmm.... not sure I like any of those :P (and, what "Citus" means?)

It is a latin word. Citus means quick, swift, rapid.



#29 ascrnet OFFLINE  

ascrnet

    Chopper Commander

  • 182 posts
  • Location:Santiago, Chile

Posted Fri Jun 30, 2017 9:03 AM

Hi dmsc,

 

First of all, congratulations on the project. It really shows that it is an interpreter that brings together the best of all the others. Make the quick a typical example to test and it really works well.
 
This example is a game that you have to guess the number that the atari thinks
POKE 82,0
SECRETNUM=RAND(10)+1
REPEAT 
   PUT 125
   PRINT : PRINT "GUESS A SECRET NUMBER BETWEEW 1 AND 10"
   PRINT
   PRINT "YOUR GUES :";
   INPUT #16,GUESS
   PRINT : PRINT
   IF GUESS=SECRETNUM THEN PRINT "YOU GOT IT!"
   IF GUESS<SECRETNUM THEN PRINT "TOO LOW. TRY AGAIN."
   IF GUESS>SECRETNUM THEN PRINT "TOO HIGHT. TRY AGAIN."
   PAUSE 100
UNTIL GUESS=SECRETNUM
   PRINT : PRINT : PRINT "THE END":PUT 253

When I try this interpreter I think that the CHR$ command is missing for use with the PRINTs.

 IF GUESS<SECRETNUM THEN PRINT "TOO LOW. TRY AGAIN.";CHR(253)

regards

 



#30 dmsc OFFLINE  

dmsc

    Moonsweeper

  • Topic Starter
  • 473 posts
  • Location:Viņa del Mar, Chile

Posted Fri Jun 30, 2017 9:24 AM

Hi!
 

Hi dmsc,
 
First of all, congratulations on the project. It really shows that it is an interpreter that brings together the best of all the others. Make the quick a typical example to test and it really works well.
 
This example is a game that you have to guess the number that the atari thinks
 

POKE 82,0
SECRETNUM=RAND(10)+1
REPEAT 
   PUT 125
   PRINT : PRINT "GUESS A SECRET NUMBER BETWEEW 1 AND 10"
   PRINT
   PRINT "YOUR GUES :";
   INPUT #16,GUESS
   PRINT : PRINT
   IF GUESS=SECRETNUM THEN PRINT "YOU GOT IT!"
   IF GUESS<SECRETNUM THEN PRINT "TOO LOW. TRY AGAIN."
   IF GUESS>SECRETNUM THEN PRINT "TOO HIGHT. TRY AGAIN."
   PAUSE 100
UNTIL GUESS=SECRETNUM
   PRINT : PRINT : PRINT "THE END":PUT 253

When I try this interpreter I think that the CHR$ command is missing for use with the PRINTs.
 IF GUESS<SECRETNUM THEN PRINT "TOO LOW. TRY AGAIN.";CHR(253)
regards


Yes, you can replace it with:
IF GUESS<SECRETNUM : ? "TOO LOW. TRY AGAIN."; : PUT 253 : ENDIF


#31 Synthpopalooza OFFLINE  

Synthpopalooza

    Stargunner

  • 1,472 posts
  • Location:knoxville, TN

Posted Fri Jun 30, 2017 9:55 AM

How about FujiBASIC? :)

#32 Bryan OFFLINE  

Bryan

    Quadrunner

  • 10,926 posts
  • Cruise Elroy = 4DB7
  • Location:Chesaning, MI

Posted Fri Jun 30, 2017 2:54 PM

I kinda like JetBASIC.

 

InsaneBASIC? FlashBASIC? NitroBASIC?



#33 ascrnet OFFLINE  

ascrnet

    Chopper Commander

  • 182 posts
  • Location:Santiago, Chile

Posted Fri Jun 30, 2017 7:38 PM

Hi!
 
Yes, you can replace it with:

IF GUESS<SECRETNUM : ? "TOO LOW. TRY AGAIN."; : PUT 253 : ENDIF

 

Of course, I said it because right here I miss it. ;-)

Now another command that I miss is the TEXT of TBXL is it possible to implement it? :?

And the last in a future is thought to make a binary compiler? :?

regards



#34 dmsc OFFLINE  

dmsc

    Moonsweeper

  • Topic Starter
  • 473 posts
  • Location:Viņa del Mar, Chile

Posted Fri Jun 30, 2017 11:10 PM

Hi!

I updated the interpreter, now it supports DATA and USR.

This is a sample of both:
' Define a Machine Language routine:
'  PLA / EOR $FF / TAX  / PLA / EOR $FF / RTS
data ml() byte = $68,$49,$FF,$AA,$68,$49,$FF,$60

' Calls the routine with different values
for i=0 to 1000 step 100
    ? i, usr(adr(ml),i)
next i
Note that DATA statements define an array with the data, so you must specify if it's "byte" or "word" type. Also, DATA can be continued over lines by skipping the last comma and the variable name in the next lines:
  DATA big() byte = $12,$23,$45,$00,$15,
  DATA       byte = $08,$09,$15
USR function passes arguments in the stack and expects the return value in A/X registers (A = low part, X = high part).

The updated sources are over github.

Attached Files



#35 Philsan OFFLINE  

Philsan

    River Patroller

  • 3,803 posts
  • New Orleans Saints Super Bowl XLIV Champions
  • Location:Switzerland

Posted Sat Jul 1, 2017 12:46 AM

Thank you very much for your PMG routine, now included in latest FastBasic version.

Which is the easiest way to write, edit and launch FB programs?

 

EDIT

 

I read first post: "What is missing is an editor".



#36 Larry OFFLINE  

Larry

    River Patroller

  • 4,083 posts
  • Location:U.S. -- Midwest

Posted Sat Jul 1, 2017 2:30 AM

DMSC Basic had a nice ring to it. Great project!
-Larry

#37 Rybags OFFLINE  

Rybags

    Gridrunner

  • 15,990 posts
  • Location:Australia

Posted Sat Jul 1, 2017 5:27 AM

iBasic ?

 

Citus Basic - dunno, sounds a bit like Clitoris Basic.



#38 baktra OFFLINE  

baktra

    Dragonstomper

  • 596 posts
  • Location:Czech republic

Posted Sat Jul 1, 2017 8:23 AM

iBasic ?
 
Citus Basic - dunno, sounds a bit like Clitoris Basic.


iBasic - Is your budget big enough to beat a squadron of lawyers hired by Apple?

#39 Rybags OFFLINE  

Rybags

    Gridrunner

  • 15,990 posts
  • Location:Australia

Posted Sat Jul 1, 2017 9:26 AM

Screw 'em.  They don't have exclusive use of that letter as a prefix.  And the use of lower case e and i prefixes was a stupid fad that should have died with the dot-com boom/crash of the 90s.



#40 Bryan OFFLINE  

Bryan

    Quadrunner

  • 10,926 posts
  • Cruise Elroy = 4DB7
  • Location:Chesaning, MI

Posted Sat Jul 1, 2017 12:02 PM

iBasic ?

 

Citus Basic - dunno, sounds a bit like Clitoris Basic.

 

Clitoris Basic is really good if you can find it.



#41 devwebcl OFFLINE  

devwebcl

    Stargunner

  • 1,237 posts
  • Location:Chile

Posted Sat Jul 1, 2017 12:36 PM

Veloz Basic



#42 miker OFFLINE  

miker

    Stargunner

  • 1,895 posts
  • Stay Atari!
  • Location:Warsaw, Poland

Posted Sat Jul 1, 2017 1:00 PM

Maybe dBASIC (first letter of its author's nickname and inspired by neme of dBASE)? :)



#43 kenjennings OFFLINE  

kenjennings

    Dragonstomper

  • 789 posts
  • Me + sio2pc-usb + 70 old floppies
  • Location:Florida, USA

Posted Mon Jul 3, 2017 6:12 PM

i'd love to code one minimalistic basic interpreter and call it "Basic BASIC"

 

Duran Duran would have loved it.    :-)



#44 Rybags OFFLINE  

Rybags

    Gridrunner

  • 15,990 posts
  • Location:Australia

Posted Mon Jul 3, 2017 8:30 PM

dBasic is actually a Basic programming language product on the ST.  It was free to distribute but you had to buy the manual off them.

 

It doesn't seem to have made it to emulation as it uses a custom disk format with 9 x 1K sectors per track.



#45 ggn OFFLINE  

ggn

    Stargunner

  • 1,452 posts
  • Location:Athens, Greece

Posted Mon Jul 3, 2017 11:48 PM

dBasic is actually a Basic programming language product on the ST.  It was free to distribute but you had to buy the manual off them.
 
It doesn't seem to have made it to emulation as it uses a custom disk format with 9 x 1K sectors per track.


According to the author it wasn't exactly free...

(and btw yes I do intend to create this custom format at some point and then image it for emulators)

#46 Rybags OFFLINE  

Rybags

    Gridrunner

  • 15,990 posts
  • Location:Australia

Posted Tue Jul 4, 2017 12:10 AM

IMO it would have been a better product if it used the standard disk format and supported OS functions as well as having the command-line mode.

 

I wrote various programs using it and also found the assembler useful (as it was all I had).

I did my 1050 floppy emulator and also created a debugger for 6502 with 80x50 font which allowed me to transfer over large memory dumps to work on.  The aim was to try and crack AR:  Dungeon which I didn't do but was able to get a couple of stages worth through the encryption.

 

I don't have any of the disks remaining - gave them away when I sold the original 1040ST that I'd bought in the day.



#47 dmsc OFFLINE  

dmsc

    Moonsweeper

  • Topic Starter
  • 473 posts
  • Location:Viņa del Mar, Chile

Posted Tue Jul 4, 2017 10:54 PM

Hi!,

Another update of the interpreter, this time:

- Adds "ELIF" (else-if) statement, simplifies multiple choice:
IF a = 1
  ? "A is one"
ELIF a = 2
  ? "A is two"
ELIF a = 3
  ? "A is three"
ELSE
  ? "A is some other number"
ENDIF
- Adds "EXIT" from "PROC", this forces the return.
PROC Test
  IF x < 1
    Exit
  ENDIF
  x = 1234 / x
  ? "X = "; x
ENDPROC
- The interpreter is now a little smaller and faster thanks to parsing constants from 0 to 255 specially.

- The code is a little smaller now, at 6154 bytes.

Attached Files


Edited by dmsc, Tue Jul 4, 2017 10:54 PM.


#48 pirx OFFLINE  

pirx

    Moonsweeper

  • 447 posts
  • Location:Poland

Posted Wed Jul 5, 2017 5:51 AM

is saving parsed programs for quick execution possible?

 

would it be possible to make fb.com accept command line? would be much nicer than menu.



#49 vitoco OFFLINE  

vitoco

    Moonsweeper

  • 320 posts

Posted Sun Jul 9, 2017 2:57 PM

I find very interesting that this version of BASIC has both the parser and the interpreter in the same module, As it has no editor, it just works like a compiler and a runtime... Hey, wait!!!! Why couldn't them be separated modules? A compiler/tokenizer and a linker/runtime. That could give extra RAM memory to the user program.   :grin:

 

Seriously, I was impressed to see that the parser was written for the 6502 processor and not for a current platform like DMSC's TBXL-Parser.

 



#50 Kyle22 OFFLINE  

Kyle22

    River Patroller

  • 3,817 posts
  • Call my BBS! telnet://broadway1.lorexddns.net
  • Location:McKees Rocks (Pittsburgh), PA

Posted Sun Jul 9, 2017 3:40 PM

Any chance of a version that has been tweaked to take advantage of the 802/816?





Also tagged with one or more of these keywords: basic, compiler, interpreter

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users