Log in

View Full Version : Super Mario Bros. - Spiny Egg Intended Behavior



ColecoFan1981
03-03-2015, 04:04 PM
Has anyone here been aware that the Spiny Egg movement in the NES version of Super Mario Brothers is not as intended? The link below will tell.

Link about this:
https://tcrf.net/Talk:Super_Mario_Bros.#Spiny_Egg_Horizontal_Moveme nt

What we got:


DifLoop: lda PRDiffAdjustData,y
sta $01,x
iny
iny
iny
iny
dex
bpl DifLoop
ldx ObjectOffset
jsr PlayerLakituDiff
ldy Player_X_Speed
cpy #$08
bcs SetSpSpd
tay
lda PseudoRandomBitReg+1,x
and #$03
beq UsePosv
tya
eor #$ff
tay
iny
UsePosv: tya
SetSpSpd: jsr SmallBBox
ldy #$02
sta Enemy_X_Speed,x
cmp #$00
bmi SpinyRte
dey


What should have been:



SetSpSpd: ldy #$02
sta Enemy_X_Speed,x
cmp #$00
bmi SpinyRte
dey
SpinyRte: jsr SmallBBox


Move the jsr instruction to below the dey instruction, and the movement will be as intended.

This same fix can also be applied to these other SMB variations:
Super Mario Bros. (FDS)
Super Mario Bros. 2 (Japan) (FDS)
All-Night Nippon Super Mario Bros. (FDS)
Vs. Super Mario Bros.
(Please note the offsets for the SetSpSpd instruction will be different for these versions than the NES cartridge version, which is at offset 0x4444 when using a hex editing program like Hexecute or Hex Workshop.)

~Ben

JohnnyA
03-04-2015, 08:04 AM
I would be very interested to see a before and after video of the behavior, as it's hard for me to picture how the behavior would change from just the description. Neat nonetheless.

Graham Mitchell
03-04-2015, 11:03 AM
I would be very interested to see a before and after video of the behavior, as it's hard for me to picture how the behavior would change from just the description. Neat nonetheless.

It sounds like they're supposed to bounce before turning into a spiny. Pretty interesting!

The page also talks about an alternate ground theme music that Koji Kondo has alluded to in interviews. I'd like to hear that as well.

ColecoFan1981
03-04-2015, 02:48 PM
Here's an "after" video:
https://www.youtube.com/watch?v=b-jwlt24NLo

~Ben

Tanooki
03-04-2015, 03:46 PM
I wondered what this was all about as code means nothing to me. That would have made the game quite a bit harder than probably even necessary so I can see why they left it out. I'm more surprised as downright ugly as the FDS SMB2 was they didn't include it in there.

Graham Mitchell
03-04-2015, 04:00 PM
Wow, looks like it would've been more challenging. I'd like to patch it into vs smb and try it.

ColecoFan1981
03-04-2015, 09:46 PM
On the side, here's a recently uncovered SMB glitch: you have to beat the game the first time around. When the secondary hard mode is activated, start a 2 player game.

Go to World 5-2 (provided both Mario and Luigi have enough lives) and be Small on the vine and wait for the Hammer Brother to throw a Hammer at you while on the vine. When it is the next player's turn, the next player should be at 1-2, 2-2 or 4-2 and a vine will grow from the ground. In 1-2, this vine allows you to rack up infinite lives from a Buzzy Beetle.

https://www.youtube.com/watch?v=RDEhCty45Sk

~Ben

drunk3nj3sus
03-05-2015, 04:37 AM
I wondered what this was all about as code means nothing to me. That would have made the game quite a bit harder than probably even necessary so I can see why they left it out. I'm more surprised as downright ugly as the FDS SMB2 was they didn't include it in there.

It's been awhile since I've played it but I have SMB2j on my wii and I'm pretty sure the spiney behavior is different in it

Leo_A
03-05-2015, 06:04 AM
How do we know that this was how it was intended to work, and that how it instead worked in four different releases was just a bug?

Jorpho
03-05-2015, 09:30 PM
I read about this on TCRF some time ago. Great site, TCRF.


How do we know that this was how it was intended to work, and that how it instead worked in four different releases was just a bug? Presumably because it's a fairly minor change of the sort one might expect a programmer to accidentally make.

