All BASIC

BASIC Developer & Support Resources => Interpreters => Topic started by: SteveA on October 14, 2011, 09:26:48 AM

Title: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 14, 2011, 09:26:48 AM
Hey guys,
I'm not entirely new to this forum, but I will re-introduce myself and my project:
I'm Steve and beginning in 2000 I started work on Blunt Axe Basic (Bxb or Bxbasic).
Here is a link to an interview I gave regarding Bxbasic:
http://imortisoft.no-ip.org/b2b/?Issue_%234 (http://imortisoft.no-ip.org/b2b/?Issue_%234)

Bxb is currently an ongoing project and is always being added to.
As stated in the interview, Bxb started as a learning tool that morphed into a 16 chapter compiler design tutorial, complete with source code.
http://sites.google.com/site/bluntaxebasic/tutor/ (http://sites.google.com/site/bluntaxebasic/tutor/)
At the point where the tutorial finishes, Bxb is developed into a QuickBasic'ish (subset) interpreter and byte-code compiler.

At this date, Bxb has many advanced math functions included and also has API/GUI capabilities.
The portion of the API that is now intrinsic to Bxb is a portion of the GDI.
However, Bxb is not limited to only those portions of the API which are intrinsic (built-in).
Bxb has fully incorporated "Dyncall" as an intrinsic component.
Dyncall, (by Daniel Adler and Tassilo Philipp) is a tool designed specifically with interpreters and scripting engines in mind so that they can dynamically access the full API and OEM DLLs.

Besides Bxbasic (the interpreter) there is also Bxbasm, which is an actual Basic compiler, that takes Bxbasic scripts and compiles to actual binaries. Bxbasm is not a byte-code compiler. It is written in C and built around Masm. It takes a script and converts it into Intel x86 Assembly Language, which is then assembled by the Masm assembler and linked directly into an executable.
I have not worked on Bxbasm in several years and despite the fact that it has a lengthy list of commands available, it is still in an early state of development.
I like Masm and the Intel syntax, that is why I chose to use that particular assembler. I have, however, gotten quite a bit of flack from the open-source community about using it. At this time I am about to embark on a project that my bring some life back to Bxbasm. I have not made a final decision of whether to continue using Masm, even though Microsoft has made it readily available for download.

Steve
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: jcfuller on October 14, 2011, 10:15:26 AM
Steve,
  Re Bxbasm: Use JWAsm. Fully masm compatible and there is also a Linux version.
http://www.japheth.de/JWasm.html

James
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 14, 2011, 10:58:12 AM
Steve,
  Re Bxbasm: Use JWAsm. Fully masm compatible and there is also a Linux version.
http://www.japheth.de/JWasm.html

James

Hey James,
Yes..., I just downloaded the latest version of JWasm and I'm about to begin testing it.
Expect me to "bend you ear" in the near future, as I'm sure to have some questions about it.
I am disappointed that JWasm's user/support forum is on sourceforge, tho.

I have been a member of sourceforge for over ten years now and have grown to hate it.
It's slow, cumbersome to use and ugly.
That's why I have refused to take Bxbasic to sourceforge.

I wish japheth (aka Andreas Grech) would setup a different forum for his user base.
I think JWasm could benefit by it.

Steve



Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 15, 2011, 03:05:15 PM
@ J.C.Fuller,

Hey James,
just wondering, how are you setting up JWasm ?
Are you using it in the MASM32\bin\ folders ?
Or, are you setting it up in it's own folder structure ?
If the latter is the case..., what are you putting where, (assuming: \jwasm\...) ?

TIA
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: jcfuller on October 15, 2011, 04:46:41 PM
Steve,
  I am using RadAsm3 with JWAsm in it's own directory but using Masm32 libs/incs ...etc

This is fine for just playing around as I am doing but you have to watch out. Steve is very protective of the Masm32 package. I am not sure of the license of BxAsm but it may very well violate Steve's edicts of not allowing anything from the Masm32 package to be used for a GPL project.
I got a separate ok from Raymond on using his floating point library.
 
