Author Topic: What BASIC do you mainly use?  (Read 23628 times)

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: What BASIC do you mainly use?
« Reply #30 on: June 15, 2016, 05:38:11 PM »
I use mainly FreeBASIC and MY-BASIC  ;)
At the moment I am in a coding free stage, since - once again - I lost motivation to program. But that's another topic...

darkhog

  • Guest
Re: What BASIC do you mainly use?
« Reply #31 on: June 26, 2016, 07:13:14 PM »
I know it's not a real BASIC, but it's so similar in syntax that it might just as well be. I'm using NaaLaa which seems to be alive yet again as Marcus returned and is now in charge.

I wish it be opensource tho so in case of him suddenly disappearing someone else can continue it (not to mention a possibility for ports).

Richly

  • Guest
Re: What BASIC do you mainly use?
« Reply #32 on: June 28, 2016, 10:35:01 PM »
I'm still using my favourite BASICs but I've recently gone back to learning C after taking a break; simply because of the vast quantity of resources / books / tutorials / help that is out there for someone who is trying to learn C on their own.

Tomaaz

  • Guest
Re: What BASIC do you mainly use?
« Reply #33 on: August 03, 2016, 09:30:09 PM »
Pike at the moment. It's a shame it's not popular at all. :( I've also tried standalone JavaScript interpreters, but I'm not sure about that. Wait... These are not BASICs. Sorry...

Mike Lobanovsky

  • Guest
Re: What BASIC do you mainly use?
« Reply #34 on: August 11, 2016, 11:36:52 PM »
Like it or not, but a trifling five days after I'd registered on this forum, my application was finally approved of. So hi everybody! :)

Ah, FBSL... ...but is it BASIC?  ;)

(quickly heads for the exit...)

Frankly, I don't see any reason for the mockery. Or was that rather meant as teasing? FBSL hosts three fully independent but interoperative languages -- BASIC, ANSI C, and Intel-style assembly. FBSL's BASIC is an interpreter while its C and Asm are JIT compilers.

FBSL's BASIC supports the advanced vocab and syntax of the industry leaders and is almost indistinguishable from them in this respect. For example, here's Ed's fabulous Integer Benchmark written in a few dialects I practice:
Code: [Select]
' ================
' Visual Basic 6.0
' ================
Rem GUI only
Declare Function GetTickCount Lib "kernel32.dll" () As Long
Sub Main()
    Dim n As Long, lim As Long
    Dim k As Long, p As Long
    Dim pc As Long, gtc As Long
   
    pc = 0: n = 1: lim = 5000000: gtc = GetTickCount()
    While n < lim
        k = 3: p = 1: n = n + 2
        While k * k <= n And p
            p = (n \ k) * k <> n ' precedence!
            k = k + 2
        Wend
        If p Then pc = pc + 1
    Wend
    MsgBox pc & " " & (GetTickCount() - gtc) / 1000 & " sec VISUALBASIC6"
End Sub


' =============================
' PowerBASIC for Windows v10.04
' =============================
Rem GUI only
Declare Function GetTickCount Import "kernel32.dll" Alias "GetTickCount"() As Long
Function PBMain() As Long
  Dim n As Long, lim As Long
  Dim k As Long, p As Long
  Dim pc As Long, gtc As Long
 
  pc = 0: n = 1: lim = 5000000: gtc = GetTickCount()
  While n < lim
    k = 3: p = 1: n += 2
    While k * k <= n And p
      p = (n \ k) * k <> n ' precedence!
      k += 2
    Wend
    If p Then pc += 1
  Wend
  MsgBox Str$(pc) & " " & Str$((GetTickCount() - gtc) / 1000) & " sec POWERBASIC"
  Function = 0
End Function


' =================
' FreeBASIC v0.90.1
' =================
Rem CUI only
Dim n As Long = 1
Dim lim As Long = 5000000
Dim k As Long, p As Long
Dim pc As Long, gtc As Double = Timer

While n < lim
    k = 3: p = 1: n += 2
    While k * k <= n And p
        p = (n \ k) * k <> n ' precedence!
        k += 2
    Wend
    If p Then pc += 1
Wend
Print Using "###### #.### sec FREEBASIC"; pc, Timer - gtc
GetKey ' optional in Shell console, mandatory in own console


