Re: [stella] behold, i am become shiva, destroyer of kernals!

Subject: Re: [stella] behold, i am become shiva, destroyer of kernals!
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Fri, 12 Mar 2004 02:41:02 -0500
Got it!

This is a freaky one folks, lissen up...

The problem is:


Specifically, you're setting the stack pointer to ENAM1-1 (Which is ENAM1) you execute a PHP in order to setup a skipdraw on the missile.

If you replace the PHP with a PLA, the problem disappears (The value put in A from the stack is unused discarded almost immediately in the ensuing code).

I also still had an earlier version with the big kernal problems and when I replaced the PHP in the main kernal, the problem ALSO went away there too.

I'm not 100% sure why this happens. The most obvious is that doing a PHP when the stack pointer is pointing at ENAM0 results in a different value being loaded into the Flags register on a Supercharger than in z26. So in effect your flags are getting munged. It doesn't look like this should have such a disasterous effect:

	pla ;plp                          ; 4 
	cpx slowBallYCoordFromBot+1           ; 3
	php                          ; 3 

	; set up playfield index
	txa                          ; 2
	lsr                          ; 2

	sta COLUPF;......3

That looks pretty harmless, at worst the ball should show up on the wrong scanlines... 

However that is where the problem lies and in a way it makes sence - It implies that loading a value from a TIA register (or even just that TIA register) results in a different value in z26 (presumably 0) and on a real machine (or even just a real machine + Supercharger) which is very reasonable. Hell, you could be triggering some weird side effect too. I don't know and I'm too tired to pursue it further - Maybe shoving those flags back onto the stack at ENAM1 is causing some other problem? Triggering Supercharger RAM  and overwiriting your program code somewhere springs to mind. Or maybe other TIA register somehow get overwritten? I dunno.

At any rate, replacing the two PHP instructions with PLA should solve all these problems, permanently (knock wood).

The other problems, well, I need some sleep...


Archives (includes files) at
Unsub & more at

Current Thread