James

Title: Re: Bxbasic (Blunt Axe Basic)
Post by: John on October 15, 2011, 05:59:13 PM
You guys lost me. I thought Steve was looking for a good assembler to generate executables from his BxBasic to ASM converter. I don't think Steve is trying to create a new assembler.

Title: Re: Bxbasic (Blunt Axe Basic)
Post by: jcfuller on October 16, 2011, 03:09:00 AM
Steve,
As a followup note most of my work with JWAsm was on 32bit Linux.
I took another look at my windows setup and I am using polink (Pelles) linker.

James
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 16, 2011, 07:56:56 PM
You guys lost me. I thought Steve was looking for a good assembler to generate executables from his BxBasic to ASM converter. I don't think Steve is trying to create a new assembler.

You are correct John.
(but, this conversation does have too many Steve's in it, doesn't it ?)

Quote
Steve is very protective of the Masm32 package. I am not sure of the license of BxAsm but it may very well violate Steve's edicts of not allowing anything from the Masm32 package to be used for a GPL project.

For those out of the loop, there is me, SteveA and then there is Steve (Hutch) Hutchesson, (author of Masm32 package).

It it my intention to continue with the BxBasic to ASM converter.
I would build the front-end, to make the conversion and use the assembler of choice as the back-end, to compile the executable.
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 16, 2011, 08:40:47 PM
Quote
Steve,
...but you have to watch out. Steve is very protective of the Masm32 package. I am not sure of the license of BxAsm but it may very well violate Steve's edicts of not allowing anything from the Masm32 package to be used for a GPL project.

James

I have searched, and I don't really see where Hutch has restricted (in documentation) the usage of the Masm32 package.
Except for the cautions regarding using freely downloadable Microsoft executeables, I don't see that that should be a problem, any way.
I don't see anywhere in Hutch's docs where he mentions GPL.
Now, maybe he has posted on the forum about it, but, if it's not in the docs, it doesn't carry any weight.
I could be missing something.

Besides, I don't rely on MS free download executables.
I have purchased Visual Studio and it has it's own EULA.

Additionally, besides referencing the MS EULA, I don't see where Hutch has provided a seperate license for the Masm32 package.
I see no obvious restrictions on it's usage.
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: jcfuller on October 17, 2011, 03:40:32 AM
Steve,
Re:No GPL
Bottom of the page.

http://www.masm32.com/license.htm


As I said I was primarily using JWAsm on Linux so I could not use any of the included macros

What you CANNOT do with the MASM32 Project.
4. You cannot use the MASM32 Project to write software for Non-Microsoft Operating Systems

James



Title: Re: Bxbasic (Blunt Axe Basic)
Post by: jcfuller on October 17, 2011, 06:37:55 AM
SteveA,
  After looking at the BxbAsm-Masm package I thought you might be in violation of Hutch's license so I inquired of him on it's compliance.
  I just received an email where he stated your BxbAsm-Masm.zip package is basically not in compliance with his License.
He said he didn't care because the package was so old but if a revival is in order you may want to email him as to how you might comply.

I might want to contribute to a JWAsm port (Win/Linux) so I wanted to make sure on the current status.

James
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 17, 2011, 07:32:29 AM
Quote
...besides referencing the MS EULA, I don't see where Hutch has provided a seperate license...
I was looking at my old install, which does not include Hutch's license.

Quote
...www.masm32.com/license.htm...
Thanks for the link.
I'm sure I must have seen this at some point in the past.
I don't understand why this isn't contained within the Masm32 package.

Quote
What you CANNOT do with the MASM32 Project.
4. You cannot use the MASM32 Project to write software for Non-Microsoft Operating Systems
This makes complete sense, since the Masm32 package is based on Windows.
I don't know how you would use Windows (exclusive) tools to create *nix software.
Maybe there is a way to do it... I don't know.

