pixelmischief Posted May 17, 2020 Share Posted May 17, 2020 My understanding is that FastBASIC can be compiled and linked. How does the speed of the resultant executable compare to one generated from assembly code? Quote Link to comment Share on other sites More sharing options...
zbyti Posted May 17, 2020 Share Posted May 17, 2020 (edited) MADS 2.1.0 (opt) SIEVE: 440 ticks in 10 iterations CC65 2.1.8 (opt) SIEVE: 602 ticks in 10 iterations Mad Pascal 1.6.4 (opt) SIEVE: 609 ticks in 10 iterations Millfork 0.3.14 (opt) SIEVE: 701 ticks in 10 iterations Action! 3.6 (opt) SIEVE: 746 ticks in 10 iterations FastBasic 4.0 FBI SIEVE: 6312 ticks in 10 iterations sieve.pas F0SIEVE.ACT Edited May 17, 2020 by zbyti Action! 3.6 result Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted May 17, 2020 Author Share Posted May 17, 2020 @zbyti Thanks for the reply! "FBI" stands for FastBASIC Interpreter, right? Does this mean that the code was run through the interpreter for these benchmarks? I'm looking for the exact same thing, but for an executable created by the FastBASIC compiler/linker. Quote Link to comment Share on other sites More sharing options...
dmsc Posted May 17, 2020 Share Posted May 17, 2020 Hi! 1 hour ago, pixelmischief said: My understanding is that FastBASIC can be compiled and linked. How does the speed of the resultant executable compare to one generated from assembly code? The FastBasic code is always interpreted (currently). The compiler writes optimized bytecodes that link to the runtime - the interpreter and the libraries. There is an experimental compiler to 6502 code, but I have not update it much. The limitation of the is that it does not run in the Atari, only in a PC. Have Fun! 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted May 17, 2020 Share Posted May 17, 2020 @pixelmischief nope, it's integer version. Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted May 17, 2020 Author Share Posted May 17, 2020 (edited) 10 minutes ago, dmsc said: There is an experimental compiler to 6502 code, but I have not update it much. The limitation of the is that it does not run in the Atari, only in a PC. OK. So, if I cross-compile my FastBASIC code on the PC, how will the resultant Atari executable perform against assembly code for similar workloads? Let me give some motive here. I am diving hard into BASIC as a gateway to learning assembler. I am worried, however, that FastBASIC might be so good that the challenge of learning assembler won't be worth the improvement in performance. I developed this fear when I saw a YouTube video that showed FastBASIC run a workload in 14 seconds that took compiled TurboXL twice as long and Atari BASIC Rev C ten times as long. Is this something I need to be worried about? Edited May 17, 2020 by pixelmischief Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted May 17, 2020 Author Share Posted May 17, 2020 9 minutes ago, zbyti said: @pixelmischief nope, it's integer version. Oh yeah! Derp. Quote Link to comment Share on other sites More sharing options...
dmsc Posted May 17, 2020 Share Posted May 17, 2020 Hi! 36 minutes ago, pixelmischief said: OK. So, if I cross-compile my FastBASIC code on the PC, how will the resultant Atari executable perform against assembly code for similar workloads? Let me give some motive here. I am diving hard into BASIC as a gateway to learning assembler. I am worried, however, that FastBASIC might be so good that the challenge of learning assembler won't be worth the improvement in performance. I developed this fear when I saw a YouTube video that showed FastBASIC run a workload in 14 seconds that took compiled TurboXL twice as long and Atari BASIC Rev C ten times as long. Is this something I need to be worried about? No worries... FastBasic is still an order of magnitude slower than assembler . As I said before, I'm writing a new compiler for FastBasic that would produce 6502 assembly code, but that still will be slower than hand-written assembly, so programming in 6502 assembly would always be an useful skill. Have Fun! 2 1 Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted May 17, 2020 Author Share Posted May 17, 2020 (edited) 9 minutes ago, dmsc said: FastBasic is still an order of magnitude slower than assembler . I'm writing a new compiler for FastBasic that would produce 6502 assembly code, but that still will be slower than hand-written assembly. Thank you very much for settling that. And thank you, thank you, THANK YOU for your excellent BASIC variant. It's so good, I feel like I'm cheating. By the way, if you fancy an interesting side challenge, a language plugin for Notepad++ would be super cool. Edited May 17, 2020 by pixelmischief 1 Quote Link to comment Share on other sites More sharing options...
dmsc Posted May 17, 2020 Share Posted May 17, 2020 Hi! 38 minutes ago, pixelmischief said: Thank you very much for settling that. And thank you, thank you, THANK YOU for your excellent BASIC variant. It's so good, I feel like I'm cheating. By the way, if you fancy an interesting side challenge, a language plugin for Notepad++ would be super cool. Thanks for your kind words! But regarding Notepad++, I will leave that to others, as I'm a Linux user so don't need that Have Fun! Quote Link to comment Share on other sites More sharing options...
+MrFish Posted May 17, 2020 Share Posted May 17, 2020 11 minutes ago, dmsc said: But regarding Notepad++, I will leave that to others, as I'm a Linux user so don't need that Do you have a list of keywords, operators, etc.? Quote Link to comment Share on other sites More sharing options...
dmsc Posted May 17, 2020 Share Posted May 17, 2020 Hi! 39 minutes ago, MrFish said: Do you have a list of keywords, operators, etc.? Attached is a list of all operators and statements, with maximal abbreviations, directly copied from the parser sources. Have Fun! kw.txt 3 1 Quote Link to comment Share on other sites More sharing options...
+MrFish Posted May 17, 2020 Share Posted May 17, 2020 8 minutes ago, dmsc said: Attached is a list of all operators and statements, with maximal abbreviations, directly copied from the parser sources. kw.txt 2.7 kB · 2 downloads Great, thanks. I'll see what I can whip up in Notepad++ using it. Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted May 17, 2020 Author Share Posted May 17, 2020 (edited) Ran into a challenge. Up until now, I have been using Altirra, an OSS BASIC XE cart image, and a host filesystem mount presented as device H1:/H6:. My workflow cycle has been: 1. Edit the .BAS file in plain text using Notepad++ on the host side (Windows 10 Pro) 2. Load the .BAS file into memory on the emulated Atari with "ENTER"H6:MYFILE.BAS" 3. RUN and debug the code. 4. Return to 1. I can't continue this way with FastBASIC because there is no interactive mode and the loader seems to require a tokenized .BAS file, like something used by the "LOAD/SAVE" commands; instead of the "ENTER/LIST" commands. Is there a way that I can load a plain text BASIC listing into FastBASIC so that I may continue to use an editor on the host (Notepad++)? Edited May 17, 2020 by pixelmischief Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted May 17, 2020 Author Share Posted May 17, 2020 Please ignore. Altirra presents mounted host paths as both H1: and H6:. Loading the file from H6: works fine. I think perhaps the difference between the two is that files loaded from H1: are loaded in binary form and, therefore, do not get the benefit of an ASCII<->ATASCII conversion. Files loaded from H6:, however, appear to enjoy such a conversion automatically. Quote Link to comment Share on other sites More sharing options...
Preppie Posted May 17, 2020 Share Posted May 17, 2020 I have notepad++ setup with the FastBasic cross compiler. I edit in notepad and when I want to run the code I press F7 and it automaticaly opens altira and runs the code. I'll have a look tomorrow to sort out how to set it up if you want, but it's bedtime now Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted May 17, 2020 Author Share Posted May 17, 2020 2 minutes ago, Preppie said: I'll have a look tomorrow to sort out how to set it up if you want, but it's bedtime now Sleep well. Looking forward to your help tomorrow! Quote Link to comment Share on other sites More sharing options...
Preppie Posted May 18, 2020 Share Posted May 18, 2020 (edited) Here's how I setup my PC to use notepad++ to code with FastBasic cross compiler (which requires CC65). Download the following files: CC65: https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip/download TURBAN (attachment fur TURBAN under windows 10): https://atariwiki.org/wiki/Wiki.jsp?page=TURBAN#section-TURBAN-TutorialForWindows10 FastBasic cross compiler (fastbasic-v4.3-win32.zip): https://github.com/dmsc/fastbasic/releases/tag/v4.3 Unpack CC65 and put it on your C drive Unpack FastBasic and put the folder in the CC65 folder Unpack TURBAN and copy the files from the folder to your FastBasic folder find the fb-int.bat file in your FB folder right click and edit it, place the follow line after line 46 and save it: %xexfile% so it should now look like this: %cc65%cl65 -tatari -C %fbpath%fastbasic.cfg -g %asmfile% %extra% -o %xexfile% -Ln %lblfile% %fbpath%%fb%.lib || exit /b %errorlevel% %xexfile% exit /b Now, open one of the example .tur files in the Fastbasic/testproject folder and when you press F6 or F7 a popup will open and after confirmation notepad will open Altirra load up turbbasic and run the file. If you want to run with FastBasic then change turban.bat in the popup to fb-int.bat Notepad will now create a xex file with FastBasic and auto run it using altirra when you press F6/F7, to change it back to use TurboBasic you need to alter the popup to read turban.bat again. Edited May 18, 2020 by Preppie 1 Quote Link to comment Share on other sites More sharing options...
+Philsan Posted May 18, 2020 Share Posted May 18, 2020 MadStudio supports FastBasic editing and compiling/running too. 1 Quote Link to comment Share on other sites More sharing options...
Preppie Posted May 18, 2020 Share Posted May 18, 2020 27 minutes ago, Philsan said: MadStudio supports FastBasic editing and compiling/running too. Oh, thought that was just Pascal, I'll have to check it out. Quote Link to comment Share on other sites More sharing options...
+Philsan Posted May 18, 2020 Share Posted May 18, 2020 7 hours ago, Preppie said: Here's how I setup my PC to use notepad++ to code with FastBasic cross compiler (which requires CC65). Download the following files: CC65: https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip/download TURBAN (attachment fur TURBAN under windows 10): https://atariwiki.org/wiki/Wiki.jsp?page=TURBAN#section-TURBAN-TutorialForWindows10 FastBasic cross compiler (fastbasic-v4.3-win32.zip): https://github.com/dmsc/fastbasic/releases/tag/v4.3 Unpack CC65 and put it on your C drive Unpack FastBasic and put the folder in the CC65 folder Unpack TURBAN and copy the files from the folder to your FastBasic folder find the fb-int.bat file in your FB folder right click and edit it, place the follow line after line 46 and save it: %xexfile% so it should now look like this: %cc65%cl65 -tatari -C %fbpath%fastbasic.cfg -g %asmfile% %extra% -o %xexfile% -Ln %lblfile% %fbpath%%fb%.lib || exit /b %errorlevel% %xexfile% exit /b Now, open one of the example .tur files in the Fastbasic/testproject folder and when you press F6 or F7 a popup will open and after confirmation notepad will open Altirra load up turbbasic and run the file. If you want to run with FastBasic then change turban.bat in the popup to fb-int.bat Notepad will now create a xex file with FastBasic and auto run it using altirra when you press F6/F7, to change it back to use TurboBasic you need to alter the popup to read turban.bat again. If I press F7 on my Notepad++ (installed in C/Programs) nothing happens. I have to use the old version of N++ inside Turban.w10 folder. What should I do to let work my N++? Quote Link to comment Share on other sites More sharing options...
Preppie Posted May 18, 2020 Share Posted May 18, 2020 2 hours ago, Philsan said: If I press F7 on my Notepad++ (installed in C/Programs) nothing happens. I have to use the old version of N++ inside Turban.w10 folder. What should I do to let work my N++? Sorry, I can't help you there - I just use the notepad in Turban. Quote Link to comment Share on other sites More sharing options...
pixelmischief Posted June 6, 2020 Author Share Posted June 6, 2020 (edited) Before I start looking for other solutions, I just want to confirm that FastBASIC does not have an exponent operator; something like 2^3 meaning 2 to the third? I've looked at the docs and tried the prototype I gave as an example. If not, is a bit shift in assembler the best way to go? NEVERMIND: The floating-point interpreter supports it. Edited June 6, 2020 by pixelmischief Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted June 6, 2020 Share Posted June 6, 2020 (edited) If you were just wanting whole number powers (and the powers aren't too large in value) then a small function should suffice, something like: powResult = 0 ... powX = 2 : powY = 3 : exec Pow ... proc Pow powResult = 1 if powY < 1 then exit powResult = powX while powY > 1 powResult = powResult * powX powY = powY - 1 wend endproc Edited June 6, 2020 by Wrathchild Quote Link to comment Share on other sites More sharing options...
dmsc Posted June 7, 2020 Share Posted June 7, 2020 Hi! 2 hours ago, pixelmischief said: Before I start looking for other solutions, I just want to confirm that FastBASIC does not have an exponent operator; something like 2^3 meaning 2 to the third? I've looked at the docs and tried the prototype I gave as an example. If not, is a bit shift in assembler the best way to go? NEVERMIND: The floating-point interpreter supports it. Yes, the "power" operator is floating-point only, and always returns a floating point number. If you need the binary equivalent, it is smaller and faster to use a table: DATA pow2() byte = 1, 2, 4, 8, 16, 32, 64, 128 ? 3, pow2(3) ? 0, pow2(0) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.