MSX BASIC CONVERTER

By iamweasel2

Paladin (722)

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.

ログイン/登録して投稿

By rodrivas78

Resident (33)

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.

By iamweasel2

Paladin (722)

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. :)

By chalky

Expert (69)

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.

By iamweasel2

Paladin (722)

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?

By chalky

Expert (69)

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).

By chalky

Expert (69)

chalky さんの画像

21-04-2022, 20:48

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

By chalky

Expert (69)

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

By thegeps

Paragon (1259)

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

By eimaster

Champion (285)

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.

By pizzapower

Master (172)

pizzapower さんの画像

24-05-2022, 17:05

You can always host it on github...