' ============
' Oxygen Basic
' ============
Rem GUI or CUI
Include "Console.inc" ' if CUI, "MinWin.inc" if GUI
Declare Function GetTickCount Lib "kernel32.dll" () As Long
Dim k, p, pc As Long ' all are Longs
Long n = 1, lim = 5000000 ' alternative notation
Long gtc = GetTickCount ' ditto, parentheses may be omitted if no args

While (n < lim)
    k = 3: p = 1: n += 2
    While (k * k <= n And p)
        p = n / k * k <> n ' left-to-right precedence
        k += 2
    Wend
    If p Then pc += 1
Wend
Print Str(pc) " " Str((GetTickCount - gtc) / 1000) " sec OXYGEN"
WaitKey ' optional in Shell console, mandatory in own console, to be rem'ed in GUI


' =================
' thinBasic v1.9.12
' =================
Rem Windowed CUI only
Uses "Console"
Dim k As Long, p As Long, pc As Long
Dim n As Long = 1, lim As Long = 5000000
Dim gtc As Long = GetTickCount ' GetTickCount is a keyword

While n < lim
    k = 3: p = 1: n += 2
    While k * k <= n And p
        p = n \ k * k <> n ' left-to-right precedence
        k = k + 2
    Wend
    If p Then pc += 1
Wend
PrintL TStr$(pc) & " " & TStr$((GetTickCount - gtc) / 1000) & " sec THINBASIC"
WaitKey

and here's the same written in the three languages that FBSL supports:
Code: [Select]
' ====================================
' Freestyle BASIC Script Language v3.5
' ====================================
Rem CUI only
#AppType Console

Sub Main() ' no kernel32.dll, user32.dll, gdi32.dll API declarations needed
  Dim gtc As Long = GetTickCount() ' for lulz: forced strong typing, otherwise by assignment (i.e. Long either way)
  Print PrimeA() & " " & (GetTickCount() - gtc) / 1000 & " sec FBSL Assembler"

  gtc = GetTickCount()
  Print PrimeB() & " " & (GetTickCount() - gtc) / 1000 & " sec FBSL BASIC"

  gtc = GetTickCount()
  Print PrimeC() & " " & (GetTickCount() - gtc) / 1000 & " sec FBSL C"

  Pause ' optional in Shell console, mandatory in own console
End Sub

DynAsm PrimeA() As Long ' Intel-style assembly function block
  #Define FALSE 0 ; MASM32 EQUs and ASSUMEs are effectively PP macros, so why not use existing PP?
  #Define TRUE 1
  #Define pc DWORD PTR [ebp - 4] ; pointer to local long int
  #Define lim ebx
  #Define n ecx
  #Define k esi
  #Define p edi
 
  enter 4, 0 ; adjust new func stack frame w/ four bytes reserved for one local long int
  push ebx ; save non-volatile register states
  push esi
  push edi
 
  mov pc, 0
  mov n, 1
  mov lim, 5000000
 
  .While n < lim ; MASM32-style pseudo HLL
    mov k, 3
    mov p, 1
    add n, 2
   
    .While p ; or .While p = TRUE, or .While p <> FALSE
      mov eax, k
      mul k
      .If eax > n .Then
        .Break ; exit inner .While
      .EndIf
     
      mov eax, n
      xor edx, edx
      div k
      mul k
      mov p, FALSE
      .If eax <> n .Then
        mov p, TRUE
      .EndIf
      add k, 2
    .Wend
   
    .If p .Then ; or .If p = TRUE, or .If p <> FALSE
      add pc, 1
    .EndIf
  .Wend
 
  mov eax, pc ; return pc value to BASIC caller
 
  pop edi ; restore initial register and stack states
  pop esi
  pop ebx
  leave
 
  ret
End DynAsm

Function PrimeB() As Long ' classic BASIC-2016 function block
  Dim pc = 0, n = 1, lim = 5000000 ' all are Longs by assignment
  Dim k, p As Variant ' for lulz again: actually, both are Variants (typeless means Variant as in VB6 or TB)
 
  While n < lim
    k = 3: p = 1: n = n + 2
    While k * k <= n And p
      p = (n \ k) * k <> n ' precedence!
      k = k + 2
    Wend
    If p Then pc = pc + 1
  Wend
  Return pc ' return pc value to BASIC caller
End Function

DynC PrimeC() As Long ' ANSI C function block
  int main() { // main entry point; more C language utility funcs possible in here
    int pc = 0, n = 1, lim = 5000000; // initialized locals
    int k, p; // uninitialized locals
   
    while (n < lim) {
      k = 3; p = 1; n += 2;
      while (k * k <= n && p) {
        p = n / k * k != n; // left-to-right precedence
        k += 2;
      }
      if (p) pc++;
    }
    return pc; // return pc value to BASIC caller
  }
