Giana Sisters STE - New Game!

All about ST/STE games

Moderators: simonsunnyboy, Mug UK, ICS, Doctor Bob Gordon, Moderator Team

Post Reply
User avatar
dma
Atari God
Atari God
Posts: 1168
Joined: Wed Nov 20, 2002 11:22 pm
Location: France
Contact:

Re: Giana Sisters STE - New Game!

Post by dma »

junosix wrote:How about pumping the tracker routine for the existing tune through the DMA chip? I've got a real soft spot for the ST version of the sampled music, I'd miss it if it was taken out!
In my humble opinion, the MOD version i posted is very close (probably even transcribed and extended) in composition terms, and the instruments are much better.
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

junosix wrote:The code I use isn't at all elegant and is probably a bit rubbish but it works well:

In the DATA section

Code: Select all

st_spl        dc.l        0
en_spl        dc.l        0

sound_1       incbin      sound_1.snd
sound_2       incbin      sound_2.snd
etc.

Then set up the sound effect with:

Code: Select all

move.l        #sound_1,st_spl
move.l        #sound_2,en_spl
bsr           do_snd
Which calls:

Code: Select all

do_snd:
move.b        #0,$ff8901         ; stop current playback

move.b        st_spl+1,$ff8903
move.b        st_spl+2,$ff8905
move.b        st_spl+3,$ff8907

move.b        en_spl+1,$ff890f
move.b        en_spl+2,$ff8911
move.b        en_spl+3,$ff8913

move.b        #1,$ff8901         ; play sample

rts
I tried this to but it crash immediately to. All works fine until I trigger the play with 1,$ff8901. It just reset without any bombs or anything.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
junosix
Captain Atari
Captain Atari
Posts: 348
Joined: Sun Jul 08, 2007 3:22 pm
Location: Plymouth

Re: Giana Sisters STE - New Game!

Post by junosix »

How weird! Have you set the sample replay rate and whether it's mono/stereo, etc.? The only issue I know is that the Falcon can't play 6.25kHz samples, but even then I think it just plays nothing rather than crashing.
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

junosix wrote:How weird! Have you set the sample replay rate and whether it's mono/stereo, etc.? The only issue I know is that the Falcon can't play 6.25kHz samples, but even then I think it just plays nothing rather than crashing.
Or the MFP interrupt triggers when the 1st sample is played ? If you didn't disable it or installed your own handler, then it's likely to call the TOS' one and crash.

Nicolas
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

I think it should be setup correct. This is also something that I have used before without any problems:

Code: Select all

;-------------------------------------------------------------------------;

setup_DMA_playback

	bsr	init_LMC1992

	move.w	#%0000000010000001,$ffff8920	;12khz

	clr.b	$fffa1b
	bset	#0,$fffa07
	bset	#0,$fffa13
	bclr	#5,$fffa15

	rts
	
;-------------------------------------------------------------------------;

set_LMC1992
	move.w	sr,-(sp)		
	move.w	#$2700,sr			;interrupts off during start of operation
	move.w	#%11111111111,$ffff8924.w	;set microwire mask
	move.w	d0,$ffff8922.w
waitstart
	cmpi.w	#%11111111111,$ffff8924.w	;wait for microwire write to start
	beq.s	waitstart
	move.w	(sp)+,sr
waitend	cmpi.w	#%11111111111,$ffff8924.w	;wait for microwire 
	bne.s	waitend				;write to finish
	rts

init_LMC1992
	move.l	d0,-(sp)
	move.w	#%10000000001,d0	;mix DMA+YM equally
	bsr.s	set_LMC1992
	move.w	#%10001000110,d0	;+0db bass
	bsr.s	set_LMC1992
	move.w	#%10010000110,d0	;+0db treble
	bsr.s	set_LMC1992
	move.w	#%10011101000,d0	;-0db master volume
	bsr.s	set_LMC1992
	move.w	#%10100010100,d0	;-0db right
	bsr.s	set_LMC1992
	move.w	#%10101010100,d0	;-0db left
	bsr.s	set_LMC1992
	move.l	(sp)+,d0
	rts
Or the MFP interrupt triggers when the 1st sample is played ? If you didn't disable it or installed your own handler, then it's likely to call the TOS' one and crash.
TOS is probably not doing anything since the game runs outside TOS. I have not full control of all interrupts since the original code is rather messy.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

dma wrote:
junosix wrote:How about pumping the tracker routine for the existing tune through the DMA chip? I've got a real soft spot for the ST version of the sampled music, I'd miss it if it was taken out!
In my humble opinion, the MOD version i posted is very close (probably even transcribed and extended) in composition terms, and the instruments are much better.
The MOD file you suggested, as well as other MOD remixes for Great Giana Sisters can be found here :

http://modarchive.org/index.php?request ... _songtitle
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

