| Posts by mikeyk |
|
|
|
|
|
|
| (restricted) |
| (restricted) |
| (restricted) |
| (restricted) |
| (restricted) |
|
|
|
Gfx properties for all Bullet Bills: 8 bytes starting at PC 0x91C7.
|
|
| (restricted) |
| (restricted) |
| (restricted) |
| (restricted) |
| (restricted) |
|
|
|
Are you talking about star power, or the flashing invincibility after being hit by an enemy?
|
|
| (restricted) |
| (restricted) |
|
|
I have a couple of comments on your code. First of all, good job so far. It looks like you took care to ensure your PHA/PLAs were balanced, which is where a lot of beginners make mistakes.
1. If you are dealing with the first bank of RAM ($7E0000-$7E7FFF) you can omit the "7E". If you are dealing with the first page of RAM ($7E0000-$7E00FF) you can omit the leading "7E00"
Examples:
LDA $7E1420 (AF 20 14 7E) can be reduced to
LDA $1420 (AD 20 14)
STA $7E0071 (8F 71 00 7E) can become
STA $0071 (8D 71 00) or better yet
STA $71 (85 71)
2. The marked lines can be removed. "BEQ SetTeleport" is not needed, because if the value is #$04 the branch to "Fail" won't be taken and "SetTeleport" is the next section that will execute anyway. The last 3 lines I marked don't seem to do anything, what were you trying to accomplish with them?
Code PHA
LDA $7E1420
CMP #$04
BEQ SetTeleport <---
BNE Fail
SetTeleport
LDA #$05
STA $7E0071
LDA $7E1420 <---
CMP #$04 <---
BEQ Fail <---
Fail
PLA
RTS
3. Overall you seem to be getting the hang of it. This code should work without any problems. It's usually a good idea to say how you are inserting the code (block tool, sprite tool, manually, etc.), whether or not you're using an assembler (and which one), and the raw hex equivalent (if your code is short enough).
|
|
|
|
Originally posted by S.N.N.As for the three marked lines under the first branch .. I was trying to recopy the code so after you are teleported, it branches to "Fail" and ends the code. I don't even really know why I did that, it was the only way I could think of for ending it, heh. I never knew I could get rid of BEQ SetTeleport either - I figured if that wasn't there, it would just pass over the BNE and go straight to Fail.
Thanks for all the information everyone.
EDIT: Just tried this out. I altered the code a bit:
PHA
LDA $1420
CMP #$04
BNE Fail
LDA #$05
STA $71
PLA
RTS
Fail
PLA
RTS
Your code could still be simplified. This is all you should need:
Code PHA
LDA $1420
CMP #$04
BNE Fail
LDA #$05
STA $71
Fail:
PLA
RTS
Notice I removed the code that was duplicated at the end. Unless there is a branch or a jump, control flows down to the next instruction. After "STA $71", the next instruction will execute which is "PLA".
Originally posted by S.N.N.
When you have gathered 4, it works perfectly. However, if you touch the block before you gather 4 coins, the ROM crashes. I have checked and tried a bunch of different things, but I can't seem to find an error - the PLAs and PHAs are right. Is there anything that immediately sticks out that looks like it could be causing the problem?
Here is the hex:
48 AD 20 14 C9 04 D0 F8 A9 05 85 71 68 60 68
There are two problems looking at the hex. It should end with 60, but I assume that's a typo. The real issue is that the branch instruction is incorrect. It looks like the assembler couldn't find the "fail" label. I think xkas requires labels to end with a colon, so make sure you include on like i did earlier in this post.
The hex for your code should be:
48 AD 20 14 C9 04 D0 06 A9 05 85 71 68 60 68 60
My version would be:
48 AD 20 14 C9 04 D0 04 A9 05 85 71 68 60
|
| Last edited on 2007-08-24 10:49:25 PM by mikeyk. |
|
|
|
|
I'm not too familiar with the terminology that you are using. But I would say SMW uses bounding box collisions. Mario and sprites can be thought of as rectangles, and collision occurs when there is overlap. The tiles drawn on screen have nothing to do with it; you can have a 32x32 pixel enemy whose interaction area is 16x16. May I ask why you are curious about this?
|
|
|
|
| (restricted) |
|
|
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
|
|
|
|
|
|
|
|