MSX BASIC CONVERTER

Par iamweasel2

Paladin (713)

Portrait de iamweasel2

10-04-2022, 17:09

Anyone knows if there is a tool that allows you to enter a MSX basic program and convert it to a structured format (with indentation ) ?

It would make it easier to understand the logic of the MSX Basic code.

!login ou Inscrivez-vous pour poster

Par rodrivas78

Resident (33)

Portrait de rodrivas78

12-04-2022, 03:17

I believe what you're looking for is something that makes the listing look something like this.
This is MSX Basic code indented and commented. The plain code is here.

This indentation was done by hand and unfortunately I don't know of any tool that performs this kind of task.
But I believe it is not difficult to build some kind of parser that performs this task. Too bad I don't have much free time right now to make one...

I don't know if it helps, I recently discovered found a VScode extension, it's a syntax highlighter for MSX Basic.

Par iamweasel2

Paladin (713)

Portrait de iamweasel2

15-04-2022, 02:07

rodrivas78 wrote:

I believe what you're looking for is something that makes the listing look something like this.
This is MSX Basic code indented and commented. The plain code is here.

This indentation was done by hand and unfortunately I don't know of any tool that performs this kind of task.
But I believe it is not difficult to build some kind of parser that performs this task. Too bad I don't have much free time right now to make one...

I don't know if it helps, I recently discovered found a VScode extension, it's a syntax highlighter for MSX Basic.

Indeed, the idea was to help the manual process of understanding old Basic code logic in order to make it easier to understand it / translate it to other languages.

Too bad there is no such tool.

Thanks for the VSCode tip. :)

Par chalky

Expert (67)

Portrait de chalky

19-04-2022, 12:21

Thought I'd give this a go, as I would find it a useful tool too. It was actually a lot more complicated than I expected - particularly with nested IF statements and combined FOR/NEXT commands (e.g. NEXTJ,K) but I think I've achieved what you're looking for. It's not perfect - the marking of the end of IF blocks is very rudimentary, and I'm not sure if it will correctly handle versions of MSX-BASIC greater than 1 - but at least it's a start.

You can download it from here: FormatMSXBASIC.zip. Simply unzip and run - I'll leave it there for a few days in case anyone wants it.

Par iamweasel2

Paladin (713)

Portrait de iamweasel2

20-04-2022, 12:01

chalky wrote:

Thought I'd give this a go, as I would find it a useful tool too. It was actually a lot more complicated than I expected - particularly with nested IF statements and combined FOR/NEXT commands (e.g. NEXTJ,K) but I think I've achieved what you're looking for. It's not perfect - the marking of the end of IF blocks is very rudimentary, and I'm not sure if it will correctly handle versions of MSX-BASIC greater than 1 - but at least it's a start.

You can download it from here: FormatMSXBASIC.zip. Simply unzip and run - I'll leave it there for a few days in case anyone wants it.

Wow, thanks !!! :)

I will try it as soon as I get home today. Just out of curiosity, what language did you write it?

Par chalky

Expert (67)

Portrait de chalky

20-04-2022, 23:30

I have just uploaded v1.1 (same link and .zip name) which adds some rudimentary checking when attempting to load a file, and dynamically updates the screen when you change the indent-size etc. (in v1.0 you had to reload the file for the changes to take effect!).

I should probably have said before that the MSX-BASIC file must be in .asc format, and the program has no built-in editing functionality - though it allows a processed file to be saved in a .txt file so it can be edited elsewhere.

It's written in BlitzMax/MaxGUI with a few low-level API calls (hence Windows only) to handle the screen-update (which were needed to eliminate the awful flickering which occurred when I created v1.1 using native Blitz commands).

Par chalky

Expert (67)

Portrait de chalky

21-04-2022, 20:48

Apologies - v1.2 uploaded to fix IF indentation bug introduced in v1.1.

Par chalky

Expert (67)

Portrait de chalky

23-04-2022, 15:32

I have uploaded v1.3 which fixes a bug when handling DATA statements, correctly handles NEXT statements nested within IF statements (themselves nested within FOR statements), and improves processing/rendering performance.

I suspect this will only be of use to a handful of people, so will remove the ZIP file in a few days. Smile

Par thegeps

Paragon (1189)

Portrait de thegeps

24-04-2022, 11:35

Or you can ask for the file to be hosted on download section here on MRC (or at File-Hunter). Often I've read posts of people asking for "not still available" softwares released here years ago. So why remove it? Ask for some free hosting, the worst that could happen is a negative answer Wink

Par eimaster

Champion (282)

Portrait de eimaster

24-04-2022, 17:38

I want to download this tool but I can't find it. Any help appreciated. The download link is dead.

Par pizzapower

Master (165)

Portrait de pizzapower

24-05-2022, 17:05

You can always host it on github...