Language…
10 users online: AJ1Ayrton, GRIMMKIN, Hidincuzimsmokin, Klug, Oskise, playagmes169,  Ringo, Rykon-V73,  Telinc1, Tsquare07 - Guests: 251 - Bots: 294
Users: 64,795 (2,375 active)
Latest user: mathew

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 418
  • 419
  • 420
I'm having a small issue with the level that I'm working on for SMWCP and I was hoping someone with a bit more experience might be able to diagnose what's wrong.

Romi's SMB3 Stretch seems to be incompatible with Layer 3 Tides, and I'm not really sure why. I looked through his code to see if he shared any RAM addresses with the tides, but I couldn't find anything in the RAM Map.

What happens is when Layer 3 Tides are enabled, his movement routine seems to get killed, so he just sits in place and "vibrates." No other Layer 3 effects generate this issue.

Any help with this would be much appreciated.

[?] Miscellaneous Helpful Hints
If I moderated your hack, there was apparently a 90 percent chance it was rejected.
Actually, why exactly are you guys trying to find a use case for BPL and BMI after a CMP command?
In my opinion BMI and BPL are used after doing calculations to check if the result is negative and for example special handling is needed.

Here is a macro with a imo typical usecase.
Code
macro	jumpMarioRightSide(target)	; Jumps to target if Mario is on the right side of the sprite
		LDA !MARIO_XPOSLO
		SEC
		SBC !SPRITE_XPOSLO,x
		LDA !MARIO_XPOSHI
		SBC !SPRITE_XPOSHI,x
		BPL <target>
endmacro
Course, we all know the typical use, but it is used after a CMP at times, even in SMW's own code. The question is why it is used that way.
Code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;		Crystal Switch			;
;			for SMWCP		;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

XDISPS = $FFF3		;xpos relative to spritex
YDISPS = $0002		;ram substitute
WIDTH = $000D		;width of interaction field
HEIGHT = $000D

FRAMES_BLUE		dcb $00,$00,$01,$02	;used when the red blocks are in
FRAMES_RED		dcb $01,$02,$03,$03	;used when the blue blocks are in

Manual1 = $7FC070		;manual trigger value for the blue blocks. manual trigger area can be found in LM's help file.
Manual2 = $7FC071		;manual trigger value for the blue blocks. manual trigger area can be found in LM's help file.


dcb "INIT"
STZ $AA,x
RTL

dcb "MAIN"
PHB
PHK
PLB
JSR SPRITE_ROUTINE
PLB
RTL

SPRITE_ROUTINE
;JSL $01B44F
JSR SUB_GFX
STZ $B6,x
LDA $9D
BNE RETURN
JSR SOLIDITY

JSL $01802A
LDA $13
AND #$03
BEQ CONTINUE
LDA $14AF
BNE BLUEIN

LDA Manual1
BEQ CONTINUE
LDA Manual1
SEC
SBC #$01
STA Manual1
STA Manual2
BRA CONTINUE

BLUEIN
LDA Manual1
CMP #$03
BEQ CONTINUE
LDA Manual1
CLC
ADC #$01
STA Manual1
STA Manual2

CONTINUE
JSL $01A7DC
BCC RETURN
JSR SUB_VERT_POS
LDA $0E
CMP #$E6
BPL RETURN

LDA #$A0
STA $7D
JSL $01AB99

LDA $14AF
EOR #$01
STA $14AF

RETURN
RTS

;my solidity routine, beefier than it should be i think
;slightly hacked to replace YDISPS with value in RAM

SOLIDITY
	PHP		;preserve status
	SEP #$30	;8bit AXY
	STZ $00		;reset scratch ram used here
	STZ $01
	STZ $02

;optional yoshi displacement
	LDY #$E0	;yoshiless displacement
	LDA $187A	;yoshi flag
	BEQ NoYoshiB
	LDY #$D0	;yoshi displacement
NoYoshiB
	TYA		;Y->A
	STA $04
	LDA #$FF	;signed
	STA $05