Zamuel_a wrote: clr.b $fffa1b
bset #0,$fffa07
bset #0,$fffa13
bclr #5,$fffa15

TOS is probably not doing anything since the game runs outside TOS. I have not full control of all interrupts since the original code is rather messy.
TOS is certainly doing nothing during game, but if STE DMA sound triggers an MFP interrupt, it will call vector at $134 (timer A / STE sound) and/or vector at $13c (GPIP 7). Under normal conditions, these 2 vectors will point in the ROM, and the ROM code might expects some memory location around $400-$1000 to contain some specific values which are not here because the game cleaned the memory.

So, I would suggest to first add "clr.b $fffa07 + clr.b $fffa09" (clear interrupt enable A/B), and then to some bset only for the interrupts you will really use, else you don't know what values were enabled before the game started and what interrupt can trigger for some STE events.

Nicolas
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

Didn't help. Seems not so easy to make that work. I have updated the version here anyway so the music should be at the right pitch
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

There are MFP calls in the code but I'm not sure when they trigger, but it must be possible to use interrupts together with the DMA sound. Would be rather useless otherwise.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

Zamuel_a wrote:There are MFP calls in the code but I'm not sure when they trigger, but it must be possible to use interrupts together with the DMA sound. Would be rather useless otherwise.
It's possible, but you must use your own handler in that case, TOS default's one might not be compatible with the state of the game.
Can you try this at start :

Code: Select all

lea int_null,a0
move.l a0,$134
move.l a0,$13c
...

int_null:
rte
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

At start of the game? It crashed anyway. But all MFP interrupts are set by the game later on, so whatever I do at start will be changed later on.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

Can you give a link to the version that crashes, with only STE sound added ?
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

Here is a version that crash. Only the jump sound is implemented so as soon as you jump it will crash. I could hear the actual jump sample so it did play it, but half a second later it crashed.
Last edited by Zamuel_a on Tue Apr 22, 2014 7:41 pm, edited 1 time in total.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

Zamuel_a wrote:Here is a version that crash. Only the jump sound is implemented so as soon as you jump it will crash. I could hear the actual jump sample so it did play it, but half a second later it crashed.
I see the problem, it's related to the interrupt generated by DMA sound when a sample was played, by setting bit 7 of GPIP in $FFFA01.
I guess you installed you own VBL handler for STE specific changes, then call original VBL at $F01F4 :

Code: Select all

cpu video_cyc=   724 212@  1 : $17b4a0 : 13f9 0017 93bd ffff 8205             move.b    $1793bd,$ffff8205
cpu video_cyc=   752 240@  1 : $17b4aa : 13f9 0017 93be ffff 8207             move.b    $1793be,$ffff8207
cpu video_cyc=   780 268@  1 : $17b4b4 : 13f9 0017 93bf ffff 8209             move.b    $1793bf,$ffff8209
cpu video_cyc=   808 296@  1 : $17b4be : 0c39 0000 0017 93b1                  cmpi.b    #0,$1793b1
cpu video_cyc=   828 316@  1 : $17b4c6 : 660c                                 bne.s     $17b4d4
cpu video_cyc=   840 328@  1 : $17b4d4 : 13fc 0000 0017 93b3                  move.b    #0,$1793b3
cpu video_cyc=   860 348@  1 : $17b4dc : 46fc 2300                            move      #$2300,sr

cpu video_cyc=   876 364@  1 : $17b4e0 : 4ef9 000f 01f4                       jmp       $f01f4
cpu video_cyc=   888 376@  1 : $0f01f4 : 0838 0007 fa01                       btst      #7,$fffffa01.w
mfp read gpip fa01=0x7f video_cyc=888 376@1 pc=f01f4 instr_cycle 16
cpu video_cyc=   908 396@  1 : $0f01fa : 6606                                 bne.s     $f0202
EndLine TB 1 video_cyc=916 line_cyc=404 pending_int_cnt=4
cpu video_cyc=   916 404@  1 : $0f01fc : 2078 0004                            movea.l   $0004.w,a0
cpu video_cyc=   932 420@  1 : $0f0200 : 4ed0                                 jmp       (a0)
cpu video_cyc=   940 428@  1 : $e00030 : 46fc 2700                            move      #$2700,sr
cpu video_cyc=   956 444@  1 : $e00034 : 4e70                                 reset
As you can see, the original VBL checks bit 7 of FFA01 and will reset the ST if it's not set. Why is that ? Because bit 7 is used for STE DMA sound, but it's also primarily used to detect that a monochrome monitor was plugged. If the game detects a monochrome monitor, it will reset.
Change this code :

Code: Select all

