Jump to content
IGNORED

SpiceWare's Blog - Take 4


RSS Bot

Recommended Posts

Just discovered an obscure bug today! David Mrozek has been reviewing MM and was having a problem with the lower-right shield being flipped.

In this section of the code:

KernelGameBottomCode SUBROUTINE
	sta WSYNC
	cpy BLyOddRow	; 3  4
	php			  ; 3  7
	cpy M1yOddRow	; 3 10
	php			  ; 3 13
	cpy M0yOddRow	; 3 16
	php			  ; 3 19
	ldx #ENABL	   ; 2 21
	txs			  ; 2 22
	READ_TWO_PADDLES ;23 45
	ldx #8		   ; 2 47
	sta REFP1		; 3 50   <---- should have been stx REFP1
	ldx #0		   ; 2 52
	stx REFP0		; 3 55
	dey			  ; 2 57
	lda Player4X	 ; 3 60
	sec			  ; 2 62
	sta WSYNC		; 3 65

Just below the macro READ_TWO_PADDLES, the ldx #8, sta REFP1 should have been ldx #8, stx REFP1.

 

The macro READ_TWO_PADDLES is

		MAC READ_TWO_PADDLES
	ldx Paddles2Read  ; 21-23  3
	lda INPT0,x	   ; |	  4
	bpl .save1		; |	  2 3
	.byte $2c		 ; |	  4 0
.save1  sty Paddle1,x	 ; |	  0 4
	lda INPT2,x	   ; |	  4
	bpl .save2		; |	  2 3
	.byte $2c		 ; |	  4 0
.save2  sty Paddle3,x	 ; |	  0 4
					  ; +-23 worse case scenerio
	ENDM

 

so the last data value read into A would have been either INPT2 or INPT3 depending which 2 paddles were being read for the current frame (one frame reads paddles 0 & 2, the next frame reads paddles 1 & 3).

 

INPT2 and INPT3 only return a value in bit 7, the other bits are undefined, and as I understand it normally return the same bits as the address.

 

INPT2 = address $A, INPT3 = address $B $A=%00001010, $B = %00001011. The 8 used to flip the sprite = %00001000, so the "normally returns same bits as address" explains why it works for most people as the bit for 8 is turned on for both $A and $B.

 

Attached File(s)

 

bin.gif

mm20071129NTSC.bin ( 32K )

Number of downloads: 0

bin.gif

mm20071129PAL.bin ( 32K )

Number of downloads: 0

zip.gif

Medieval_Mayhem.zip ( 146.03K )

Number of downloads: 0

 

 

 

 

http://www.atariage.com/forums/index.php?a...;showentry=4184

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...