;test left edge
	LDA $14E0,x	;xhigh
	XBA
	LDA $E4,x	;xlow
	REP #$20	;16bit A
	CLC
	ADC.w #XDISPS	;add displacement word
	CMP $94		;compare mario x
	SEP #$20	;8bit A again
	BCS HorzOut	;if Mario's X is smaller, then mario is to the left of sprite

;within from left, test right
	LDA $14E0,x	;load x positions again
	XBA
	LDA $E4,x
	REP #$20	;16bit A
	CLC
	ADC.w #WIDTH	;add width, test right
	STA $00		;scratch
	LDA $94		;load mario X
	CMP $00		;compare operated value
	SEP #$20	;8bit A again
	BCS HorzOut

	LDA #$01	;within horizontal range, set bit0 of $02
	TSB $02

HorzOut			;skip label for horizontal range, now test vertical range
;test Ytop A
	LDA $14D4,x	;yhigh
	XBA
	LDA $D8,x	;ylow
	REP #$20	;16bit A
	CLC
	ADC.w #YDISPS	;add displacement word
	;ADC TEMP
	CLC
	ADC $04
	CMP $96		;compare mario y
	SEP #$20	;8bit A again
	BCS VertTopOut	;if Mario's Y is smaller, then mario is ? of sprite

;Ytop B
	LDA $14D4,x	;load x positions again
	XBA
	LDA $D8,x
	REP #$20	;16bit A
	CLC
	ADC.w #YDISPS	;add width, test right
	;ADC TEMP
	CLC
	ADC.w #$0006	;6px 'bufferzone'
	CLC
	ADC $04
	STA $00		;scratch
	LDA $96		;load mario X
	CMP $00		;compare operated value
	SEP #$20	;8bit A again
	BCS VertTopOut

	LDA #$02	;within vertical top range
	TSB $02
	JMP SkipVerts

VertTopOut		;not in YTop, try Y center
;test Ycent A
	LDA $14D4,x	;yhigh
	XBA
	LDA $D8,x	;ylow
	REP #$20	;16bit A
	CLC
	ADC.w #YDISPS	;add displacement word
	;ADC TEMP
	CLC
	ADC.w #$0006	;add 6 px
	CLC
	ADC $04
	CMP $96		;compare mario y
	SEP #$20	;8bit A again
	BCS VertCentOut	;if Mario's Y is smaller, then mario is ? of sprite

;Ycent B
	LDA $14D4,x	;load x positions again
	XBA
	LDA $D8,x
	REP #$20	;16bit A
	CLC
	ADC.w #YDISPS	;add width, test right
	;ADC TEMP
	CLC
	ADC.w #HEIGHT	;add height
	SEC
	SBC.w #$0006	;6px 'buffer zone' too
	CLC
	ADC.w #$0010	;16px
	CLC
	ADC $04
	STA $00		;scratch
	LDA $96		;load mario X
	CMP $00		;compare operated value
	SEP #$20	;8bit A again
	BCS VertCentOut

	LDA #$04	;within vertical cent range
	TSB $02
	BRA SkipVerts

VertCentOut		;not in Ycent, try Y bottom
	LDA $14D4,x	;yhigh
	XBA
	LDA $D8,x	;ylow
	REP #$20	;16bit A
	CLC
	ADC.w #YDISPS	;add displacement word
	;ADC TEMP
	CLC
	ADC.w #HEIGHT
	CLC
	ADC.w #$0010	;add 16px, since it's relative to mario's head instead of his feet here
	SEC
	SBC.w #$0006	;sub 6px buffer
	CLC
	ADC $04
	CMP $96		;compare mario y
	SEP #$20	;8bit A again
	BCS SkipVerts

;Ybot B
	LDA $14D4,x	;load x positions again
	XBA
	LDA $D8,x
	REP #$20	;16bit A
	CLC
	ADC.w #YDISPS	;add width, test right
	;ADC TEMP
	CLC
	ADC.w #HEIGHT	;add height
	CLC
	ADC.w #$0016	;add 16px for marios head again
	CLC
	ADC $04
	STA $00		;scratch
	LDA $96		;load mario X
	CMP $00		;compare operated value
	SEP #$20	;8bit A again
	BCS SkipVerts

	LDA #$08	;within vertical bottom range
	TSB $02