ColecoFan1981
03-06-2015, 04:32 AM
Having discussed all about how to patch the original Spiny Egg behavior to the original 8-bit NES versions, I'm wondering how this could be done on Super Mario All-Stars for Super NES and Super Mario Bros. Deluxe for the Game Boy Color, considering those two ports use different coding languages (65816 for the former; and Z80 for the latter)?

The NEC PC-8801 series used a variation of the Z80 platform known as µPD780 (µPD70008 on PC-8801 FH and MH).

~Ben

Leo_A
03-06-2015, 07:08 AM
Presumably because it's a fairly minor change of the sort one might expect a programmer to accidentally make.

Just because the behavior can easily be altered, doesn't mean that how it has always been portrayed was merely the result of a bug.

Jorpho
03-06-2015, 09:57 AM
Having discussed all about how to patch the original Spiny Egg behavior to the original 8-bit NES versions, I'm wondering how this could be done on Super Mario All-Stars for Super NES and Super Mario Bros. Deluxe for the Game Boy Color, considering those two ports use different coding languages (65816 for the former; and Z80 for the latter)?I understand All-Stars actually uses a lot of unaltered code from the original NES games, as per https://tcrf.net/Super_Mario_All-Stars . Various bugs present in the original are still there, and some are even present in SMBDX, according to http://www.themushroomkingdom.net/bugs/smb .


The original arcade port of Vs. Super Mario Bros. was also Z80-based.Are you sure about that? The (non-Super) Mario Bros was Z80-based, but I thought the Vs Unisystem was mostly the same as the NES hardware. Or was there more than one port?

ColecoFan1981
03-07-2015, 05:28 AM
I will point out that in both Super Mario Bros. 3 and Super Mario World Lakitu throws the Spiny Eggs at an angle, so that would mean in SMB 1 the straight behavior of the Spiny Egg throw is indeed wrong and using the patch will restore the original behavior.

~Ben

Leo_A
03-07-2015, 06:24 AM
I will point out that in both Super Mario Bros. 3 and Super Mario World Lakitu throws the Spiny Eggs at an angle, so that would mean in SMB 1 the straight behavior of the Spiny Egg throw is indeed wrong and using the patch will restore the original behavior.

All that means is that in SMB3 and SMW, Lakitu throws spiny eggs at an angle and that an enterprising homebrew has delved into SMB1's code and changed it slightly to create something similar.

You very well may be correct, but it simply can't be proven by the code alone.

davidbrit2
03-07-2015, 12:23 PM
Granted, we can only really speculate at this point, but the fact that there's a bunch of code already in the game which calculates the speed and direction, and handles rebound, but which accidentally overwrites the result in the register with a zero at the last moment, seems to strongly suggest that was the intended behavior.

It seems like a pretty obvious bug, though, so it's weird that it wouldn't have been corrected before release. Perhaps it was done deliberately if they felt the lateral movement was too difficult. Zeroing out the results would be the safest way to put in an 11th-hour patch like that without modifying much code. Again, just speculation.

Pr3tty F1y
03-07-2015, 06:49 PM
Are you sure about that? The (non-Super) Mario Bros was Z80-based, but I thought the Vs Unisystem was mostly the same as the NES hardware. Or was there more than one port?

You are correct. Also, the PlayChoice-10 system looks to have used a z80 to power the menu screen which also displayed some game information and controls, but nothing related to NES game play. The Vs Unisystem was mostly bog standard NES. However, it looks like ColecoFan1981 edited his post.

Nonetheless, the SNES' 65c816 was fully capable of running 6502 code. This is is why Anthrox was able to release NES ports of certain "Mapper #0" NES games (sans sound) via BBS back in the 90s. It's a bit of a shame Nintendo didn't add the hardware to make the SNES fully backwards compatible.

Therefore, it seems very reasonable that the same bugs that existed in Super Mario Bros. for the NES would re-appear in Super Mario All-Stars. Why they f'd up the brick smashing physics in SMB1 (http://www.romhacking.net/hacks/167/); however, is anyone's guess.

Jorpho
03-08-2015, 08:19 PM
Oh, right, I was going to mention that. How very puzzling. That, at least, is surely a bug.