ayFX + Moonblaster replayers

Page 1/2
| 2

By Manel46

Champion (489)

Manel46's picture

05-12-2019, 01:05

We are developing a ROM game for V9990 which supports different soundchips and we have an small
issue while playing FX in PSG with the ayFX 1.31 replayer by Z80ST software:

http://www.z80st.es/downloads/code/

When FX sounds are played with the Moonblaster 1.4 replayer no problem but with the Moonblaster
for Moonsound replayer, same FX sounds are played faster (they sound like a higher pitch effect).

Any ideas?

Thank you in advance.

Login or register to post comments

By jltursan

Prophet (2227)

jltursan's picture

05-12-2019, 10:19

ayFX replayer only overwrites the PSG registers RAM buffer (usually AYREGS) every frame...if you call it every frame, of course; so it doesn't have anything to do with the playing frequency in itself, it works faster if you call it faster.

Are you calling the ayfx frame subroutine tied with HTIMI or using any other way that will give you always a fixed frequency?, maybe the Moonsound cart generates its own interrupts and you're being affected by this, no idea about this hardware and replayer...

By Grauw

Ascended (8621)

Grauw's picture

05-12-2019, 11:26

The later versions of MoonBlaster Wave (and associated replayer) have the option to use the OPL4’s timer rather than the vertical blanking. But for games it’s generally more convenient to play on the vblank interrupt, that way the CPU usage is more predictable.

By Manel46

Champion (489)

Manel46's picture

05-12-2019, 13:03

Yes, the FX are played in the interrupt routine, in addition to FM or OPL4. I use "IM 1".

 call PT3_ROUT
 call ayFX_PLAY
 LD A,(MOPL4) ;OPL4?
 OR A
 JR Z,MBLASTER
 CALL HOOK2 ;#FD9A
 JR SSALTA
MBLASTER
 CALL HOOK  ;#FD9F
SSALTA

By jltursan

Prophet (2227)

jltursan's picture

05-12-2019, 14:21

Are you trying to fully replace the interrupt routine?, can't understand this piece of code but if it's so, the ayFX code will be executed at, most probably, faster frequency than the one from vblank.

By Manel46

Champion (489)

Manel46's picture

05-12-2019, 14:38

jltursan wrote:

ayFX it works faster if you call it faster.

What you say is the solution. I can shorten the slower FX, the one that sounds with moonblaster, called twice to ayFX_PLAY on each vblank, but not lengthen the fast, which goes with opl4. I've tried calling it every two interruptions or more, but it sounds the same
Thank you very much.

By Manel46

Champion (489)

Manel46's picture

05-12-2019, 15:05

Yes, it is a special interruption routine. I do not use bios, so I have the p0 of ram for the players, which are always present, and especially that of olp4 is quite heavy.

isr_set:
 		di
		ld	hl,0x0038
		ld	(hl),0xC3
		inc	hl
		ld	(hl),low rutina
		inc	hl
		ld	(hl),high rutina
		ei
		ret

rutina:
		di
		push	af
 		in	a,(0x99)
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;  VBLANK
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	
vblank:

		push   hl         
		push   de         
		push   bc         
		exx               
		ex     af,af'     
		push   hl         
		push   de         
		push   bc         
		push   af         
		push   iy         
		push   ix 
 call PT3_ROUT
 LD A,(MOPL4) ;OPL4?
 OR A
 JR Z,MBLASTER
 call ayFX_PLAY 
 CALL HOOK2 ;#FD9A
 JR SSALTA
MBLASTER
[2] call ayFX_PLAY
 CALL HOOK  ;#FD9F
SSALTA
		pop    ix         
		pop    iy         
		pop    af         
		pop    bc         
		pop    de         
		pop    hl         
		ex     af,af'     
		exx               
		pop    bc         
		pop    de         
		pop    hl         
		pop	af
		ei
		RETI

I have changed according to what I say. So I have similar times. for both players.

By Manel46

Champion (489)

Manel46's picture

05-12-2019, 15:09

I use the two hooks, since each player is located in one of them.
I could call them directly, to simplify.

By jltursan

Prophet (2227)

jltursan's picture

05-12-2019, 16:06

Ok, I see. Glad to hear you found a solution Smile

By Manel46

Champion (489)

Manel46's picture

05-12-2019, 16:45

Thanks friend!

By ARTRAG

Enlighted (6323)

ARTRAG's picture

05-12-2019, 20:37

Manel46 wrote:

I use the two hooks, since each player is located in one of them.
I could call them directly, to simplify.

You can move the call to PT3_ROUT lower close to the ayfxplayer or it will be called even when no changes in the registers occur

Page 1/2
| 2