SkipVerts
;rising mario

;placement on top of sprite
	LDA $02		;test 2 bits for X range and Y top
	AND #$03	;low 2 bits
	CMP #$03
	BEQ HandleStand	;handle mario standingon platform

	LDA $02
	AND #$05	;test xrange and ycent
	CMP #$05
	BEQ HandleCent

	LDA $02
	AND #$09	;test xbottom and ybottom
	CMP #$09
	BEQ HandleBumpHead

	JMP ReturnSLD	;bottom out

HandleCent
	JSR SUB_HORZ_POS	;get side of sprite mario is on
	CPY #$00	;compare result
	BEQ MarioLeftRight

;Marioleftright
	LDA $7B		;load xspd
	BMI NoClipXY	;don't clip if going in direction that isn't blocked
	STZ $7B		;clip if required
	JMP ReturnSLD	;ret

MarioLeftRight
	LDA $7B		;load xspd
	BPL NoClipXY
	STZ $7B	
	JMP ReturnSLD	;ret

NoClipXY
	JMP ReturnSLD	;return

HandleBumpHead
	LDA $7D		;if rising, set falling speed
	BPL DontClipYS
	LDA #$08	;set falling speed
	STA $7D
DontClipYS
	JMP ReturnSLD	;return

HandleStand
	LDA $7D		;mario Y
	BPL FallingMario

	;handle bumping from the underside if needed
	BRA ReturnSLD	;TEMP: return
	
FallingMario
	SEP #$20	;8bit A
	LDA #$01	;set riding sprite
	STA $1471
	STZ $7D		;no Yspd

	LDY #$E0	;displacement no yoshi
	LDA $187A	;yoshi flag
	BEQ NoYoshiA
	LDY #$D0	;displacement yoshi
NoYoshiA
	INY
	TYA		;chosen displacement to A
	CLC
	ADC $D8,x	;sprite y lo
	STA $96		;mario y lo
	LDA $14D4,x	;sprite y hi
	ADC #$FF	;inverse carry
	STA $97

;now add ydisps...
	REP #$20	;16bit A
	LDA $96
	;CLC
	ADC.w #YDISPS
	;ADC TEMP
	STA $96		;modded ypos

ReturnSLD
	PLP		;restore status
	RTS


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GRAPHICS ROUTINE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

TILEMAP = $C0

	SUB_GFX
	JSR GET_DRAW_INFO
	LDA $00
	STA $0300,y
	LDA $01
	STA $0301,y
	LDA #TILEMAP
	STA $0302,y
	LDA $15F6,x
	ORA $64
	STA $0303,y
	INY
	INY
	INY
	INY
	LDY #$02
	LDA #$00
	JSL $01B7B3
	RTS

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GET_DRAW_INFO
; This is a helper for the graphics routine.  It sets off screen flags, and sets up
; variables.  It will return with the following:
;
;		Y = index to sprite OAM ($300)
;		$00 = sprite x position relative to screen boarder
;		$01 = sprite y position relative to screen boarder  
;
; It is adapted from the subroutine at $03B760
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

SPR_T1              dcb $0C,$1C
SPR_T2              dcb $01,$02

GET_DRAW_INFO       STZ $186C,x             ; reset sprite offscreen flag, vertical
                    STZ $15A0,x             ; reset sprite offscreen flag, horizontal
                    LDA $E4,x               ; \
                    CMP $1A                 ;  | set horizontal offscreen if necessary
                    LDA $14E0,x             ;  |
                    SBC $1B                 ;  |
                    BEQ ON_SCREEN_X         ;  |
                    INC $15A0,x             ; /

ON_SCREEN_X         LDA $14E0,x             ; \
                    XBA                     ;  |
                    LDA $E4,x               ;  |
                    REP #$20                ;  |
                    SEC                     ;  |
                    SBC $1A                 ;  | mark sprite invalid if far enough off screen
                    CLC                     ;  |
                    ADC.W #$0040            ;  |
                    CMP.W #$0180            ;  |
                    SEP #$20                ;  |
                    ROL A                   ;  |
                    AND #$01                ;  |
                    STA $15C4,x             ; / 
                    BNE INVALID             ; 
                    
                    LDY #$00                ; \ set up loop:
                    LDA $1662,x             ;  | 
                    AND #$20                ;  | if not smushed (1662 & 0x20), go through loop twice
                    BEQ ON_SCREEN_LOOP      ;  | else, go through loop once
                    INY                     ; / 
