Banner
Views: 853,101,584
Time:
10 users online: Daizo Dee Von, Darolac, Fermín Acosta Jr., kamekku14, M6 Productions,  MarioFanGamer, Para_0,  Sinc-X, SiulLunar, Zerio - Guests: 38 - Bots: 61 Users: 47,051 (2,518 active)
Latest: Natedogg62
Tip: If you use custom music, make sure your ROM has been expanded to at least 1MB.Not logged in.
Please help
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Please help
Pages: « 1 2 »
Something like this should do the trick:

Code
!XOffset = $10
!YOffset = $10


LDA $D1
CLC
ADC #!XOffset
STA $E4,x

LDA $D2
ADC #$00   
STA $14E0,x

LDA $D3
CLC
ADC #!YOffset
STA $D8,x

LDA $D4
ADC #$00
STA $14D4,x


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


 
You'll need to store the sprites position to Mario's.

Something like this:
Originally posted by
LDA $94 ; / Mario's X Position > Sprites X Position *low*
STA $E4,x ; \
LDA $95 ; / Mario's X Position > Sprites X Position *high*
STA $14E0,x ; \
LDA $96 ; / Mario's Y Position > Sprites X Position *low*
STA $D8,x : \
LDA $97 ; / Mario's Y Position > Sprites X Position *high*
STA $14D4,x : \



e: yeah, mines different, though :P

Give Mario some love?~
aaaand, I'm a fail

Change this:
STA $D8,x : \
LDA $97 ; / Mario's Y Position > Sprites X Position *high*
STA $14D4,x : \

To this:
STA $D8,x ;
LDA $97 ; / Mario's Y Position > Sprites X Position *high*
STA $14D4,x ;

Or, just move the semicolons completely.

Give Mario some love?~
It seems much more likely that the source of the error is that he is missing a SPRITE_ROUTINE label. Oh, and there's also no JSR To SUB_GFX.

--------------------
Now with extra girl and extra hacker
What error exactly does temp.log give you?

Also, you don't need to include the library routines when you post your code, since we already know that those work.

--------------------
My YouTube channel
Get the official ASMT resource pack here!

are you sure the sprite isn't just being covered up by Mario?

To check this, replace this:

LDA $94 ; / Mario's X Position > Sprites X Position *low*
STA $E4,x ; \
LDA $95 ; / Mario's X Position > Sprites X Position *high*
STA $14E0,x ; \
LDA $96 ; / Mario's Y Position > Sprites X Position *low*
STA $D8,x ;
LDA $97 ; / Mario's Y Position > Sprites X Position *high*
STA $14D4,x ;

With this:

LDA $94 ; / Mario's X Position > Sprites X Position *low*
STA $E4,x ; \
LDA $95 ; / Mario's X Position > Sprites X Position *high*
STA $14E0,x ; \
REP #$20
LDA $96 ; /
SEC
SBC.W #$0020
SEP #$20
STA $D8,x
XBA
STA $14D4,x
Uh... maybe because you're still missing a JSR to SUB_GFX?

Stick "JSR SUB_GFX" (w/o quotes) right before the very first "RTS".

--------------------
Now with extra girl and extra hacker
Okay, You're obviously crashed the game. Can I see the full code?

--------------------
Now with extra girl and extra hacker
Well, I'm not good at ASM ... But try this


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; INIT and MAIN JSL targets
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

dcb "INIT"
RTL

dcb "MAIN"
PHB
PHK
PLB
JSR SPRITE_ROUTINE
PLB
RTL


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SPRITE_ROUTINE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

SPRITE_ROUTINE

JSR SUB_GFX

SpriteCode:
JSR Graphics
LDA $14C8,x ;\
CMP #$08 ; | If the sprite is dead or not it it's normal state, return.
BNE RETURN ;/
LDA $9D ;\
BNE RETURN ;/ If sprites are locked, return.

JSL $01A7DC
LDA $94 ; / Mario's X Position > Sprites X Position *low*
STA $E4,x ; \
LDA $95 ; / Mario's X Position > Sprites X Position *high*
STA $14E0,x ; \
LDA $96 ; / Mario's Y Position > Sprites X Position *low*
STA $D8,x ;
LDA $97 ; / Mario's Y Position > Sprites X Position *high*
STA $14D4,x ;

RETURN:
RTS


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

SUB_GFX JSR GET_DRAW_INFO ; after: Y = index to sprite OAM ($300)
; $00 = sprite x position relative to screen boarder
; $01 = sprite y position relative to screen boarder

LDA $157C,x ; $02 = sprite direction
STA $02

LDA $00 ; set x position of the tile
STA $0300,y

LDA $01 ; set y position of the tile
STA $0301,y

LDA #$C2 ; set tile number
STA $0302,y

LDA $15F6,x ; get sprite palette info
PHX
LDX $02 ; flip the tile if the sprite direction is 0
BNE NO_FLIP_1
ORA #$40
NO_FLIP_1 PLX
ORA $64 ; add in the priority bits from the level settings
STA $0303,y ; set properties

INY ; get the index to the next slot of the OAM
INY ; (this is needed if you wish to draw another tile)
INY
INY

LDY #$02 ; #$02 means the tiles are 16x16
LDA #$00 ; This means we drew one tile
JSL $01B7B3
RTS
Originally posted by undefinied3
JSR Graphics