$0f01f4 : 0838 0007 fa01                       btst      #7,$fffffa01.w
$0f01fa : 6606                                 bne.s     $f0202
$0f01fc : 2078 0004                            movea.l   $0004.w,a0
$0f0200 : 4ed0                                 jmp       (a0)
$0f0202 : 2038 0020                            move.l    $0020.w,d0
$0f0206 : 6714                                 beq.s     $f021c
$0f0208 : 2040                                 movea.l   d0,a0
Replace "6606" at $f01fa by "6006" (bra.s $f0202) and this should fix STE sound causing a reset :D

Nicolas
junosix
Captain Atari
Captain Atari
Posts: 348
Joined: Sun Jul 08, 2007 3:22 pm
Location: Plymouth

Re: Giana Sisters STE - New Game!

Post by junosix »

It does seem to play the entire sample before resetting and the DMA audio chip generates a Timer A interrupt when it stops playing a sample so it probably is that. http://atari-ste.anvil-soft.com/html/devdocu4.htm mentions waiting a few cycles after playing a sound otherwise it can mess with the shifter. Would it be fairly straightforward to put the playback routine just before the waitvbl?
junosix
Captain Atari
Captain Atari
Posts: 348
Joined: Sun Jul 08, 2007 3:22 pm
Location: Plymouth

Re: Giana Sisters STE - New Game!

Post by junosix »

Nice one npomarede!
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

That worked! Thanks for the help! Now I can start to implement some samples! :D
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

Zamuel_a wrote:That worked! Thanks for the help! Now I can start to implement some samples! :D
This fast debugging was courtesy of Hatari, the Atari ST/Falcon emulator :)
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

I have implemented the Amiga samples and it works, but the sound volume between the samples and the YM chip is very different. It's very hard to hear the samples now since they are much lower than the YM chip. Is there a way to lower the volume of the YM chip? In Pacmania I did a fix by subtracting a value to each channel. If I must do the same here (and try to find were the data for each channel might be) or if there is a better way.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
junosix
Captain Atari
Captain Atari
Posts: 348
Joined: Sun Jul 08, 2007 3:22 pm
Location: Plymouth

Re: Giana Sisters STE - New Game!

Post by junosix »

You should be able to control the mix via the microwire interface and not have to touch the YM regs: http://alive.atari.org/alive11/mcrowire.php
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

Zamuel_a wrote:I have implemented the Amiga samples and it works, but the sound volume between the samples and the YM chip is very different. It's very hard to hear the samples now since they are much lower than the YM chip. Is there a way to lower the volume of the YM chip? In Pacmania I did a fix by subtracting a value to each channel. If I must do the same here (and try to find were the data for each channel might be) or if there is a better way.
I don't think that's a good idea to lower the volume register as it can alter the result, maybe you should try to boost the samples' volume using a wave editor (Audacity) or increase the samples' volume with the microwire interface.
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

I think all samples are already at max volume and also the microwire. The YM and DMA sound volume don't match up so good.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
User avatar
npomarede
Atari God
Atari God
Posts: 1354
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Giana Sisters STE - New Game!

Post by npomarede »

Zamuel_a wrote:I think all samples are already at max volume and also the microwire. The YM and DMA sound volume don't match up so good.
Did you try changing the mixing method from 1 to 0 ? It should lower the YM volume

Code: Select all

   move.w   #%10000000001,d0   ;mix DMA+YM equally
becomes
   move.w   #%10000000000,d0   ;mix DMA + YM-12dB
Note that even if all samples are using maximum amplitude (bytes from -128 to +127), you can still boost the volume with some WAV editor, it will "compress" bytes toward -128 and +127, which will give a feeling of a "louder" sound (but this slightly alter the sample quality)
junosix
Captain Atari
Captain Atari
Posts: 348
Joined: Sun Jul 08, 2007 3:22 pm
Location: Plymouth

Re: Giana Sisters STE - New Game!

Post by junosix »

The samples are already at a good volume level so changing the YM + DMA mix via the microwire should help, it would be a shame to stick extra compression on, but I can if all else fails.
Zamuel_a
Atari God
Atari God
Posts: 1243
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Giana Sisters STE - New Game!

Post by Zamuel_a »

npomarede wrote:
Zamuel_a wrote:I think all samples are already at max volume and also the microwire. The YM and DMA sound volume don't match up so good.
Did you try changing the mixing method from 1 to 0 ? It should lower the YM volume

Code: Select all

   move.w   #%10000000001,d0   ;mix DMA+YM equally
becomes
   move.w   #%10000000000,d0   ;mix DMA + YM-12dB
Note that even if all samples are using maximum amplitude (bytes from -128 to +127), you can still boost the volume with some WAV editor, it will "compress" bytes toward -128 and +127, which will give a feeling of a "louder" sound (but this slightly alter the sample quality)
No I have not tried that so will test!
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe
Post Reply

Return to “Games - General”