ON_SCREEN_LOOP      LDA $D8,x               ; \ 
                    CLC                     ;  | set vertical offscreen if necessary
                    ADC SPR_T1,y            ;  |
                    PHP                     ;  |
                    CMP $1C                 ;  | (vert screen boundry)
                    ROL $00                 ;  |
                    PLP                     ;  |
                    LDA $14D4,x             ;  | 
                    ADC #$00                ;  |
                    LSR $00                 ;  |
                    SBC $1D                 ;  |
                    BEQ ON_SCREEN_Y         ;  |
                    LDA $186C,x             ;  | (vert offscreen)
                    ORA SPR_T2,y            ;  |
                    STA $186C,x             ;  |
ON_SCREEN_Y         DEY                     ;  |
                    BPL ON_SCREEN_LOOP      ; /

                    LDY $15EA,x             ; get offset to sprite OAM
                    LDA $E4,x               ; \ 
                    SEC                     ;  | 
                    SBC $1A                 ;  | $00 = sprite x position relative to screen boarder
                    STA $00                 ; / 
                    LDA $D8,x               ; \ 
                    SEC                     ;  | 
                    SBC $1C                 ;  | $01 = sprite y position relative to screen boarder
                    STA $01                 ; / 
                    RTS                     ; return

INVALID             PLA                     ; \ return from *main gfx routine* subroutine...
                    PLA                     ;  |    ...(not just this subroutine)
                    RTS                     ; /

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SUB_OFF_SCREEN
; This subroutine deals with sprites that have moved off screen
; It is adapted from the subroutine at $01AC0D
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                    
SPR_T12             dcb $40,$B0
SPR_T13             dcb $01,$FF
SPR_T14             dcb $30,$C0,$A0,$C0,$A0,$F0,$60,$90		;bank 1 sizes
		            dcb $30,$C0,$A0,$80,$A0,$40,$60,$B0		;bank 3 sizes
SPR_T15             dcb $01,$FF,$01,$FF,$01,$FF,$01,$FF		;bank 1 sizes
					dcb $01,$FF,$01,$FF,$01,$00,$01,$FF		;bank 3 sizes

SUB_OFF_SCREEN_X1   LDA #$02                ; \ entry point of routine determines value of $03
                    BRA STORE_03            ;  | (table entry to use on horizontal levels)
SUB_OFF_SCREEN_X2   LDA #$04                ;  | 
                    BRA STORE_03            ;  |
SUB_OFF_SCREEN_X3   LDA #$06                ;  |
                    BRA STORE_03            ;  |
SUB_OFF_SCREEN_X4   LDA #$08                ;  |
                    BRA STORE_03            ;  |
SUB_OFF_SCREEN_X5   LDA #$0A                ;  |
                    BRA STORE_03            ;  |
SUB_OFF_SCREEN_X6   LDA #$0C                ;  |
                    BRA STORE_03            ;  |
SUB_OFF_SCREEN_X7   LDA #$0E                ;  |
STORE_03			STA $03					;  |            
					BRA START_SUB			;  |
SUB_OFF_SCREEN_X0   STZ $03					; /

