Language…
14 users online:  AmperSam,  Ayami, bucketofwetsocks, Dispace,  Donut, Enan63, Green, Hayashi Neru, pnaha, ShadowMistressYuko, signature_steve, Sweetdude, Tomi P, Znes.609 - Guests: 241 - Bots: 295
Users: 64,795 (2,377 active)
Latest user: mathew

Ground pound move :O

I am trying to code a ground pound move (My very first attempt for coding-from-scratch)
However, I have a problem...
When I patch the rom with Xkas, nothing happens in the game
the code:

header
lorom
org $E844 ;$20:E844
JSL in_air
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;stomp ground;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
org $648A30 ;The place where the code will be assembled

in_air:
lda $0077 ;player status (air/ground stuff) 0!=in air
bne stomp ;jump to stomp routine
beq not_stomp ;jump to not-stomp routine


stomp:
lda #$01
sta $18E7 ;Yoshi ground stomp flag
lda $0077 ;Player Position Status
cmp #$01 ;When in air...
bne not_stomp ;
lda #$02
sta $0015 ;controller data 1, which value is down?
lda #$02
sta $0016 ;controller data 1 one frame, which value is down?
lda #$02
sta $0017 ;controller data 2, which value is down?
lda #$02
sta $0018 ;controller data 2 ONE FRAME, which value is down?
rtl

not_stomp:
rts ;return


;additional information
;Yoshi stomps ground status:
;read breakpoint:
;$00/EF87 AD E7 18 LDA $18E7 [$00:18E7] A:0024 X:0000 Y:0000 P:envMXdizC
;Write breakpoint:
;1
;$01/F19E 8D E7 18 STA $18E7 [$01:18E7] A:F101 X:0007 Y:000A P:envMXdizc
;2
;$01/EBD6 9C E7 18 STZ $18E7 [$01:18E7] A:EB00 X:0007 Y:0000 P:envMXdiZc

;Powerup(?):
;$00/D156 E6 19 INC $19 [$00:0019] A:D100 X:0000 Y:0000 P:envMXdiZc ;grow
;$00/F600 64 19 STZ $19 [$00:0019] A:2501 X:0006 Y:0004 P:envMXdizc ;shrink
;$00/D156 E6 19 INC $19 [$00:0019] A:D100 X:0000 Y:0000 P:envMXdiZc ;grow
;$01/C5F9 85 19 STA $19 [$00:0019] A:C503 X:000B Y:0005 P:envMXdizc ;fire get
;$01/C59A 85 19 STA $19 [$00:0019] A:C502 X:0003 Y:000F P:envMXdizc ;feather/cape get
;$00/D0B6 64 19 STZ $19 [$00:0019] A:D0B6 X:0000 Y:0000 P:envMXdiZc ;rest in peace get
---------------------------------------------------------------

I think this code doesnt make any sense, but could someone help me what is wrong with it?
And remember, this is just my VERY FIRST ASM code...
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
RTS and RTL are not interchangable. It'll crash because JSL puts a 24bit return address on the stack and RTS only pulls 16bits (PB is unchanged). So, that probably means the test for 'bne stomp' always passes or else it'll run into the RTS.

Also, if you tested $77 first, why do you test it again in 'stomp:?

I can't speak for the game variables.
I changed
not_stomp:
rts ;return
to
not_stomp:
rtl ;return
and I removed this place:
lda $0077 ;Player Position Status
cmp #$01 ;When in air...
bne not_stomp ;
But It still doesnt work because I cant find the controller data, when you press down. Any tips how I can find it? :O
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
I beleave the controller data bytes are bitfields... I did a test with the snes9x debugger and it looks like down is bit 3! or 2 if the first one is 0 I guess. (Value of A when not pressed: $0200 when down pressed $0204)

Edit: oops I forgot, the byte order is switched form how I am used to so it's really bit 10/9!
Your layout has been removed.
why are you writing to the contoller data? shouldn't you be checking it insted, also, setting the Yoshi's ground pound flag will just change nothing if Mario isn't riding yoshi
Hmm, so actually the ground pound doesnt work at all...
Someone may close this if he/she want, since it wont work...
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)