Sprite sorting
Moderator: Stef
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
Did you try to run with the "debug" library to see if some errors were thrown (allocation or stuff like that) at some point ?
Also when did these exceptions happened ? After several minutes of gameplay ? or it can happen quite quickly ?
Also when did these exceptions happened ? After several minutes of gameplay ? or it can happen quite quickly ?
Re: Sprite sorting
Unfortunately I only get these kind of errors on real hardware. Don't think I ever saw it in any emulator nor on the retroad machine.
When it happens can be really random. I can play the game for hours without it happening but sometimes it can happen just after a few minutes.
When it happens can be really random. I can play the game for hours without it happening but sometimes it can happen just after a few minutes.
Tänzer kickstarter: https://www.kickstarter.com/projects/83 ... lusive-gam
https://twitter.com/mix256
https://twitter.com/mix256
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
You may try to play a long time with Gens KMod in debug mode maintaining the output message dialog open, just to see if some warnings or errors happen from time to time (that doesn't necessary end to an exception). If absolutely no log appears after playing one or several hours then it will be quite difficult to track the bug :-/
Re: Sprite sorting
Had quite a long session in gens kmod yesterday, running a debug build. But the error didn't happen. I will try some more tonight.
Tänzer kickstarter: https://www.kickstarter.com/projects/83 ... lusive-gam
https://twitter.com/mix256
https://twitter.com/mix256
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
i hope you will be able to have at least some information from the debug lib in GensKMod, otherwise you (we) will have a hard time in finding the source of the bug ^^
Re: Sprite sorting
I've been running several long runs in genskmod the last couple of days without getting any kind of error. On a real megadrive it can happen at any time. Seems like there could be an mem-init issue? Like I've forgotten to initialize a variable that should be zero. Gets a random value on real hw but is zero in emulators?
Any input regarding this is hilghly appreciated.
Any input regarding this is hilghly appreciated.
Tänzer kickstarter: https://www.kickstarter.com/projects/83 ... lusive-gam
https://twitter.com/mix256
https://twitter.com/mix256
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
This can be the reason but it can also be timing differences between the emulator and real hardware which lead to some weird issues like that.
Something you can try eventually is too comment the RAM initialization code from SGDK sega.s file :
but i wonder if some parts of SGDK relies on having ram cleared... still that is something you can try.
You may eventually try to turn this flag ON in the config.h file from the library (son't forget to recompile the lib then) :
This is to force Z80 halt during DMA. To be honest it would be better to avoid it but you can try that to see if it does any difference.
By the way, what kind of cart are you using to test your code ?
Something you can try eventually is too comment the RAM initialization code from SGDK sega.s file :
Code: Select all
ClearRam:
* move.l %d0,(%a0)+
You may eventually try to turn this flag ON in the config.h file from the library (son't forget to recompile the lib then) :
Code: Select all
#define HALT_Z80_ON_DMA 1
By the way, what kind of cart are you using to test your code ?
Re: Sprite sorting
Thanks! I hex edited with NOPs in the clear ram loop and have a release build running here at work now.
Could the rom file have "random" values if .text have variables that is not initialized?
I was thinking that I have some variables in .text that isn't set properly, that would be in the "copy initialized variables from ROM to Work RAM" part, right. Or are these always zeroes?
Will try the HALT_Z80_ON_DMA when I get back home.
Could the rom file have "random" values if .text have variables that is not initialized?
I was thinking that I have some variables in .text that isn't set properly, that would be in the "copy initialized variables from ROM to Work RAM" part, right. Or are these always zeroes?
Will try the HALT_Z80_ON_DMA when I get back home.
Tänzer kickstarter: https://www.kickstarter.com/projects/83 ... lusive-gam
https://twitter.com/mix256
https://twitter.com/mix256
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
Normally variables in .text section should be properly initialized, i think it would be helpful to try to randomize the RAM and test on emulator to see if it does any difference (having the clear RAM doing randomize RAM instead or something like that ^^).
Re: Sprite sorting
All sorts of strange behaviors when setting "randomizing" the ram. My gamepad input reading goes bonkers.
Perfect test. Thanks!
Perfect test. Thanks!
Tänzer kickstarter: https://www.kickstarter.com/projects/83 ... lusive-gam
https://twitter.com/mix256
https://twitter.com/mix256
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
Did you randomized the RAM at the same location as clearRAM loop in the sega.s file ? it's important to keep it here (otherwise you can erase some internals variables). Weird that your gamepad reading goes wrong, maybe there is some uninitialized vars in there.
Re: Sprite sorting
Yep, I just started D0 with 0x011111111 and increased it for each iteration in the loop.
And yes, there were uninitialized vars in my input handling and also at a few other places.
Still won't help me track down the strange bug. But at least the code is nicer now.
Also I didn't try with the HALT_Z80_ON_DMA, will do that tonight. This will affect the music playback somehow, I reckon?
Thanks!
And yes, there were uninitialized vars in my input handling and also at a few other places.
Still won't help me track down the strange bug. But at least the code is nicer now.
Also I didn't try with the HALT_Z80_ON_DMA, will do that tonight. This will affect the music playback somehow, I reckon?
Thanks!
Tänzer kickstarter: https://www.kickstarter.com/projects/83 ... lusive-gam
https://twitter.com/mix256
https://twitter.com/mix256
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
Yeah enabling this flag will degrade PCM playback quality definitely, it's why it would be better to avoid using it but you can test to see if it makes any difference. About RAM randomization, i may eventually do it by default in SGDK to help in spotting "unitialized variable" bug
Re: Sprite sorting
If it would turn out to be more stable with the HALT_Z80_ON_DMA flag, what would I then do?
Tänzer kickstarter: https://www.kickstarter.com/projects/83 ... lusive-gam
https://twitter.com/mix256
https://twitter.com/mix256
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sprite sorting
Pry so it won't happen :p
No if that is really the case then we need to understand why and how to sort it without using this flag
No if that is really the case then we need to understand why and how to sort it without using this flag