START_SUB           JSR SUB_IS_OFF_SCREEN   ; \ if sprite is not off screen, return
                    BEQ RETURN_35           ; /
                    LDA $5B                 ; \  goto VERTICAL_LEVEL if vertical level
                    AND #$01                ; |
                    BNE VERTICAL_LEVEL      ; /     
                    LDA $D8,x               ; \
                    CLC                     ; | 
                    ADC #$50                ; | if the sprite has gone off the bottom of the level...
                    LDA $14D4,x             ; | (if adding 0x50 to the sprite y position would make the high byte >= 2)
                    ADC #$00                ; | 
                    CMP #$02                ; | 
                    BPL ERASE_SPRITE        ; /    ...erase the sprite
                    LDA $167A,x             ; \ if "process offscreen" flag is set, return
                    AND #$04                ; |
                    BNE RETURN_35           ; /
                    LDA $13                 ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0756 VC:176 00 FL:205
                    AND #$01                ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0780 VC:176 00 FL:205
                    ORA $03                 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0796 VC:176 00 FL:205
                    STA $01                 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0820 VC:176 00 FL:205
                    TAY                     ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0844 VC:176 00 FL:205
                    LDA $1A                 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0858 VC:176 00 FL:205
                    CLC                     ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0882 VC:176 00 FL:205
                    ADC SPR_T14,y           ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0896 VC:176 00 FL:205
                    ROL $00                 ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizcHC:0928 VC:176 00 FL:205
                    CMP $E4,x               ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:0966 VC:176 00 FL:205
                    PHP                     ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:0996 VC:176 00 FL:205
                    LDA $1B                 ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdizCHC:1018 VC:176 00 FL:205
                    LSR $00                 ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdiZCHC:1042 VC:176 00 FL:205
                    ADC SPR_T15,y           ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdizcHC:1080 VC:176 00 FL:205
                    PLP                     ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F0 P:eNvMXdizcHC:1112 VC:176 00 FL:205
                    SBC $14E0,x             ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1140 VC:176 00 FL:205
                    STA $00                 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:1172 VC:176 00 FL:205
                    LSR $01                 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:1196 VC:176 00 FL:205
                    BCC SPR_L31             ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZCHC:1234 VC:176 00 FL:205
                    EOR #$80                ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZCHC:1250 VC:176 00 FL:205
                    STA $00                 ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1266 VC:176 00 FL:205
SPR_L31             LDA $00                 ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1290 VC:176 00 FL:205
                    BPL RETURN_35           ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1314 VC:176 00 FL:205
ERASE_SPRITE        LDA $14C8,x             ; \ if sprite status < 8, permanently erase sprite
                    CMP #$08                ; |
                    BCC KILL_SPRITE         ; /    
                    LDY $161A,x             ;A:FF08 X:0007 Y:0001 D:0000 DB:01 S:01F3 P:envMXdiZCHC:1108 VC:059 00 FL:2878
                    CPY #$FF                ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdiZCHC:1140 VC:059 00 FL:2878
                    BEQ KILL_SPRITE         ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdizcHC:1156 VC:059 00 FL:2878
                    LDA #$00                ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdizcHC:1172 VC:059 00 FL:2878
                    STA $1938,y             ;A:FF00 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdiZcHC:1188 VC:059 00 FL:2878
KILL_SPRITE         STZ $14C8,x             ; erase sprite
RETURN_35           RTS                     ; return

VERTICAL_LEVEL      LDA $167A,x             ; \ if "process offscreen" flag is set, return
                    AND #$04                ; |
                    BNE RETURN_35           ; /
                    LDA $13                 ; \
                    LSR A                   ; | 
                    BCS RETURN_35           ; /
                    LDA $E4,x               ; \ 
                    CMP #$00                ;  | if the sprite has gone off the side of the level...
                    LDA $14E0,x             ;  |
                    SBC #$00                ;  |
                    CMP #$02                ;  |
                    BCS ERASE_SPRITE        ; /  ...erase the sprite
                    LDA $13                 ;A:0000 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:1218 VC:250 00 FL:5379
                    LSR A                   ;A:0016 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1242 VC:250 00 FL:5379
                    AND #$01                ;A:000B X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1256 VC:250 00 FL:5379
                    STA $01                 ;A:0001 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1272 VC:250 00 FL:5379
                    TAY                     ;A:0001 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1296 VC:250 00 FL:5379
                    LDA $1C                 ;A:001A X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0052 VC:251 00 FL:5379
                    CLC                     ;A:00BD X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0076 VC:251 00 FL:5379
                    ADC SPR_T12,y           ;A:00BD X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0090 VC:251 00 FL:5379
                    ROL $00                 ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:enVMXdizCHC:0122 VC:251 00 FL:5379
                    CMP $D8,x               ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0160 VC:251 00 FL:5379
                    PHP                     ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0190 VC:251 00 FL:5379
                    LDA.W $001D             ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F2 P:eNVMXdizcHC:0212 VC:251 00 FL:5379
                    LSR $00                 ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:enVMXdiZcHC:0244 VC:251 00 FL:5379
                    ADC SPR_T13,y           ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:enVMXdizCHC:0282 VC:251 00 FL:5379
                    PLP                     ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:envMXdiZCHC:0314 VC:251 00 FL:5379
                    SBC $14D4,x             ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0342 VC:251 00 FL:5379
                    STA $00                 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0374 VC:251 00 FL:5379
                    LDY $01                 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0398 VC:251 00 FL:5379
                    BEQ SPR_L38             ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0422 VC:251 00 FL:5379
                    EOR #$80                ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0438 VC:251 00 FL:5379
                    STA $00                 ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0454 VC:251 00 FL:5379