End DynC

All code is copy-paste ready for those who might be interested.

So what's wrong with FBSL BASIC, may I ask? ;)

FBSL BASIC can produce CUI and GUI applications of any complexity that the other BASIC dialects can in the year of 2016, and it can also be extremely fast thanks to its other two companions in the FBSL common environment. For example, the HQ 3D model viewer/renderer seen in the snapshot below uses BASIC for its skinned GUI, C for its model loader and parser, and assembly and GLSL for its texture handlers and render routines.

(Model by courtesy of Patrice Terrier of PowerBASIC. More models can be seen at, and obtained from, his site.)

jbk

  • Guest
Re: What BASIC do you mainly use?
« Reply #35 on: August 12, 2016, 09:04:38 AM »
Hi Mike
I installed FBSL some time ago but could never get it to work, eventually I removed it when cleaning my HD
is there a latest distribution that I could try?

Richly

  • Guest
Re: What BASIC do you mainly use?
« Reply #36 on: August 12, 2016, 09:45:59 AM »
Frankly, I don't see any reason for the mockery. Or was that rather meant as teasing? FBSL hosts three fully independent but interoperative languages -- BASIC, ANSI C, and Intel-style assembly. FBSL's BASIC is an interpreter while its C and Asm are JIT compilers.

Firstly, welcome Mike  :)

Mockery? Certainly not...well, just a little gentle leg pulling perhaps, but nothing more. Please accept my apologies if I offended you.  :)

But it was a genuine question too. I wanted to know whether or not FBSL was BASIC.

Your reply here illustrates that, in fact, FBSL is three languages - BASIC, C and Assembler.

So, you can use all three languages interchangeably in one program if you wish; just like you can use Assembler within a BB4W program in order to optimise the code...although FBSL also offers the additional option of using C?

Interesting, especially as I am learning C.

Hi Mike
I installed FBSL some time ago but could never get it to work, eventually I removed it when cleaning my HD
is there a latest distribution that I could try?

Yes, I had trouble in the past locating a viable download.

Is FBSL still being actively developed? Is the documentation up-to-date and suitable for those of us who are not yet coding Jedi Masters?  :)
 

Richly

  • Guest
Re: What BASIC do you mainly use?
« Reply #37 on: August 12, 2016, 09:53:44 AM »
By the way, a related question that perhaps you or John could be kind enough to answer - please excuse my ignorance.

How does FBSL's ability to use different languages within the same program differ from ScriptBasic's extension module's or libraries in other BASICs?

Is it that libraries, etc. have to be 'called'?


Aurel

  • Guest
Re: What BASIC do you mainly use?
« Reply #38 on: August 12, 2016, 10:04:27 AM »
FBSL is one modern basic-like language and is very good .
I really recommend to anyone who whish to learn good win api programming
( it is from my point of view far better than thinBasic)
also i recommend Creative Basic and of course Oxygen Basic
and dont forget to try TOY  ;D

Richly

  • Guest
Re: What BASIC do you mainly use?
« Reply #39 on: August 12, 2016, 11:21:46 AM »
Just found this on the BB4W forum too about using C with BBC BASIC for Windows as an alternative to ASM

Quote
One idea that could save you a great deal of time, energy and potentially stress (!), is to write speed-critical code in C (or C++), compile it as a DLL and load it into your BB4W as a library...

Aurel

  • Guest
Re: What BASIC do you mainly use?
« Reply #40 on: August 12, 2016, 11:32:59 AM »
Look richey
i think that you have wrong approach to learn programming
you simetimes lern C sometimes etc..etc
man use first one thing and learn it thenyou will be on horse

Richly

  • Guest
Re: What BASIC do you mainly use?
« Reply #41 on: August 12, 2016, 12:00:52 PM »
Look richey
i think that you have wrong approach to learn programming
you simetimes lern C sometimes etc..etc
man use first one thing and learn it thenyou will be on horse

Yeah, you could be right...I have flitted around a bit but I'm trying to stick to just C at the moment...

Mike Lobanovsky

  • Guest
Re: What BASIC do you mainly use?
« Reply #42 on: August 12, 2016, 01:30:15 PM »
Thanks for the welcome, Richey,