Quote
I just received an email where he stated your BxbAsm-Masm.zip package is basically not in compliance with his License.
Thanks for checking James. 
I was completely unaware of this fact.

I am puzzled tho, about Hutch's position on software development.
The Masm32 package itself is freely available, but, Hutch places restrictions on how and under what circumstances users may use it. (?)

I am aware of the flame wars over the years between Hutch and numerous (unnamed) indviduals.
Basically, I have always liked Hutch. I have never found myself in disagreement with his forum postings.
And, I have always found his forum as a wealth of information.
I just don't get his position on open-source software.
I have scanned Microsoft's license (those which I have) and they don't make any mention regarding open-source software.
I don't see that he can place the blame on MS.
Puzzled...
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: jcfuller on October 17, 2011, 08:00:02 AM
SteveA,
  It has nothing to do with MS software only on the macros,libraries, and include files created by users (and Hutch) and incorporated into the Massm32 package.
You may use any of the macros/libraries/includes if you can track down the contributor and get individual permissions. I did this with Raymond's floating point library so I could use it on Linux.
 
James

Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 17, 2011, 11:53:44 AM
Quote
You may use any of the macros/libraries/includes if you can track down the contributor and get individual permissions.
Oh...I get it.

Thanks for the tip.
All considered, it may not be too important, at this point.
I'm getting ready to dig into JWasm.

Title: Re: Bxbasic (Blunt Axe Basic)
Post by: jcfuller on October 24, 2011, 12:20:05 PM
Steve,
  I am working my way through your excellent Bxb tutorial and have just finished chapter 1.
 While I have been programming since the early 70's it has mostly been BASIC so my "c" is suspect.
Question:
In the void program_array() you allocate memory for array1 and array2

Code: [Select]
    array1 = malloc(nrows * sizeof(char *));
    for(ii = 0; ii < nrows; ii++)
    {   array1[ii] = malloc(ncolumns * sizeof(char));
    }
    array2 = malloc(nrows * sizeof(char *));
    for(ii = 0; ii < nrows; ii++)
    {   array2[ii] = malloc(LINE_NUM * sizeof(char));
    }

In main() you free it with:
Code: [Select]
    free(array1)
    free(array2)

should there not be a loop and first free the actual lines memory:
Code: [Select]
    for(ii = 0; ii < nrows; ii++)
    {   free(array1[ii]);
    }
    for(ii = 0; ii < nrows; ii++)
    {   free(array2[ii]);
    }

I believe in practice you do not "NEED" to free either one as they will be freed by the os on termination of the program.


James
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: John on October 24, 2011, 01:00:41 PM
Quote
I believe in practice you do not "NEED" to free either one as they will be freed by the os on termination of the program.

That may be true for single process applications but freeing allocated memory when using threads is recommended.

Quote from: SB Dev Docs
The major problem with memory allocation is that memory should be released. Old programs depend on the operating system to release the memory when the process exists and do not release the memory before program termination. Such programs are extremely difficult to port to multi-thread operation. In multi thread operation a thread my exit, but the memory still belongs to the process that goes on.
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 24, 2011, 02:45:23 PM
Quote
That may be true for single process applications but freeing allocated memory when using threads is recommended.

John is correct.
You can't make assumptions about what the OS might do.
That's how memory leaks get started.

I'm not saying that Bxb is free of memory leaks, I just try to check them when I see them.
"..if you allocate memory, free it when done".
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: John on October 24, 2011, 03:02:40 PM
If using C and you declare a variable within a function, the memory allocated is freed once the function is exited. I'm assuming this memory housekeeping is done by the C compiler. As Steve says, if you do a discrete allocation of memory in your program, you should free it when done and before exiting your program.

You guys are working at a much lower level and the rules under that environment are foreign to me.
 
Title: Re: Bxbasic (Blunt Axe Basic)
Post by: SteveA on October 24, 2011, 03:26:51 PM
Quote
...if you do a discrete allocation of memory in your program, you should free it when done and before exiting your program.

Yes, the allocated memory in question is of a global nature.