SPR_L38             LDA $00                 ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0478 VC:251 00 FL:5379
                    BPL RETURN_35           ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0502 VC:251 00 FL:5379
                    BMI ERASE_SPRITE        ;A:8AFF X:0002 Y:0000 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0704 VC:184 00 FL:5490

SUB_IS_OFF_SCREEN   LDA $15A0,x             ; \ if sprite is on screen, accumulator = 0 
                    ORA $186C,x             ; |  
                    RTS                     ; / return


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SUB_HORZ_POS
; This routine determines which side of the sprite Mario is on.  It sets the Y register
; to the direction such that the sprite would face Mario
; It is ripped from $03B817
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

SUB_HORZ_POS		LDY #$00				;A:25D0 X:0006 Y:0001 D:0000 DB:03 S:01ED P:eNvMXdizCHC:1020 VC:097 00 FL:31642
					LDA $94					;A:25D0 X:0006 Y:0000 D:0000 DB:03 S:01ED P:envMXdiZCHC:1036 VC:097 00 FL:31642
					SEC                     ;A:25F0 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizCHC:1060 VC:097 00 FL:31642
					SBC $E4,x				;A:25F0 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizCHC:1074 VC:097 00 FL:31642
					STA $0F					;A:25F4 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1104 VC:097 00 FL:31642
					LDA $95					;A:25F4 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1128 VC:097 00 FL:31642
					SBC $14E0,x				;A:2500 X:0006 Y:0000 D:0000 DB:03 S:01ED P:envMXdiZcHC:1152 VC:097 00 FL:31642
					BPL SPR_L16             ;A:25FF X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1184 VC:097 00 FL:31642
					INY                     ;A:25FF X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1200 VC:097 00 FL:31642
SPR_L16				RTS                     ;A:25FF X:0006 Y:0001 D:0000 DB:03 S:01ED P:envMXdizcHC:1214 VC:097 00 FL:31642


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SUB_VERT_POS
; This routine determines if Mario is above or below the sprite.  It sets the Y register
; to the direction such that the sprite would face Mario
; It is ripped from $03B829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

SUB_VERT_POS		LDY #$00               ;A:25A1 X:0007 Y:0001 D:0000 DB:03 S:01EA P:envMXdizCHC:0130 VC:085 00 FL:924
					LDA $96                ;A:25A1 X:0007 Y:0000 D:0000 DB:03 S:01EA P:envMXdiZCHC:0146 VC:085 00 FL:924
					SEC                    ;A:2546 X:0007 Y:0000 D:0000 DB:03 S:01EA P:envMXdizCHC:0170 VC:085 00 FL:924
					SBC $D8,x              ;A:2546 X:0007 Y:0000 D:0000 DB:03 S:01EA P:envMXdizCHC:0184 VC:085 00 FL:924
					STA $0F                ;A:25D6 X:0007 Y:0000 D:0000 DB:03 S:01EA P:eNvMXdizcHC:0214 VC:085 00 FL:924
					LDA $97                ;A:25D6 X:0007 Y:0000 D:0000 DB:03 S:01EA P:eNvMXdizcHC:0238 VC:085 00 FL:924
					SBC $14D4,x            ;A:2501 X:0007 Y:0000 D:0000 DB:03 S:01EA P:envMXdizcHC:0262 VC:085 00 FL:924
					BPL SPR_L11            ;A:25FF X:0007 Y:0000 D:0000 DB:03 S:01EA P:eNvMXdizcHC:0294 VC:085 00 FL:924
					INY                    ;A:25FF X:0007 Y:0000 D:0000 DB:03 S:01EA P:eNvMXdizcHC:0310 VC:085 00 FL:924