I don't see this label anywhere in the code. Does Spritetool really assemble your sprite without errors?

Also, what's the point of the SpriteCode label?

--------------------
My YouTube channel
Get the official ASMT resource pack here!

You might want to consider using Pastebin.com when you have large codes to post.

Here's a reason it's crashing. I had a similar problem when trying to store Mario's position to a sprite without adding these checks...

LDA $14C8,x
CMP #$08
BNE Return
LDA $9D
BNE Return

Put that under SPRITE_ROUTINE

and directly above SPRITE_ROUTINE put

Return RTS

So it'll look like

Return RTS
SPRITE_ROUTINE

LDA $14C8,x
CMP #$08
BNE Return
LDA $9D
BNE Return

And put the rest of the code below. Also it's suggested that you place

JSR SUB_GFX

Directly under SPRITE_ROUTINE like so...

**What your sprite should finally look like below with uneeded codes removed**


Originally posted by Code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; INIT and MAIN JSL targets
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

dcb "INIT"
RTL

dcb "MAIN"
PHB
PHK
PLB
JSR SPRITE_ROUTINE
PLB
RTL


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SPRITE_ROUTINE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Return RTS
SPRITE_ROUTINE

JSR SUB_GFX

LDA $14C8,x
CMP #$08
BNE Return
LDA $9D
BNE Return

LDA $94 ; / Mario's X Position > Sprites X Position *low*
STA $E4,x ; \
LDA $95 ; / Mario's X Position > Sprites X Position *high*
STA $14E0,x ; \
LDA $96 ; / Mario's Y Position > Sprites X Position *low*
STA $D8,x ;
LDA $97 ; / Mario's Y Position > Sprites X Position *high*
STA $14D4,x ;

JSR SUB_OFF_SCREEN_X0 ;YOU WANT TO INCLUDE THIS OR THE SPRITE WILL PROCESS OFFSCREEN AND CREATE POTENTIAL LAG.

RTS

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

YDISP: dcb $F0,$F0,$00,$00 ;LOOK AT THIS PART!!! IT'S NO WONDER THAT YOUR SPRITE WAS CRASHING BECAUSE YOU PUT THIS HEX IN THE MIDDLE OF THE CODE, AND IT WASN'T TRREATED AS AN ACTUAL TABLE BUT AS ACTUAL CODE!!!
XDISP: dcb $10,$00,$10,$00 ;IT SHOULD BE ABOVE THE CODE LIKE THIS INSTEAD

SUB_GFX JSR GET_DRAW_INFO ; after: Y = index to sprite OAM ($300)


LDA $157C,x ; $02 = sprite direction
STA $02

LDA $00 ; set x position of the tile
STA $0300,y

LDA $01 ; set y position of the tile
STA $0301,y

LDA #$C2 ; set tile number
STA $0302,y

LDA $15F6,x ; get sprite palette info
PHX
LDX $02 ; flip the tile if the sprite direction is 0
BNE NO_FLIP_1
ORA #$40
NO_FLIP_1 PLX
ORA $64 ; add in the priority bits from the level settings
STA $0303,y ; set properties

INY ; get the index to the next slot of the OAM
INY ; (this is needed if you wish to draw another tile)
INY
INY

LDY #$02 ; #$02 means the tiles are 16x16
LDA #$03 ; This means we drew one tile
JSL $01B7B3
RTS



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ROUTINES FROM THE LIBRARY ARE PASTED BELOW
; You should never have to modify this code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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


This is your main problem that is causing crashing:

SUB_GFX

JSR GET_DRAW_INFO ; after: Y = index to sprite OAM ($300)

YDISP: dcb $F0,$F0,$00,$00
XDISP: dcb $10,$00,$10,$00

LDA $157C,x ; $02 = sprite direction
STA $02

;etc...

You have a table in the middle of your code. TRASM/XKAS will write this as...

JSR GET_DRAW_INFO

BEQ $F0 ;Branch if zero F0 bytes. This will likely branch to empty space which will register as BRK #$00 or something.

BRK #$00 ;This is the disassembly of the hex in the table as if they were opcodes. BRK will crash the game almost always.

BPL $00 ;Branch if Positive
BPL $00 ;Zero bytes forward... lolwut. Useless.

LDA $157C,x
STA $02

;etc...

If you look at my tutorial on "Disassemble ASM" you'll find out how hex such as tables can also represent opcodes. For a list of this, the documents section has a file called HEX2ASM.

For example, here are the hex equivalents of a few opcodes.

9A = TXS Implied
9B = TXY Implied
9C = STZ $xxxx Absolute
9D = STA $xxxx,X Absolute Indexed,X
9E = STZ $xxxx,X Absolute Indexed,X
9F = STA $xxxxxx,X Absolute Long Indexed,X
A0 = LDY #$xx Immediate
A1 = LDA ($xx,X) DP Indexed Indirect,X
A2 = LDX #$xx Immediate
A3 = LDA $xx,S Stack Relative
A4 = LDY $xx Direct Page

--------------------
I own a community of TF2 servers!

ASMT - A new revolutionary ASM system, aka 65c816 ASseMbly Thing
SMWCP - SMW Central Presents a Product- tion long name

frog

http://esolangs.org/wiki/MarioLANG
Pages: « 1 2 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Please help

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2020 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy