Calling Basic routines from ASM

Page 1/2
| 2

By iamweasel2

Hero (650)

iamweasel2's picture

30-10-2020, 17:09

Hello,

I'm looking for a tutorial or an example of how to call MSX Basic routines from an ASM code. I would like to be able to use the graphics and sound routines Basic has from my ASM code.

Can anyone point me to some material about it or maybe give me an example of how to call a basic function from ASM?

Login or register to post comments

By Manel46

Hero (601)

Manel46's picture

30-10-2020, 17:52

By iamweasel2

Hero (650)

iamweasel2's picture

30-10-2020, 19:00

Manel46 wrote:

I don't know if this works for you
https://www.msx.org/forum/msx-talk/development/msx-basic-array-to-asm

It does help, Manel, there's a link to some Basic routines (https://www.msx.org/wiki/BASIC_Routines_In_Main-ROM), thanks. :)

I saw that this link however doesn't contain all MSX BASIC functions. I was wondering, there's a list with the entry points and parameters of the other MSX functions ( like Circle, LINE, PLAY etc) ?

By iamweasel2

Hero (650)

iamweasel2's picture

30-10-2020, 19:08

I managed to get this (ugly) example of using play through an ASM code working here:

PLAY: EQU 0x73E5

org 0xD000

start:

ld hl,buffer
call PLAY
ret

buffer: db 34,"CDE",34,44,34,"dfg",34,0

end start

I was wondering, there are other code snippets showing how to call MSX Basic routines ?

By iamweasel2

Hero (650)

iamweasel2's picture

30-10-2020, 19:34

Another question, using basic routines when doing ASM code is something that can be done without any problem or there may be any problem doing that? I ask because it seems to me that there are a good number of routines that can be used there.

By Grauw

Ascended (9397)

Grauw's picture

30-10-2020, 22:00

iamweasel2 wrote:

PLAY: EQU 0x73E5

You should thoroughly test such addresses in the middle of the BASIC ROM on all machines of all generations. These are not standardised entry points. I would personally not use them.

By wolf_

Ambassador_ (9826)

wolf_'s picture

30-10-2020, 22:38

iamweasel2 wrote:

I managed to get this (ugly) example of using play through an ASM code working here:

PLAY: EQU 0x73E5

org 0xD000

start:

ld hl,buffer
call PLAY
ret

buffer: db 34,"CDE",34,44,34,"dfg",34,0

end start

I wonder, does this mean that interrupts are to be disabled, and asm waits for the buffer to be done playing? Because it's not like this would be the way to play music behind a game, I think. It'd have to be more like just filling sound registers at each interrupt. E.g. you could have music in basic playing along with your sprite movements if, at each ON INTERVAL, you fill the sound registers with new values (if required).

By Grauw

Ascended (9397)

Grauw's picture

30-10-2020, 23:56

BASIC has pretty sizable play queues in system memory which it plays from on the interrupt independently. It is a shame this is not exposed through the BIOS though.

By iamweasel2

Hero (650)

iamweasel2's picture

31-10-2020, 01:31

Grauw wrote:
iamweasel2 wrote:

PLAY: EQU 0x73E5

You should thoroughly test such addresses in the middle of the BASIC ROM on all machines of all generations. These are not standardised entry points. I would personally not use them.

I thought Microsoft provided only the basic binary to manufacturers. Are you saying that they got the sources and could recompile it (do some modifications)? I didn't know that.

Anyway, this is just for fun. If it get serious, I'll of course replace this play call with a better solution.

By Manel46

Hero (601)

Manel46's picture

31-10-2020, 15:01

By iamweasel2

Hero (650)

iamweasel2's picture

31-10-2020, 15:55

Manel46 wrote:

I found this:
https://www.msx.org/es/forum/debates-en-espanol/desarrollo/e...
But it is in Spanish.

What an amazing link ! Thanks a LOT Manel46, it helped me a LOT ! :)

Page 1/2
| 2