Views: 829,071,684Time: 2020-06-06 01:25:39 AM 19 users online: Anorakun, Cartesius, chickaDEE Magazine, containercore, , Dippy, ECS.98, FluffyBucketSnake, Koopster, , Lunch Lunch, , Ralshi02, SammmUuU, , Sonck, tortillas, Yagami, yoshikirby43 - Guests: 64 - Bots: 91 Users: 44,436 (2,528 active)Latest: hulahoop
 Tip: Use PIXI to insert custom sprites into your hack. Not logged in.
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Official Hex/ASM/Etc. Help Thread
 Pages: 1 2 … 3–40534567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515260708090100110120130140150160170180190200210220230240250260270280290300310320330340350356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 … 406 407 408 409 410 411 412

Originally posted by sinseiga
I'm making time add block but when I touch it on 90 sec, timer overflows like *A*. How Can I prevent overflow in timer?

Basically, you just need to handle the overflow yourself. If any digits become 10 (0A) or more, subtract 10 from them and increase the next digit instead.

For instance, to add 30 seconds:
Code
```    LDA \$0F32
CMP #\$0A            ; is the tens digit greater than 10?
BCC +
SEC : SBC #\$0A      ; if so, subtract 10...
INC \$0F33           ; ...and increase the hundreds digit in its place
+ STA \$0F32```

If you're adding to the seconds digit (e.g. adding 5 seconds), you would do the same thing but checking both the tens digit and hundreds digit for overflow.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by Thomas
Originally posted by sinseiga
I'm making time add block but when I touch it on 90 sec, timer overflows like *A*. How Can I prevent overflow in timer?

Basically, you just need to handle the overflow yourself. If any digits become 10 (0A) or more, subtract 10 from them and increase the next digit instead.

For instance, to add 30 seconds:
Code
```    LDA \$0F32
CMP #\$0A            ; is the tens digit greater than 10?
BCC +
SEC : SBC #\$0A      ; if so, subtract 10...
INC \$0F33           ; ...and increase the hundreds digit in its place
+ STA \$0F32```

If you're adding to the seconds digit (e.g. adding 5 seconds), you would do the same thing but checking both the tens digit and hundreds digit for overflow.

That was really helpful and easy to understand it. Thx!
Hi! I was hoping someone could help me with this code I am trying to set up. The goal is to trigger event 5 when the player stands on the overworld node for level 105.

I used the formula in the RAM map listed under \$7E1F02 to determine the location of the overworld event flag for event 5. So dividing event 5 by 8 gives:

\$7E:1F02 (1F02 + 0)
#\$05 (The remainder)

Code
```LDA ----		;Load the value for the current overworld level mario is standing on into A
CMP ----		;Compare against the value for level 105
BNE Failed
LDA #\$05		;Load the value for event 5 into A
STA \$1F02		;Store the value for event 5 into the address that triggers events
RTL

Failed:
RTL

```

The main issues I am having is I can't find the addresses that deal with the value of the level Mario is currently standing on in the overworld. I am also don't think I have the correct address that will trigger an event to happen on the overworld because this code I wrote does nothing when inserted with UberASM:

Code
```main:

LDA \$16
CMP #\$08
BNE Failed
LDA #\$05
STA \$1F02
RTL

Failed:
RTL```

The idea behind this bit of code was to trigger event 5 if I pressed up while on the overworld map, but nothing happens. I made sure to include it in the correct folder and put it in the right spot in the list document in UberASM so I must have the trigger wrong.

Any help would be greatly appreciated. I have no clue how to progress.

0x50 / 8 = 0x0A, no remainder, so you want \$1F02 + A = \$1F0C, bit 0.

Also, the way to set a single bit is like so:

Code
```	LDA #\$01
TSB \$1F0C```

TSB (short for Test and Set Bits) takes the bits set in A and sets the same bits in the address (in this case, A has bit 0 set, so it sets bit 0 of \$1F0C). This prevents is from clearing the other bits in the process.

As for getting the level number Mario is on, that's a bit harder. The game doesn't actually store this directly anywhere in RAM; instead, you have to fetch it from the table at \$7ED000. SMW does have a routine to fetch the index to that, but because it's RTS-ended, you can't use it; instead, put this version of it into UberASM's library folder and use that instead (it returns the index in X).

