TCL in openMSX

By iamweasel2

Paladin (678)

iamweasel2's picture

10-06-2020, 14:15

What are the limits of using TCL scripts in openMSX? Is everything in TCL available ? For instance, can I use it to write a txt file with data? Show a message on the emulated MSX screen? To play sounds with it (using the SDL API used in openMSX)?

Is there some tutorial / book / whatever about using TCL in openMSX?

Login or register to post comments

By Grauw

Ascended (9690)

Grauw's picture

10-06-2020, 15:00

Yes, yes, no.

By iamweasel2

Paladin (678)

iamweasel2's picture

10-06-2020, 15:03

Grauw wrote:

Yes, yes, no.

Since there are more questions than answers provided, I don't know what you mean. Can you be more specific?

By Manuel

Ascended (17701)

Manuel's picture

10-06-2020, 15:47

iamweasel2 wrote:

What are the limits of using TCL scripts in openMSX? Is everything in TCL available ?

Depending on your installation, everything is available (e.g. on Linux) or only the Tcl functionality in libtcl (without supporting scripts) is available. The later is in the case of an openMSX build done with 'make staticbindist', currently the case for Windows, macOS, Android.

Quote:

For instance, can I use it to write a txt file with data?

Sure, that's already happening in many scripts that come with openMSX.

Quote:

Show a message on the emulated MSX screen?

Yes, for example, use osd::display_message "hi there" as you can see in many existing scripts.

Quote:

To play sounds with it (using the SDL API used in openMSX)?

No, the SDL API is not exposed to Tcl. SDL is considered an implementation detail from Tcl point of view.
And we have not made something available to produce sound.

Quote:

Is there some tutorial / book / whatever about using TCL in openMSX?

No, but you can study all the scripts that come with openMSX. That's quite a large amount of examples.
And you can ask here or on IRC. We'll be glad to help Smile

By Grauw

Ascended (9690)

Grauw's picture

10-06-2020, 16:03

Grauw wrote:

Yes, yes, no.

Sorry I was on my phone and got distracted. I was answering these:

"For instance, can I use it to write a txt file with data? Show a message on the emulated MSX screen? To play sounds with it (using the SDL API used in openMSX)?"

By iamweasel2

Paladin (678)

iamweasel2's picture

11-06-2020, 01:17

Thanks guys for your help.

By MsxKun

Paladin (968)

MsxKun's picture

25-03-2021, 13:07

Manuel wrote:

And we have not made something available to produce sound.

Why not? Sad I read a bit about commands, and it seems you can write to VDP registers but not to PSG registers?
Any other way that is not "typing" something like "SOUND Reg, Val"?

By Manuel

Ascended (17701)

Manuel's picture

25-03-2021, 13:47

That is of course possible. But the question was about playing sound via the sdl API, not via the emulated MSX.

By MsxKun

Paladin (968)

MsxKun's picture

25-03-2021, 15:21

Manuel wrote:

That is of course possible. But the question was about playing sound via the sdl API, not via the emulated MSX.

Good. Then how would it be the easier way to send a value to a PSG register?
Cause at the command reference I found:

- vdpreg Read or write a V99x8 register
and also
- v9990reg Read or write a V9990 register

but nothing like "PSGREG". Ony psg_log and doesn't seem what I want.

By Manuel

Ascended (17701)

Manuel's picture

25-03-2021, 17:00

You will neee to use the low level debug command. debug write PSG\ regs a v where a is the address and v the value.

By MsxKun

Paladin (968)

MsxKun's picture

25-03-2021, 17:41

Manuel wrote:

You will neee to use the low level debug command. debug write PSG\ regs a v where a is the address and v the value.

Thank you, it works! Smile