SPR_L11				RTS                    ;A:25FF X:0007 Y:0001 D:0000 DB:03 S:01EA P:envMXdizcHC:0324 VC:085 00 FL:924



I'm trying to make this sprite change the Manual 0 and Manual 1 trigger types between four different frames depending on the status of the On-Off Switch. That works fine...except for some reason, most of the time, the blocks using those frames will skip to the last frame automatically! I can't figure out why. Help, please!
<Adam> I feel like smwc is a prostitute now, because we put up a porn ad for money
It would make things easier if you just posted the relevant part of code. (Also, you're using TRASM? *gags*)

Code
FRAMES_BLUE		dcb $00,$00,$01,$02	;used when the red blocks are in
FRAMES_RED		dcb $01,$02,$03,$03	;used when the blue blocks are in

Manual1 = $7FC070		;manual trigger value for the blue blocks. manual trigger area can be found in LM's help file.
Manual2 = $7FC071		;manual trigger value for the blue blocks. manual trigger area can be found in LM's help file.

JSL $01802A
LDA $13
AND #$03
BEQ CONTINUE
LDA $14AF
BNE BLUEIN

LDA Manual1
BEQ CONTINUE
LDA Manual1
SEC
SBC #$01
STA Manual1
STA Manual2
BRA CONTINUE

BLUEIN
LDA Manual1
CMP #$03
BEQ CONTINUE
LDA Manual1
CLC
ADC #$01
STA Manual1
STA Manual2

CONTINUE


By "last", do you mean frame 03, which would be the last one you want, or FF? Hm...well, it looks like you're trying to either decrement both frames until they hit 00 or increment them both until they hit 03. Right? Also, why aren't FRAMES_BLUE and FRAMES_RED ever referenced anywhere in the code?

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
I'm making a relatively simple code.

If you have have 4 Yoshi coins then then the screen after 00 will be accessible; otherwise no...

Code
LDA #$00        ;Set the default amount of screens to be 1 screen
STA $5D         ;# of screens RAM

LDA $1422       ;Yoshi Coins RAM
CMP #$4         ;If you get 4 yoshi coins
BNE Return      ;If not equal then do nothing

LDA #$01        ;2 screens so 00, and 01.
STA $5D         ;# of screens RAM

Return:
	RTS

The # of screens RAM for some reason makes layer 1 passable... Dunno why.
Yea... i always have trouble with $5D so i just $1411 instead
Code
levelxx:
	LDA $1420		;\
	CMP #$04		;| If the player has more then 4 Yoshi Coins, Branch
	BCS Enable	;/
	STZ $1411		; Else, Don't Enable Vertical Scroll
	RTS			; Return
Enable:
	LDA #$01		;\ Enable Vertical Scroll
	STA $1411		;/
	RTS			; Return
I change my layout every 4-5 months
I have the YI graphic set, but the ghost guy\bo guys (shy guy ghost)
has a wavy ghost tail thats not connected. How do i connect it? Its NOT a diassasembly.
Originally posted by imamelia
(Also, you're using TRASM? *gags*)

I do NOT appreciate people making comments like that. please, let me use TRASM in peace. It works for me for sprites, and that's all that matters to me.

Quote

Code
FRAMES_BLUE		dcb $00,$00,$01,$02	;used when the red blocks are in
FRAMES_RED		dcb $01,$02,$03,$03	;used when the blue blocks are in

Manual1 = $7FC070		;manual trigger value for the blue blocks. manual trigger area can be found in LM's help file.
Manual2 = $7FC071		;manual trigger value for the blue blocks. manual trigger area can be found in LM's help file.

JSL $01802A
LDA $13
AND #$03
BEQ CONTINUE
LDA $14AF
BNE BLUEIN

LDA Manual1
BEQ CONTINUE
LDA Manual1
SEC
SBC #$01
STA Manual1
STA Manual2
BRA CONTINUE

BLUEIN
LDA Manual1
CMP #$03
BEQ CONTINUE
LDA Manual1
CLC
ADC #$01
STA Manual1
STA Manual2

CONTINUE


By "last", do you mean frame 03, which would be the last one you want, or FF? Hm...well, it looks like you're trying to either decrement both frames until they hit 00 or increment them both until they hit 03. Right? Also, why aren't FRAMES_BLUE and FRAMES_RED ever referenced anywhere in the code?

By "last" I mean 00 for when it's being decremented and 03 when it's being incremented. As for FRAMES_BLUE and FRAMES_RED not being referenced, they WERE originally, but I changed the code to this version in case they were the issue...but it turns out they weren't.
<Adam> I feel like smwc is a prostitute now, because we put up a porn ad for money
How do I find what freespace a patch used when using the built-in freespace thing in xkasgui? I have the smb3 powerup patch and smb3 raccoon patch that freezes the game when you get hurt, and I need to get rid of the smb3 powerup patch. FREESPACE WAS SET FOR BOTH PATCHES!!!! I need to know HOW to find, and get rid of thme in translehextion (or whatever it is)
Your layout has been removed.
Simple: look for where freespace is defined in the patch. Xkas GUI just overwrites that, so that's where the patch is inserted.

NOTE: Freespace is in bank $10 and over. Stuff like org $012137 is not freespace, but org $158FDC and !Freespace = $158FDC are.
Now with extra girl and extra hacker
Ok so the patch I want to get rid of has

org $00F5F8
JML Main
org $10EE5E

so I go into translhextion, do ctrl+g and type in $10EE5E, then replace that line with 0's to get rid of it?

edit: GRAAAAAAGH ITS NOT WORKING!!! ctrl+g or f is REALLY confusing for me in translhextion T_T
Your layout has been removed.
You have to restore the original code, which one could easily find in all.log.
Never mind, just forget it. I ported to a new ROM, its not worth the trouble anymore.
Your layout has been removed.
Originally posted by Riolu180
Originally posted by imamelia
(Also, you're using TRASM? *gags*)

I do NOT appreciate people making comments like that. please, let me use TRASM in peace. It works for me for sprites, and that's all that matters to me.


Okay...whatever floats your boat, I guess. Sorry. But you have to use xkas format for patches, which you have made, so why not use it for sprites as well?

Originally posted by Riolu180
By "last" I mean 00 for when it's being decremented and 03 when it's being incremented. As for FRAMES_BLUE and FRAMES_RED not being referenced, they WERE originally, but I changed the code to this version in case they were the issue...but it turns out they weren't.


Hm. Well, the way you have it set up, it will change the frame rapidly until that frame gets to 00 or 03. Did you test the animation on the starting screen? If you didn't catch it at the beginning of the animation, it would end up at the last frame, since you didn't set any sort of flag. Is it supposed to advance one frame at a time every time the On/Off switch changes status? Is it supposed to go through its frames until it gets to the last one and stop there? Or is it supposed to animate between frames, the frames in question depending on the switch status?

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
How can i write coins: in the front of the 5-digit coin counter?


The 4 Relics






Pokey's Adventure Userbar
Need help with your Hack?
I'll be happy to help you with you Status Bar, anything.

Code
LDX #$05
Loop:
LDA Table,x
STA $0F0A,x
DEX
BPL Loop
RTL

Table: db $0C,$18,$12,$17,$1C,$78


That's the code for it.. change the $0F0A if the counter isn't in the same place as the normal one. Make a patch using that code and make sure it runs every frame in the level, haven't tested but it should work.
In the original musics of SMW, when you is with Yoshi, some instruments of music change. In Stranded (demo 2), these instruments are activated without Yoshi on screen.
There is a way to make original musics use the instruments of when Mario is with Yoshi?
Yep. Pretty easy actually.

Code
LDA #$02
STA $1DFA



 
Originally posted by WhiteYoshiEgg
Yep. Pretty easy actually.

Code
LDA #$02
STA $1DFA

It worked perfectly! I put the code on LevelASM and worked. Thank you WhiteYoshiEgg.
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 418
  • 419
  • 420