Any BASIC compilers that produce a .COM?

By jbikker

Resident (45)

Аватар пользователя jbikker

09-09-2022, 15:20

Hi all,

I searched a bit but couldn't find a good option:
Is there an MSX-BASIC compiler that runs under MSXDOS and produces a .COM file from a .BAS file?
Right now I enjoy MSX development on PC using SDCC and MSXgl. However, it would be lovely to have a development environment on MSX. C compilation is too slow, so BASIC (perhaps using one of the tools that auto format code without line numbers) combined with a MSXDOS text editor might be a good option. But all compilers seem to either work from BASIC, or otherwise they produce ROMs.

- Jacco.

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By gdx

Enlighted (6429)

Аватар пользователя gdx

09-09-2022, 16:37

There are no really usable BASIC compilers that produce a .BIN, .COM or .ROM.

By jbikker

Resident (45)

Аватар пользователя jbikker

09-09-2022, 19:42

Hm that's a pity. Perhaps it's possible then to write a proper editor that runs from BASIC, does the desired source reformatting, then starts BASIC KUN or plain BASIC (for debugging).

Thanks for the answer!

By ducasp

Paladin (712)

Аватар пользователя ducasp

10-09-2022, 13:39

https://launchpad.net/msxbas2asm

Still a work in progress, but it compiles a BAS to ASM, there are a few things implemented and a few not implemented

By jbikker

Resident (45)

Аватар пользователя jbikker

15-09-2022, 20:34

I've seen it, very nice! But it runs on a PC, not on MSX, right?

By ducasp

Paladin (712)

Аватар пользователя ducasp

16-09-2022, 14:58

Compilation on msx really doesn't make sense nowadays, yeah, didn't notice you wanted it to compile on msx, in that case I don't know any tool for that

By Sandy Brand

Champion (309)

Аватар пользователя Sandy Brand

16-09-2022, 15:51

I would agree that compiling on an actual MSX does not give you any useful benefits Smile

However, if you are still curious about the topic, maybe this thread could be relevant for you: MSX-BASIC compilers for MSX - overview?

By Axe_chita

Rookie (22)

Аватар пользователя Axe_chita

23-09-2022, 08:37

If you need an MSX Basic compiler that creates COM files and is executable under MSX DOS, then I advise you to pay attention to SOLiD VBasic, version 2.7
"The compiler was created in order to obtain a language as close as possible to MSX BASIC. Moreover, since debugging using an interpreter is possible, diagnostics of some errors that can be detected during debugging on the interpreter is excluded from the compiler.
The input language is a slightly expanded version of MSX BASIC, consisting of a kernel and expanded with the following functions:
the WHILE ... WEND (loop operator is equivalent to that in IBM basic (BASICA, GW-BASIC).
separate compilation support tools (PROCEDURE, extension of the CALL operator, compatibility with MSX-C.
the PRAGMA compiler control option."

But at the same time take into account that there are certain differences from the interpreter
"Waste from standards is due to the optimization of the resulting code and the inability to implement some of the functions in the compiled program model. These wastes are listed below:
All input/output functions as well as external functions receive and return parameters of an integer type only, for example, the entry number in GET/PUT statements should be 1...65535;
Memory for arrays and variables is allocated 1 time during compilation, so the ERASE operator is not defined, CLEAR clears only strings and files, and when declaring arrays, ONLY constants should be used to specify dimensions.
Arrays can be one—dimensional or two-dimensional - this is an annoying misunderstanding that is easy to get around by simulating an array of a larger dimension.
Variable types are hard-wired to names. For example, you cannot use A and A$ in the same program, as well as an array with a name that matches the name of a simple variable. Read more about this in Chapter 3.
Spaces in the program text ARE delimiters.
When parsing the text, the string up to the nearest separator is taken as the variable name, so syntax errors are possible in programs running on the interpreter"
"In mathematical expressions, functions defined in MSX can be used, and their action is standard, so only three functions that can be used not only in accordance with the standard will be fully described here.
The SQR function, if its argument is a floating number, then the result is floating, if the argument is an integer, then the result is an integer rounded to the nearest smaller.
The ABS function is similar to SQR, naturally without rounding.
The RND function - if the argument is floating, it works as standard, unlike the case with an integer argument, which is described below.
If the function is called as RND(M), where M is an integer expression, it returns a strictly random, evenly distributed integer in the range from 0 (inclusive) to M (exclusive), positive or negative depending on the sign of M.
All file handling functions, as mentioned in chapter two, return integer values."

Compilation speed is slightly higher than MSX C
The documentation for the compiler, in Russian, is available at https://sysadminmosaic.ru/msx/vbc/vbc

By jbikker

Resident (45)

Аватар пользователя jbikker

28-09-2022, 12:13

Thanks a lot, I'll check that out!
Regarding the benefits of compiling on an actual MSX: I would like to actually use my retro machines, and not just by holding a joystick. Wink Probably silly, but a development tool chain purely on the device seems nice to me. I'm currently working on a text editor for this, which should feel modern and smooth.

By jbikker

Resident (45)

Аватар пользователя jbikker

28-09-2022, 12:42

Quote:

Thus, a 530-line MSX BASIC program (albeit extremely complex and with a lot of input-output and string operations) was linked by the editor LINKwithin 17 minutes.

Ow. Sad

So even on TurboR well above one minute.

By Axe_chita

Rookie (22)

Аватар пользователя Axe_chita

28-09-2022, 15:13

Unfortunately, Egor did not provide the source code of this program. Perhaps there are some pitfalls in it that lead to the braking of the linking of this program.