Deleted
Deleted Member
Posts: 0
|
BASM
Nov 29, 2014 10:34:12 GMT 1
Post by Deleted on Nov 29, 2014 10:34:12 GMT 1
I have been busy trying to revive a Kool BASIC to ASM compiler/assembler/linker project that is(was) a Windows effort. AIR has been working on a Mac / Linux port and we have shown some progress. The goal of this project is not just get a cross platform BASIC compiler working but a fully documented tutorial on how it was built. BASM Forum
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Nov 29, 2014 23:10:31 GMT 1
Post by Deleted on Nov 29, 2014 23:10:31 GMT 1
We were able to get a 32 bit Linux version of KoolB running. (2068 byte executable) Thanks AIR!
cat whome.bas
PRINT "KoolB"
./kool whome.bas
Welcome to KoolB 15.01 by Brian C. Becker!
Your open-source Linux BASIC compiler!
Currently compiling "whome.bas": - Compile time -> 0.001243 seconds - Assemble time -> 0.004015 seconds - Linking time -> 0.001041 seconds ------------------------------- - Total time -> 0.007451 seconds ./whome KoolB
|
|
|
BASM
Nov 29, 2014 23:44:16 GMT 1
Post by vovchik on Nov 29, 2014 23:44:16 GMT 1
Dear John, Looks interesting, to say the least... Please keep us updated. The BASM forum is pretty bare at the moment, but it is also brand new, so that is not surprising. What is surprising is that that BASM already is working in Linux. With kind regards, vovchik
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Nov 30, 2014 0:44:46 GMT 1
Post by Deleted on Nov 30, 2014 0:44:46 GMT 1
Brian supported Linux up till version 15. Mark (Chameleon) drop Linux support for a Windows only direction. I'm returning back to a cross platform compiler as Brian C. Becker intended. That's easy to fix. Join the BASM forum and advocate/develop the Linux direction. We could sure use someone like Joe for the documentation effort. Update: I was able to get KoolB compiled as a 64 bit application and after installing the 32 bit library support the generated executables ran fine. more ...
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Dec 1, 2014 7:05:34 GMT 1
Post by Deleted on Dec 1, 2014 7:05:34 GMT 1
I have pushed the BASM-Linux source to Bitbucket if you would like to give it a try on your 32 bit Linux OS. Easy to compile. g++ BASMmain.cpp -o BASM
|
|
|
BASM
Dec 1, 2014 8:54:01 GMT 1
Post by vovchik on Dec 1, 2014 8:54:01 GMT 1
Dear John, Thanks for the commit. I downloaded the lot and compiled BASM in 32-bit Mint (which is in the basm_test archive, stripped and UPX'd). I also compiled a little test that was in the examples folder and converted "Who are you.bas" to BaCon and compiled it successfully, just for syntax comparison purposes. The BASM binary, stripped and UPX'd, weighs in at 85k, which is nice and small. The other archive (basm_linux) contains the basm sources and a compile script. Interesting stuff. With kind regards, vovchik Attachments:basm_test.tar.gz (92.58 KB)
basm-linux.tar.gz (58.4 KB)
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Dec 1, 2014 18:40:23 GMT 1
Post by Deleted on Dec 1, 2014 18:40:23 GMT 1
Thanks vovchik for trying it out and creating the BaCon comparison examples. For others, what vovchik is saying is he was able to get the C++ BASM-Linux compiler to compress down to 85K. The example executables generated were in the 2KB-4KB range.
|
|
|
BASM
Dec 1, 2014 22:15:06 GMT 1
Post by vovchik on Dec 1, 2014 22:15:06 GMT 1
Dear John, I managed to import libm functions rather easily. It will, I fear, be a bit more work for strings, unless AIR has done all of this already. With kind regards, vovchik Attachments:mathfuncs.bas.tar.gz (926 B)
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Dec 1, 2014 22:59:17 GMT 1
Post by Deleted on Dec 1, 2014 22:59:17 GMT 1
Thank you for the MATH contribution.
Please look at the BASM Windows version Inc/String.inc for string management functions. We need to see if the MID$ $ASM in-line code will work with Linux. (first good test) I'm not an ASM programmer. (yet, but trying to learn)
FWIW - Check out the DLL (.so) creation and calling example on the BASM forum.
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Dec 2, 2014 4:20:06 GMT 1
Post by Deleted on Dec 2, 2014 4:20:06 GMT 1
I pushed your Math.inc to the BASM Bitbucket site.
I wonder why FLOOR(3.5): -nan is giving a nan return?
I think the Linux version of BASM does Call C by default. I'm not using it with my IUP DECLAREs and it works fine. I think Call C is a Windows option. (standard call by default)
jrs@VB32:~/BASM/linux/Inc$ time ./mathfuncs BASM libm IMPORTS SQRT(4): 2 SQRT(3): 1.7320508075688772 POW(3,3): 27 POW(3.1,3): 29.791000000000004 SIN(45.0): 0.85090352453411844 COS(45.0): 0.52532198881772973 ASIN(.45): 0.46676533904729639 ATAN(45.0): 1.5485777614681775 ACOS(.45): 1.1040309877476002 LOG(3): 1.0986122886681098 CEIL(3.5): 4 FLOOR(3.5): -nan FABS(-3.5): 3.5 MOD(6,5): 1 TANH(.45): 0.42189900525000795 EXP(.4): 1.4918246976412703 INCR(2): 3 DECR(2): 1 FRAC(3.5): 0.5 BASE(3.5): 3 ABS(-3.5): 3.5 ABS(3.5): 3.5 ------ SIZEOF(DOUBLE) : 8 SIZEOF(STRING) : 4 SIZEOF(INTEGER): 4
real 0m0.068s user 0m0.004s sys 0m0.024s jrs@VB32:~/BASM/linux/Inc$
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Dec 2, 2014 6:13:30 GMT 1
Post by Deleted on Dec 2, 2014 6:13:30 GMT 1
vovchik - Good News! The Bitwise.inc from the Windows BASM compiled and seems to work on Linux. The interesting part is all of these routines use in-line $Asm. (see BASM forum)
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Dec 2, 2014 6:51:13 GMT 1
Post by Deleted on Dec 2, 2014 6:51:13 GMT 1
Is there anything like msvcrt.dll for Linux? It looks like all the other Inc files are Windows (msvcrt.dll) specific. ' Type.inc - Type functions ' Library for KoolB by Brian Becker
$IfNDef Typeinc $Define Typeinc
Declare Function IsAlNum Lib "msvcrt.dll" Alias "isalnum" Call C (Char As Integer) As Integer Declare Function IsAlpha Lib "msvcrt.dll" Alias "isalpha" Call C (Char As Integer) As Integer Declare Function IsCntrl Lib "msvcrt.dll" Alias "iscntrl" Call C (Char As Integer) As Integer Declare Function IsDigit Lib "msvcrt.dll" Alias "isdigit" Call C (Char As Integer) As Integer Declare Function IsGraph Lib "msvcrt.dll" Alias "isgraph" Call C (Char As Integer) As Integer Declare Function IsLower Lib "msvcrt.dll" Alias "islower" Call C (Char As Integer) As Integer Declare Function IsPrint Lib "msvcrt.dll" Alias "isprint" Call C (Char As Integer) As Integer Declare Function IsPunct Lib "msvcrt.dll" Alias "ispunct" Call C (Char As Integer) As Integer Declare Function IsSpace Lib "msvcrt.dll" Alias "isspace" Call C (Char As Integer) As Integer Declare Function IsUpper Lib "msvcrt.dll" Alias "isupper" Call C (Char As Integer) As Integer Declare Function IsXDigit Lib "msvcrt.dll" Alias "isxdigit" Call C (Char As Integer) As Integer
Declare Function ToLower Lib "msvcrt.dll" Alias "tolower" Call C (Char As Integer) As Integer Declare Function ToUpper Lib "msvcrt.dll" Alias "toupper" Call C (Char As Integer) As Integer
$End If
|
|
|
BASM
Dec 2, 2014 8:46:30 GMT 1
Post by vovchik on Dec 2, 2014 8:46:30 GMT 1
Dear John, All those convert bits are standard libc.so ... and I think they should, perhaps with a bit of massaging, work OK, which is good news. With kind regards, vovchik
|
|
Deleted
Deleted Member
Posts: 0
|
BASM
Dec 2, 2014 18:11:08 GMT 1
Post by Deleted on Dec 2, 2014 18:11:08 GMT 1
vovchik - That is good news! This is where things are with the BASM project. John (me) - Project facilitator, secretary, advocate and student. Working on a cross platform IUP include for BASM. AIR - Revived the Linux KoolB version Brian C. Becker did and got it working in 32 bit on Mac & Linux. AIR hasn't committed to participating and is helping me out as a friend. If we can keep his interest with others participating, it is our only hope of keeping him around. vovchik - Donated the libm MATH library for the Linux version of BASM. Hopes: Continue to contribute and lead the Inc effort for BASM Linux. angros47 - Bright programmer from the FreeBASIC project that joined the forum and extracted the core BASM keywords for the forum syntax highlighting and docs. @all - We need documentation and ASM skills. Once the Windows and Linux versions are in functional sync, I would like to open the topic of a 64 bit NAsm migration.
|
|
|
BASM
Dec 2, 2014 22:00:07 GMT 1
Post by vovchik on Dec 2, 2014 22:00:07 GMT 1
Dear John
I figured out how c++ functions can be called:
DECLARE FUNCTION ATOI LIB "libstdc++.so.6" ALIAS "atoi" CALL STD(S AS STRING) AS INTEGER DECLARE FUNCTION ATOF LIB "libstdc++.so.6" ALIAS "atof" CALL STD(S AS STRING) AS DOUBLE DIM x$ AS STRING x$ = "13.5" PRINT "x$: ", x$ PRINT "ATOF(x$): ", ATOF(x$) PRINT "ATOI(x$): ", ATOI(x$)
With kind regards, vovchik
|
|