MSXBAS2ROM (0.2.5.7)

van Amaury Carvalho op 09-03-2021, 16:27

MSXBAS2ROM is an open source experimental MSX Basic cross platform compiler inspired on Basic Kun.

All compilation process and code generation its made from scratch without Basic Kun involvement, and the compiled code uses only a subset of Basic Kun support library (float point math, graphical statements...).

It's run as a command line tool on Windows/Linux modern machines, and you can create a compiled ROM file from your Basic code using the "-c" parameter just like this:

msxbas2rom -c program.bas

All documentation can be listed using "--doc" parameter.

Current project status is development in progress, and you can get more information at the link below:

https://launchpad.net/msxbas2rom

Reacties (5)

Van shalafi

Expert (110)

afbeelding van shalafi

29-07-2021, 12:40

I was looking into it briefly since it only works for Linux and Windows but not for Mac. I ended up setting up a Raspberry Pi to play with it.
Then I tried to compile from source on my Mac, but I was getting some errors. Ultimately, adding a compiler flag to the Makefile fixed them (some C++11 string literals not supported by default on my version of gcc)

All in all, nice job, not as fast as MSX-BASIC-KUN yet, specially when handling loops of calls to the VDP, but very nice.
Documentation is a bit lacking and unclear about how to use external resourced, I am having to find about that by trial and error.

Maybe you want to add the flag on the project for everyone:

CFLAGS = -Wall -fexception -std=c++11

Van Paulo Garcia

Rookie (18)

afbeelding van Paulo Garcia

21-02-2022, 18:37

Hi,

MSXBAS2ROM can be easily compiled on macOS (Including Apple Silicon which is my case). To do that you have to remove the line that includes malloc.h, since that is deprecated. The POSIX malloc() function is defined in stdlib.h. After removing that, just type "make" in the root folder and the native macOS versions will be in the Release/Debug folders.

I've made changes to make it generic to any OS but I have never used Bazaar source control so I don't know how to suggest changes, so I am posting here just in case the author is interested (it must be tested on linux and windows though Smile:

=== modified file 'src/main.cpp'
--- src/main.cpp 2022-01-30 22:38:25 +0000
+++ src/main.cpp 2022-02-21 17:29:43 +0000
@@ -17,7 +17,9 @@
#include
#include
#include
-#include
+#ifndef MacOS
+ #include
+#endif
#include

#include "main.h"

=== modified file 'Makefile'
--- Makefile 2021-09-01 14:51:28 +0000
+++ Makefile 2022-02-21 17:30:01 +0000
@@ -2,9 +2,20 @@
# This makefile was generated by 'cbp2make' tool rev.147 #
#------------------------------------------------------------------------------#

-
WORKDIR = `pwd`

+ifeq ($(OS),Windows_NT)
+ OSFLAG += -D Win
+else
+ UNAME_S := $(shell uname -s)
+ ifeq ($(UNAME_S),Linux)
+ OSFLAG += -D LINUX
+ endif
+ ifeq ($(UNAME_S),Darwin)
+ OSFLAG += -D MacOS
+ endif
+endif
+
CC = gcc
CXX = g++
AR = ar
@@ -12,7 +23,7 @@
WINDRES = windres

INC = -I include
-CFLAGS = -Wall -fexceptions -std=c++11
+CFLAGS = -Wall -fexceptions -std=c++11 $(OSFLAG)
RESINC =
LIBDIR =
LIB =

Van Amaury Carvalho

Resident (36)

afbeelding van Amaury Carvalho

25-02-2022, 22:49

Thanks shalafi, and Paulo, for your contributions.

I will include your code suggestions on the next release, scheduled for early March.

About the code repository, I plan to switch to another one based on git in the near future.

But, for now, I'm spending a lot of time writing a reference book on MSXBAS2ROM game development (covering all the new commands), which will be published by the same editors as "Clube MSX" brazilian magazine.

Wait for news soon.

Van Paulo Garcia

Rookie (18)

afbeelding van Paulo Garcia

02-03-2022, 01:15

Looking forward to it Amaury. I've started using the compiler now so I don't much about it. A book would be very nice!

Cheers

Paulo

Van shalafi

Expert (110)

afbeelding van shalafi

05-03-2022, 10:55

Nice to hear the news.

I recall I sent a PR with the changes needed for MacOS in the Makefile many months ago and that they were already integrated into the main branch.

I have a draft for a chapter on msxbas2rom in the same style as the rest of my BASIC book, I was considering it as an extension to the book. It's unfinished, and it looks like you're already ahead of where it is. Good to hear that documentation is coming!