Language…
17 users online: aore gfhgft, Digital Entertainment, DoubleCakes, Got_Breaded, Guido_Keller, h.carrell, HammerBrother, Hammerer, hoagie, Israelcv12cv, MM102, NightSpark,  Sayuri, Sheilal14, steelsburg, stormitive, Yairobot - Guests: 124 - Bots: 180
Users: 64,663 (2,406 active)
Latest user: NightSpark

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 418
  • 419
  • 420
This thread is the place to request help with your custom blocks, sprites, routine hacks, and etc. coding within Super Mario World.

If you are going to answer a question, please make sure you know what you're talking about, and most of all, do NOT respond with things like 'I don't know' or 'Do it yourself'. It's called a 'HELP' thread for a reason.

Thank you.
to make a custom block act like another block, you have to store the low byte of the block at $1693, the highbyte is simply load into Y.
This is an example how to make the block act solid:

LDA #$30 ; act like block 130 [Cement Block]
STA $1693 ;
LDY #$01 ;
RTS
Your layout has been removed.
How hard would making a KSS RPG type boss be?
Your layout has been removed.
First of all, there seem to be a mistake in your code, it should be:
AD AF 14 C9 01 F0 01 60 A9 01 8D 93 14 60

About the act like setting, it's stored that way:

-the low byte is at $7E1693

-the high byte is in Y

Edit: seem like GY beat me
Originally posted by Troopa Pride
How hard would making a KSS RPG type boss be?


that does not belong in here.
Your layout has been removed.
HEY,LISTEN



Originally posted by Bio
First of all, there seem to be a mistake in your code, it should be:
AD AF 14 C9 01 F0 01 60 A9 01 8D 93 14 60

About the act like setting, it's stored that way:

-the low byte is at $7E1693

-the high byte is in Y

Edit: seem like GY beat me


It worked fine with the A5, in fact the colors go screwy if I use A9 instead, that's why I used A5. But otherwise, it works fine now. The A5 (that I tried with the code before, but didn't post) needed to be A9 though, as well as me not loading Y =P Thanks.



HEY,LISTEN



Yet more trouble with the custom blocks... I have EE 20 14 EE 22 14 AD 20 14 C5 05 F0 01 60 A5 00 8D AF 14 60.

It's supposed to add a Yoshi coin (first two addresses) then switch the ON/OFF position to off, but only if 5 Yoshi Coins have been collected. It doesn't activate the ON/OFF part. What's wrong with the code?



Two instances of the same problem.

You want:

CMP #$05 (C9 05) instead of:
CMP $05 (C5 05)
You are comparing against whatever value is in RAM $7E0005 instead of the number 5

LDA #$00 (A9 00) instead of:
LDA $00 (A5 00)
You are loading the value in RAM $7E0000 instead of the number 0
HEY,LISTEN



Ok, thanks. It works now. I always get A5 and A9 mixed up >.< Now I know that next time I'm doing this kind of block, use A9 -.-



I have a question regarding flags.

I just want to make sure I'm understanding this right, so I'll use the On/Off switch as an example. Is the format kind of like a true/false thing, 00 being false, and 01 being true? Since that wording was so terrible, I'll give an example:

LDA $14AF ;loads the on/off switch value
CMP #$01 ;checks to see if the switch is ON
BEQ ...
...

and so on.

Basically what I'm asking is .. are the values I write 00 and 01 for situations like this?

Thanks.
HEY,LISTEN



Yes. With flag values, you use 00 and 01. I believe it's the same with the Goal Sphere address, where all other values will screw something up.
(I.E. 02+ will make the colors go screwy and other various effects.)



Hm, ok, thanks.

Gonna throw another problem out here for people to answer too. I'm trying to make a block where you have to press X four times to teleport you somewhere. However, what I have seems to crash the ROM:

LDA $16
AND #$40
BEQ NoPress
LDA $16
AND #$40
BEQ NoPress
LDA $16
AND #$40
BEQ NoPress
LDA $16
AND #$40
BEQ NoPress
LDA #$05
STA $71
RTS
NoPress:
RTS

Here's the hex:

A5 16 29 40 F0 17 A5 16 29 40 F0 11 A5 16 29 40 F0 0B A5 16 29 40 F0 05 A9 05 85 71 60

Any advice on what's wrong would be great - I looked over it for a while, and eventually just got annoyed. Thanks.

The hex string should end with two 60s the way you wrote your code. That's the only reason I could see it crashing.

However, there is a general problem with the way you are trying to achieve the described behavior. Block code is executed once per frame that Mario touches the block. The controller data is only updated once per frame. For all of those checks, $16 always has the same value.

To fix this, you'd need to use an unused RAM address to keep state in between frames. For example:

LDA $16
AND #$40
BEQ NoPress
INC SomeUnusedAddress
LDA SomeUnusedAddress
CMP #$04
BNE Return
LDA #$05
STA $71
RTS
NoPress:
STZ SomeUnusedAddress
Return:
RTS

Each time the block is executed the address is either incremented or zeroed out. If the counter hits 4, we trigger the exit. There are still several issues with this. First, it requires that the button be tapped four consecutive FRAMES. This is probably not possible since there are about 30 frames per second. Another problem is that when Mario leaves the block, the counter doesn't get reset.

There are solutions to these problems. But I'll let this soak in first. Ask about it if you'd like to know more.
Hmm .. well, I was kind of thrown off by these new codes I haven't seen before. I understand INC slightly, but what exactly does STZ do?

Let's see if I can follow what your code does. Loads the controller data, then checks to see if X was pressed - if it wasn't, it just returns. If it was, it does that STZ command, which I have no idea what it does. If you press it four times, then it teleports you.

Thanks for showing me how to do this, it's really helping.
STZ = store zero

STZ $1420
is roughly the same as:
LDA #$00
STA $1420

Bookmark this -- it's a great reference. Each instruction is explained.
http://www.zophar.net/tech/files/65816info.txt

What the code in my last post does: Load the controller data and check if X has been tapped. If it hasn't, reset the counter and return. If it has, add 1 to the counter. If the counter is not equal to 4, return. If the counter is 4, trigger the exit.
But as you said, you would have to press X once each frame which is impossible, even on slowdown. I used your code as a base, and remade it for mine:

LDA $16
AND #$40
BEQ NotPressed
INC $0660
LDA $0660
CMP #$04
BNE Return
LDA #$05
STA $71
RTS
NotPressed:
STZ $0660
Return:
RTS

I used $0660 as my unused address. The block doesn't crash the ROM, so all I need to learn is how to fix the frame issue.

Also, thanks for the refernce - I added it to my favorites.
How about doing it this way?:

lda $16
AND #$40
BNE pressed
lda $16
Beq return
stz $0660
return:
RTS
pressed:
INC $0660
LDA $0660
CMP #$04
BNE Return
LDA #$05
STA $71
RTS

this one will increase the counter by 1 and will reset it once any others button get pressed
Oh, that looks great. I'll try it out, mainly because I'm curious to see if it encounters the per frame problem mikeyk mentioned. Thanks

EDIT: Hmm .. it seems to teleport to after only pressing X once. That's not supposed to happen, is it?
Originally posted by S.N.N.
EDIT: Hmm .. it seems to teleport to after only pressing X once. That's not supposed to happen, is it?

maybe the RAM used for the counter already have a default value, try putting block with that code:

stz $0660
rts

around it
Tried it, no luck. The block still teleported me after one tap of X instead of four. I have no idea why it's doing that O_o
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 418
  • 419
  • 420