Note, however, that even if you do all this, you won't actually activate the event animations; you're essentially just marking that event as completed, and nothing more. I'm not entirely sure what kind of work would be involved in actually doing that, though. You'd likely have to mess with \$13D9 and other related addresses.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Oh damn, I didn't realize it would be so complex. Does anyone on this site do commissions for custom code? I'm just not sure I can figure this out alone.
Hello, I recently started messing around with some UberASM code that is meant to indicate whenever a sprite is off-screen by showing an OAM tile, which is loosely based off of this patch. However I want to be able to show multiple tiles at once when there are multiple sprites off-screen and a way of showing a 16x16 tile would be helpful too, here is the code I am using for reference.

Code
```!oamIndex   =   \$0000
main:
LDA \$9D
BNE Stop
JSR Begin
Stop:
RTL

Begin:
LDX #!sprite_slots-1
Loop:
LDA \$9E,x
CMP #\$06
BCS Skip
LDA !14C8,x
BEQ Skip
CMP #\$02
BEQ Skip
LDA !14D4,x
XBA
LDA !D8,x
REP #\$20
CMP #\$00A0
BPL Skip

LDA \$E4,x
SEC
SBC \$1A
STA \$7FA304
SEP #\$20

LDA \$E4,x
SEC
SBC \$1A
STA \$0200+!oamIndex
LDA #\$10
STA \$0201+!oamIndex
LDA #\$2C ;1D
STA \$0202+!oamIndex
LDA #\$28
STA \$0203+!oamIndex
STZ \$0420+(!oamIndex/4)
Skip:
SEP #\$20
DEX
BPL Loop
RTS```

If you want to display multiple indicators, you need to allocate multiple OAM indices, one per sprite slot (for the \$0200 range, check this page). The easiest way to do this is just to declare a table of the indices (in 8-bit), and then index that table by X to get the slot's index. Then put that value into Y and index the OAM addresses like "\$0200,y" instead of "\$0200+!oamIndex". For the \$0420 line, first divide Y by 4 before indexing it (i.e. "TYA : LSR #2 : TAY").

To use 16x16 indicators instead of 8x8, just change "STZ \$0420" to "LDA #\$02 : STA \$0420".

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Hi

On the orange platform disassembly, is there a way to change its X speed when there is no buoyancy?

The code

Just to be sure, I tried changing B6 to, for example, D6 in
Code
`STA !B6,x           ; set the sprite's X speed`

but as I expected, the B6 isn't the value of the speed (or at least, you can't change it just like that).
So my guess is that I need a command to tell him to change that speed that is probably pre-set, in the routine maybe?

--------------------
Super Mario Pants World
Luigi's Lost Levels
New Super Mario Pants World

\$B6 is the address that holds the sprite's speed. You're looking for the "LDA #\$08" line above that, which is the actual value stored there.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by Thomas
\$B6 is the address that holds the sprite's speed. You're looking for the "LDA #\$08" line above that, which is the actual value stored there.

I thought about that but it talks about background... should have tried I guess, instead of not daring :/

Thanks a lot

--------------------
Super Mario Pants World
Luigi's Lost Levels
New Super Mario Pants World
I've been trying to figure out a good way of inserting a new subroutine into my ROM that I want to be able to call from anywhere via its address after insertion, basically just want to insert a subroutine without hijacking anything. I was wondering if asar has an elegant way for doing this kind of stuff and if not what the best way of working around this would be. I'd greatly appreciate any possible help!

EDIT: For now I basically just did it the xkas way, assigning freespace and inserting RATS tags manually, but I'd assume there's probably a better way of doing it.
Code
```init: LDA #\$02
RTA \$0100
RTL```

This code takes you back to the title screen when the level inserted it in is passed, but it's not working. Any help?

Currently: Bringing back the footer I had in 2013.
It's because... you used an "RTA" (a non-existant opcode in 65c816 ASM) instead "STA" (an actually existing opcode in 65c816 ASM).

--------------------
Okay, my layout looks ugly.
My bad, it was a typo, however it crashes my level when I use either UberASM or UberASMTool

Currently: Bringing back the footer I had in 2013.
A bit of context would probably help. What are you trying to do exactly? Right now, the code seems to warp you straight to the title screen no matter what (no "is this level passed" checks).

