flat assembler
Message board for the users of flat assembler.
Index
> Linux > Basic to ASM compiler for Linux/BSD Goto page 1, 2 Next |
Author |
|
janick 27 Aug 2004, 11:21
I've searched for weeks for a BASM-like compiler for Linux/BSD.
It does NOT exist yet, is there anyone who can program such a thing ? For those of you who do not know what BASM is, it's a Basic to ASM compiler that creates extremely small .COM and .EXE files under DOS. You can download the basmv650.zip here : http://xs1.com/basic2asm There are lots of samples (source & compiled) included. The intended use is large scale CGI development in BASIC, running on the THTTPD webserver ( http://www.acme.com ). Currently the THTTPD webserver serves a max of 2000 users at once. PHP has a max of 80 scripts running at once, C does around 300. ASM would do around 800, which makes it possible to create a great chatscript in BASIC without programming C or slowish PHP/Perl. The BASM (Basic to ASM) sourcecode is included in the zip, this will certainly make it easier (and faster) to develop the compiler. If anyone likes to collaberate, let me know ! |
|||
27 Aug 2004, 11:21 |
|
crc 27 Aug 2004, 12:01
Why not just use macros? You can get pretty close to BASIC's syntax and commands with nothing but assembler macros...
|
|||
27 Aug 2004, 12:01 |
|
fasm9 27 Aug 2004, 23:31
http://www.purebasic.com
purebasic backend is FASM. It is Available on windows, linux. -- PS: Personally i prefer c, not basic. Cheers |
|||
27 Aug 2004, 23:31 |
|
janick 30 Aug 2004, 12:35
fasm9 wrote: http://www.purebasic.com 1. Linux ASM is not the same as FreeBSD ASM (unix). I don't want comp mode. 2. I like a simple commandline compiler. 3. PHP is very C-like. Basic is much easier for CGI development. Anyone here capable of rewriting / adjusting BASM ? |
|||
30 Aug 2004, 12:35 |
|
crc 30 Aug 2004, 13:36
The problem here is that BASIC requires a pretty large library of functions. Implementing a parser/converter for the language isn't a problem. Writing the library code is.
You're right that FreeBSD and Linux are different from a programmer's perspective. But they aren't that different. It's easy to adapt an assembly program for Linux to run on FreeBSD. Look at asmutils (written in nasm, but the principle applies) which can be reassembled for various OSes with minor changes. |
|||
30 Aug 2004, 13:36 |
|
rob.rice 13 Oct 2004, 18:56
crc wrote: The problem here is that BASIC requires a pretty large library of functions. Implementing a parser/converter for the language isn't a problem. Writing the library code is. If you have gcc installed you already have the librarys installed you just have to adpt to them there some examples of how to do this in the fasm package (but you can do better in asm than thay have ben done in C ) |
|||
13 Oct 2004, 18:56 |
|
crc 14 Oct 2004, 01:26
You still run into translation problems: you'd have to convert BASIC into a subset of C, then call the C libraries. This is because C libraries are not compatible cleanly with the BASIC way of doing things.
|
|||
14 Oct 2004, 01:26 |
|
penang 14 Oct 2004, 04:14
[quote="fasm9"]http://www.purebasic.com
purebasic backend is FASM. It is Available on windows, linux. -- PS: Personally i prefer c, not basic. Cheers[/quote] Actually, the backend is NASM. See www.purebasic.com/introduction_linux.php3 |
|||
14 Oct 2004, 04:14 |
|
Tomasz Grysztar 14 Oct 2004, 08:33
It has switched from NASM to FASM since 3.50, see http://www.purebasic.com/news.php3
|
|||
14 Oct 2004, 08:33 |
|
crc 14 Oct 2004, 11:08
purebasic doesn't work on FreeBSD without emulation mode, which the original poster doesn't want to use.
|
|||
14 Oct 2004, 11:08 |
|
Crunch 14 Oct 2004, 18:02
Don't have any direct experience with XBASIC, but thought I'd mention it since it looks interesting from afar. It's open source GPL/LGPL.
Here's a quote from their FAQ: "FAQ - XBasic implementation What language is XBasic written in? XBasic is written entirely in XBasic, except for 400KB of assembly language - most of that is comments. XBasic does not call any functions in any C function library. XBasic is self-contained - the only functions XBasic calls are operating-system API functions. Linux XBasic implements all its graphics and message processing by calling functions in the low-level XWindows xlib function library. Is XBasic really a compiler, or does it interpret some intermediate language? When you run programs in the XBasic program development environment, XBasic translates your XBasic source program directly into executable binary machine instructions in RAM memory, then executes it. When you have finished debugging an XBasic program, you can compile it into an assembly language file. XBasic also creates a makefile containing the steps required to assemble and link the assembly language file to create an executable - either an EXE or DLL." I assume the core assembly is in MASM yet may give you many ideas. http://xbasic.sourceforge.net/ Don't know whether or not it's FreeBSD friendly, but I found the following link which seems interesting and seems to imply that XBasic was used in creating FreeBSD LiveCD 1.2.4 (current version). http://sourceforge.net/projects/livecd Hope it's helpful and not annoying! |
|||
14 Oct 2004, 18:02 |
|
rob.rice 18 Dec 2004, 17:35
crc wrote: You still run into translation problems: you'd have to convert BASIC into a subset of C, then call the C libraries. This is because C libraries are not compatible cleanly with the BASIC way of doing things. you do all the translation in the compiler from the point of view of there is nothing but basic the c libraries are so low levle that it dosen't matter what lanuage you use to call them there are example of other lanuages that use them like pascal fortran java other than being HILLs thay look nothing like C as a short cut you could work on a front end to gcc and have gcc do most of the work for you as a fact of the matter fortran is so close to basic that it woulden't tack much to change it's front end to compil basic or learn fortran most of what you already know about basic applys to fortran some of the key words differ but the style and syntax are the same befor you tell me I'm wrong have a good look at some fortran source code if you can read basic source you can read fortran source code |
|||
18 Dec 2004, 17:35 |
|
crc 18 Dec 2004, 18:32
Quote: you do all the translation in the compiler from the point of view of there is The difficulty is in writing the compiler. I can write a subset of BASIC in Forth easily, but writing a complete set of library code that would be cleanly interfaced is a different story. Quote: the c libraries are so low level that it dosen't matter what lanuage you use to call them Sure it does. I mostly use Forth, and there's quite a bit of translation to handle different calling conventions. (The same problems arise with libraries used by some versions of pascal). Once you start relying on the C libraries, you lose the advantage of having compact code. Yes you can optomize some things, but the external functions will seldom (if ever) be as fast as carefully written code. Quote: as a short cut you could work on a front end to gcc and have gcc do most of the work for you Go ahead. I don't have the time or desire to even attempt to learn the GCC source well enough to wriite/adapt a new front end to it. Quote: or learn fortran most of what you already know about basic applys to fortran True to a point. FORTRAN goes far beyond Basic in terms of language complexity. Basic was created to make it easier to teach FORTRAN later. |
|||
18 Dec 2004, 18:32 |
|
rob.rice 25 Jan 2005, 06:50
fourth is about the olny major programming lanuage there is and there is even a
gnu version that uses the standard c libs there is a BASIC thats uses the clibs and outputs assembly with gas as the back end about fortran you don't need to use the full complexity you can stick to the subset you know from BASIC]]] |
|||
25 Jan 2005, 06:50 |
|
crc 25 Jan 2005, 11:21
Code: C Hello World in Fortran PROGRAM HELLO WRITE (*,100) STOP 100 FORMAT (' Hello World! ' /) END Code: PROGRAM HELLO c C Hello World in Fortran IV (supposedly for a TR440) c WRITE (6,'('' Hello World!'')') END Code: C Hello World in Fortran 77 PROGRAM HELLO PRINT*, 'Hello World!' END Fortran has quite a bit more red tape than BASIC from what I've seen of it in the examples I looked at. Even simple things like "Hello World" involve more typing a bit more red tape than BASIC does. |
|||
25 Jan 2005, 11:21 |
|
crc 25 Jan 2005, 11:26
Quote: fourth is about the olny major programming lanuage there is and there is even a At the same time, gForth is kind of bloated and a bit slower than it needs to be. My Forth is tiny (4-6k depending on compile-time options), and is faster than gForth, even with the optional C library support code. Dealing with external libs is a pain even in the best case though. I have to do a lot of internal work to mask the differences in register use, calling conventions, and so on. It isn't fun to code the backend for dealing with C libraries. |
|||
25 Jan 2005, 11:26 |
|
rob.rice 08 Mar 2005, 06:54
GNU fortran is an ansi77 fortran so there's not that much red tape
I would love to learn forth the big problem I'm haveing is that there is no forth system that matches any of the documentation I can find and who ever writes a forth interpter dosen't do tutorials for there forth |
|||
08 Mar 2005, 06:54 |
|
ronware 08 Mar 2005, 16:33
rob.rice wrote: GNU fortran is an ansi77 fortran so there's not that much red tape Hi, Rob - There are some good tutorials on Forth. A good system to download and play with is "pforth", which is written in C and can be compiled on Windows or Linux with equal ease. The problem you are encountering is that there is a standard -- the "ANS Forth" standard -- which is more of a suggestion than anything else. My system for instance is not ANS standard (by design) -- my goal is to only include what is needed for my purposes. If you need more information or pointers on Forth, feel free to email me (via my website). |
|||
08 Mar 2005, 16:33 |
|
ronware 08 Mar 2005, 18:36
crc wrote:
Hi, Charles - Why didn't you bring a RetroForth (or Reva) example? Code:
| Hello world in Forth
." Hello world!" cr bye
|
|||
08 Mar 2005, 18:36 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.