This page details bugs of Super Mario Bros./es.
Spiny Egg Bug#
Así es como se calcula y guarda la velocidad de los huevos de spiny (eso sonó mal).
DifLoop: lda PRDiffAdjustData,y ;get three values and save them
sta $01,x ;to $01-$03
iny
iny ;increment Y four bytes for each value
iny
iny
dex ;decrement X for each one
bpl DifLoop ;loop until all three are written
ldx ObjectOffset ;get enemy object buffer offset
jsr PlayerLakituDiff ;move enemy, change direction, get value - difference
ldy Player_X_Speed ;check player's horizontal speed
cpy #$08
bcs SetSpSpd ;if moving faster than a certain amount, branch elsewhere
tay ;otherwise save value in A to Y for now
lda PseudoRandomBitReg+1,x
and #%00000011 ;get one of the LSFR parts and save the 2 LSB
beq UsePosv ;branch if neither bits are set
tya
eor #%11111111 ;otherwise get two's compliment of Y
tay
iny
UsePosv: tya ;put value from A in Y back to A A=SpeedVar
SetSpSpd: jsr SmallBBox ;set bounding box control, etc. A=SpeedVar
...
Todo bien hasta ahora. El registro A guarda la velocidad apropiada.
SmallBBox: lda #$09 ;set specific bounding box size control A=09
bne SetBBox ;unconditional branch A=09
Ups, saltar hacia la subrutina de la bounding box sobreescribio A! Todo ese trabajo para nada.
SetBBox: sta Enemy_BoundBoxCtrl,x ;set bounding box control here A=09
lda #$02 ;set moving direction for left A=02
sta Enemy_MovingDir,x A=02
InitVStf: lda #$00 ;initialize vertical speed A=00
sta Enemy_Y_Speed,x ;and movement force A=00
sta Enemy_Y_MoveForce,x A=00
rts A=00
Ahora A termina con el valor 00. El juego regresa a la subrutina de SetSpSpd...
...
ldy #$02 ;Set Y to 02 (Leftwards) A=00
sta Enemy_X_Speed,x ;Set Spiny egg speed to A (00) A=00
cmp #$00 ;Now check if speed is negative... A=00
bmi SpinyRte ;...but A is always 00. No branch. A=00
dey ;Set Y to 01 (Rightwards)
SpinyRte: sty Enemy_MovingDir,x ;Set moving direction.
...Y la velocidad se pone en 0. La dirección de movimiento se pone a la derecha, pero como el huevo no posee movimiento horizontal y la dirección se reinicia cada vez que spawnea un spiny, esto no significa mucho.
Para arreglar este bug, simplemente mueve la "jsr SmallBBox" antes del dey opcode, lo que hace lo siguiente:
Download Spiny Egg Speed Patch File: SMBSpinyEggPatch.ips (25 B) (info) |
(Source: Desmontaje (SMBDis) de doppelganger)