If code crashes, often the first thing you try is swap RTL for RTS (or vice versa), because some tools require different routine endings. It sounds like you did that already, though, so huh.

This is just a guess: perhaps the code shouldn't be in init? Maybe changing the game mode while a level is loading can break something. Have you tried main instead?

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

Originally posted by WhiteYoshiEgg
A bit of context would probably help. What are you trying to do exactly? Right now, the code seems to warp you straight to the title screen no matter what (no "is this level passed" checks).

If code crashes, often the first thing you try is swap RTL for RTS (or vice versa), because some tools require different routine endings. It sounds like you did that already, though, so huh.

This is just a guess: perhaps the code shouldn't be in init? Maybe changing the game mode while a level is loading can break something. Have you tried main instead?

I want to use both the level ender included in PIXI and this code to warp me back to the title screen. However when I test the code in UberASMTool, it just spazzes out. I don't really know what I'm doing wrong honestly.

Currently: Bringing back the footer I had in 2013.
Would anyone have any idea why the SRAM Plus Patch would be causing nothing to save to File B, but File A and C are fine?
i try to fix your death counter Thomas for the new retry patch and custom powerups patch. If i us you code like it is i get what you see on the img.
https://imgur.com/wdkAgsX

I hope you can help me fixing it
Do you guys think it's technically possible to fix the Moving Ledge Hole? What I mean is, when you jump through it, the hitbox moving makes it pretty janky (like if you spin through it, you will clip on an invisible block inside the hole).
I'm not sure there's anything doable about that, but maybe there is.

--------------------
Super Mario Pants World
Luigi's Lost Levels
New Super Mario Pants World
Originally posted by Romano338
Do you guys think it's technically possible to fix the Moving Ledge Hole? What I mean is, when you jump through it, the hitbox moving makes it pretty janky (like if you spin through it, you will clip on an invisible block inside the hole).
I'm not sure there's anything doable about that, but maybe there is.

Definitely not pretty, but it's working for me:

Code
```!sa1	= 0			; 0 if LoROM, 1 if SA-1 ROM.
!dp	= \$0000			; \$0000 if LoROM, \$3000 if SA-1 ROM.
!addr	= \$0000			; \$0000 if LoROM, \$6000 if SA-1 ROM.
!bank	= \$800000		; \$80:0000 if LoROM, \$00:0000 if SA-1 ROM.
!bank8	= \$80			; \$80 if LoROM, \$00 if SA-1 ROM.

; Check if SA-1 is present.
!sa1	= 1
!dp	= \$3000
!bank	= \$000000
!bank8	= \$00

sa1rom
endif

if !sa1 == 0
else
endif
endmacro

%define_sprite_table("D8", \$D8, \$3216)
%define_sprite_table("E4", \$E4, \$322C)
%define_sprite_table("14D4", \$14D4, \$3258)
%define_sprite_table("14E0", \$14E0, \$326E)

org \$02E5E8|!bank
autoclean JML MovingHoleMarioContact

org \$02E61F|!bank
autoclean JML MovingHoleSpriteContactClipping

freedata
print "Code is located at: \$", pc
MovingHoleMarioContact:
JSL \$03B664|!bank

LDA !E4,x
CLC
STA \$04

LDA !14E0,x
STA \$0A

LDA #\$10 ; Width of sprite clipping
STA \$06

LDA !D8,x
SEC
SBC #\$02
STA \$05

LDA !14D4,x
SBC #\$00
STA \$0B

LDA #\$1A ; Height of sprite clipping
STA \$07

JSL \$03B72B|!bank
JML \$02E5EC|!bank

MovingHoleSpriteContactClipping:
LDA !E4,x
CLC
STA \$04

LDA !14E0,x
STA \$0A

LDA #\$10 ; Width of sprite clipping
STA \$06

LDA !D8,x
SEC
SBC #\$02
STA \$05

LDA !14D4,x
SBC #\$00
STA \$0B

LDA #\$2A ; Height of sprite clipping
STA \$07
JML \$02E623|!bank
```

--------------------
 Pages: 1 2 … 3–40534567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515260708090100110120130140150160170180190200210220230240250260270280290300310320330340350356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 … 406 407 408 409 410 411 412
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Official Hex/ASM/Etc. Help Thread

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