[SMS] Mono sprites snail trail problem

Post Reply
User avatar
RobertK
Well known member
Posts: 346
Joined: Mon Feb 26, 2018 12:58 pm

[SMS] Mono sprites snail trail problem

Post by RobertK »

I am now able to test .sms files on real Master System hardware.

In my game Deepspace, the spaceship leaves a snail trail behind it, similar to the one we had on the Agon light, only a bit more ragged.

2023-11-17_SMS_Deepspace.jpg
Any idea what could be wrong here? In the Fusion emulator, everything looks fine.
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 2014
Joined: Sun Jul 15, 2007 10:01 pm

Re: [SMS] Mono sprites snail trail problem

Post by dom »

My hunch is VDP timing. I thought we'd squished all the problems, but some may have got through.

There is an emulator that reports VDP timing problems, but I've forgotten the name of it at the moment - if the game is run in that emulator with reporting enabled that should confirm it.
Timmy
Well known member
Posts: 356
Joined: Sat Mar 10, 2012 4:18 pm

Re: [SMS] Mono sprites snail trail problem

Post by Timmy »

If I remember from my MSX games, is that its VDP (and therefore also the SMS one) has problems if you are OUTing data too fast.

The trick I did on the MSX is to have some extra T-states between each OUT so that the VDP has time to recover.

I don't know how it works with the SMS, but people who ported my Heart Stealer 2 from MSX to SMS (without permission though, like many other MSXDev games) didn't had much problems with it.
stefano
Well known member
Posts: 2079
Joined: Mon Jul 16, 2007 7:39 pm

Re: [SMS] Mono sprites snail trail problem

Post by stefano »

I agree, I was betting on the VDP transfers concurrently with you. :). Having a real hardware to test on is always of great help, though. Do you think we can do some trial and error with Robert?
Timmy
Well known member
Posts: 356
Joined: Sat Mar 10, 2012 4:18 pm

Re: [SMS] Mono sprites snail trail problem

Post by Timmy »

As an inspiration, I'm currently looking at my own MSX library, and here are two functions from it:

Code: Select all

uchar __FASTCALL__ vdp_read(uchar reg)
{
	// h = register, l = value
	#asm
		ld a, l
		di
		out ($99), a
		ld a, 15+128
		out ($99), a

		ld a, (de)		; wait 7 t-states
		in a, ($99)
		ld l, a			; store return value in hl
		xor a
		ld h, a
		out ($99), a
		ld a, 15+128
		ei
		out ($99),a
	#endasm
}

void __CALLEE__ vpoke(int address, uchar value)
{
	#asm
		pop ix
		pop bc	; c = value
		pop hl	; hl = vram address
		push ix
		
		ld	a,l
		di
		out	($99), a
		ld	a,h
		and	63
		or 	64
		ei
		out	($99), a
		
		ld a, c
		out	($98), a
	#endasm
}
I can't remember much of it any more, but there seems to be dedicated wait instructions in there, according to my own comments. :)

Note: These are MSX routines and the port numbers for the SMS are different.
Note: These are code before the naked changes to __FASTCALL__ so remember to update them for the current z88dk version.
User avatar
RobertK
Well known member
Posts: 346
Joined: Mon Feb 26, 2018 12:58 pm

Re: [SMS] Mono sprites snail trail problem

Post by RobertK »

stefano wrote: Sat Nov 18, 2023 1:01 pm I agree, I was betting on the VDP transfers concurrently with you. :). Having a real hardware to test on is always of great help, though. Do you think we can do some trial and error with Robert?
Sure, I am ready to do trial-and-error testing until we get it working.

@SMS owners: search for "DIY 600 in 1" on AliExpress.
User avatar
dom
Well known member
Posts: 2014
Joined: Sun Jul 15, 2007 10:01 pm

Re: [SMS] Mono sprites snail trail problem

Post by dom »

It's Emulicious that reports issues - it also reads .map files which makes for a very comfortable debugging experience.

As an added bonus it's also showing graphical artefacts.
User avatar
dom
Well known member
Posts: 2014
Joined: Sun Jul 15, 2007 10:01 pm

Re: [SMS] Mono sprites snail trail problem

Post by dom »

And, I've now pushed a fix for the timing errors reported - I think that's actually a very big recommendation for using Emulicious as an emulator.
stefano
Well known member
Posts: 2079
Joined: Mon Jul 16, 2007 7:39 pm

Re: [SMS] Mono sprites snail trail problem

Post by stefano »

Black belt confirmed, Dom. You're getting so fast in fixing.. everything?
User avatar
RobertK
Well known member
Posts: 346
Joined: Mon Feb 26, 2018 12:58 pm

Re: [SMS] Mono sprites snail trail problem

Post by RobertK »

Problem fixed, thanks Dom!
2023-11-19_SMS_Deepspace.jpg
dom wrote: Sat Nov 18, 2023 8:10 pm I think that's actually a very big recommendation for using Emulicious as an emulator.
Agreed, it was reproducing the problem exactly as on the original hardware!
You do not have the required permissions to view the files attached to this post.
Post Reply