No apologies needed (though of course appreciated and accepted :) ). And yes, your vision of FBSL is now correct. Quite a few modern BASIC dialects (not only BB4W but also PowerBASIC or OxygenBasic and some others) offer some degree of "inline assembly" to optimize their time critical routines for speed, just like VC or GCC compilers do. FBSL extends this feature even further giving you the ability to also use raw ANSI C code for the same purpose just in case you find assembly a little difficult to master. Or you can even write your applications entirely in assembly or C (the respective code blocks can contain an unlimited number of own procedures written in the respective language and can independently call external libraries too), where the only BASIC wrapper would be a call to the main DynAsm or DynC block to mark the program entry point.

Unlike FreeBASIC, or BCX, or UBX, or MasmBasic and some others that are essentially BASIC-to-C or BASIC-to-Asm translators, FBSL is completely standalone/independent/self-sufficient and doesn't depend on third-party static compilers to generate executable code. All C and assembly blocks are dynamically compiled to machine code directly in memory at application launch time. JIT compilation occurs so fast that you can enjoy your interaction with your C and assembly sources in real time just as much as you would while working with BASIC alone.

Typically, FBSL's C and assembly code would execute 100+ times faster than true interpretative BASIC that's also pretty fast these days.

Hi Mike
I installed FBSL some time ago but could never get it to work, eventually I removed it when cleaning my HD
is there a latest distribution that I could try?
Yes, I had trouble in the past locating a viable download.

For those of you who aren't yet familiar with FBSL, I'd recommend starting with an earlier version 3.4.10 that has a complete installer downloadable from Gerome GUILLEMIN's signature throughout the FBSL forum. It's a little outdated but still fully functional and sufficiently documented. It also has the Beginner's Guides written in English and French. Note that v3.4.10 didn't support the ANSI C jitter yet.

The most up-to-date FBSL v3.5 RC2 doesn't have an own full installer and its files must be overwritten on top of the existing v3.4.10 installation. Version 3.5 includes the ANSI C jitter and comes with full new documentation except for the main FBSL help file (it however contains a PDF with the description of new features and alterations to the BASIC v3.5 syntax). Version 3.5 introduces slight differences to FBSL BASIC and your existing FBSL samples won't work in it any more but the PDF describes how the older v3.4.10 can be converted to valid v3.5 code -- the changes aren't too laborious, after all. Version 3.5 is much more robust and versatile than any previous version of FBSL.

You can download the FBSL v3.5 RC2 archive from the attachments to this topic on the FBSL forum and install it on top of v3.4.10 as described therein.

FBSL v3.5 is currently still a WIP because I'm developing it at my leasure time only due to the dramatic decline of general interest in BASIC as a programming language. I do have an RC3 though, which can be obtained on special request by those who are interested. It fixes some bugs in the previous publicly available RC2 version. :)

Mike Lobanovsky

  • Guest
Re: What BASIC do you mainly use?
« Reply #43 on: August 12, 2016, 01:57:23 PM »
How does FBSL's ability to use different languages within the same program differ from ScriptBasic's extension module's or libraries in other BASICs?

The ScriptBASIC extension modules describe an interface that must be included in your source script to be able to call a specific precompiled 3rd party dynamicaly linked library (a .DLL in the MS Windows environment, or an .SO "shared object" under Linux).

FBSL doesn't need any special interface to call the functions in any 3rd party DLL. The universal call engine is prebuilt in it and you don't even have to bother if that DLL uses an STDCALL or CDECL calling convention. The calls are coded as if the DLL functions were part of FBSL's own vocabulary. The functions of Kernel32.dll, User32.dll, and Gdi32.dll (plus Msvcrt.dll in the DynC jitter) are preloaded at app launch time, so you don't even need to mention those DLLs in your code at all. But why not if the Fbsl.exe binary is initially linked to them at compile time, in the first place? :)

What you often call a "library" in the other BASIC dialects would effectively be an include file with a set of reusable procedures written in those dialects. Of course both ScriptBASIC and FBSL can use those too, with FBSL being able to have those procedures written not only in BASIC but also directly in C and/or assembly syntaxes thus being on a par, speed-wise, with the 3rd party DLLs originally built in the environments of respective static compilers like VC, or GCC, or MASM32, or GAS, whatever. :)

jbk

  • Guest
Re: What BASIC do you mainly use?
« Reply #44 on: August 12, 2016, 02:19:41 PM »
just tried to install on Windows 10 but Windows defender flag it as malware :(