Can we use .BIN BASIC routines in other languages?

By AxelStone

Prophet (2701)

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

06-11-2019, 12:50

Hello everyone, I wonder if it's possible to use already done libraries for BASIC (like .bin libs) in another lenguaje. In theory, a .BIN file is located in memory with BLOAD and after that tu call the function in the indicated memory address where rutine was loaded, so it should be possible to make some kind of trick to use for example with compiled language like C.

I ask this because FM provides a MML music player for Basic integrated in BIOS and I'm really interested in programming a MML driver for MSX-C. Instead of making from scratch, it would be fine to make some kind of reverse engineering to the BIOS, extrac this code and be able to use.

Is this possible? Thanks.

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

By Grauw

Ascended (8507)

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

06-11-2019, 17:22

It can probably be done, at least for CALL commands. For the PLAY command it may be more difficult since it’s probably done through hooks.

But in the case of MSX-MUSIC it would actually be better to access the FM-BIOS directly which afaik includes replayer code which you can feed MML to. See the documentation here.

By AxelStone

Prophet (2701)

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

06-11-2019, 19:30

Unfortunately as I say, the MML player is only available as Basic Call, I'd like to "extract" this code to be used outside of Basic.

By NYYRIKKI

Enlighted (5396)

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

07-11-2019, 01:18

Interacting with BIN-files is not hard from other languages. (See BIN-file format) After loading you practically only need to set up slot layout as in BASIC and you can start using the file. For interacting like basic does, you need to fill / interpret the values you want to send/receive from the program from DAC and DACTYP. This is well explained in MSX2 Technical Handbook.

About the other question about FM MML player... I don't think this is easy to do, but if you want to take a look how it is implemented in MSX-AUDIO or MSX-MUSIC, there is always msxsyssrc-project.

By AxelStone

Prophet (2701)

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

07-11-2019, 14:51

Hello @NYYRIKKI, according to wiki of the url you attached it is "Sources of various MSX systems ROMS". Where should I start to check about MML implementation? It's dissasembled code, I can't find any reference to MML string, I don't know if you could have some idea to start looking for Question

I already did some tests in the past with binary files, for example try to integrate Animecha player into MSX-C code, with no success. Perhaps it's time to retry, I'll ask for sure requesting help Wink

Thanks guys.

By NYYRIKKI

Enlighted (5396)

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

07-11-2019, 17:23

"Subroutine execute PLAY statement" (MSX-AUDIO) or "Subroutine handle PLAY statement" (MSX-MUSIC) is probably the best place to start crawling forward.