Language…
17 users online:  AmperSam, asterkafton, ClaireChan, DanMario24YT, Everest, Gamet2004, h4shcat, Hayashi Neru, Jaiden, LightAligns, MorrieTheMagpie, Rhubarb44230,  Segment1Zone2, ShadowMistressYuko, signature_steve, simon.caio,  zuccha - Guests: 259 - Bots: 351
Users: 64,795 (2,378 active)
Latest user: mathew

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 418
  • 419
  • 420
Hey guys I'm new to SMW Central and need some help with ASM. I can't figure out what I'm doing wrong. I'm using Uberasm 1.2.0 and Asar v.137 to implement the ASM code.

In Uberasm\code\level_code I put in:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;True LevelASM Code lies ahead.
;If you are too lazy to search for a level
;Use CTRL+F. The format is as following:
;levelx - Levels 0-F
;levelxx - Levels 10-FF
;levelxxx - Levels 100-1FF
;Should be pretty obvious...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

level0:
LDA #$03
STA $7E0019
RTS
level1:
LDA #$03
STA $7E0019
RTS
level2:
LDA #$03
STA $7E0019
RTS

Then I use Asar to patch the code into my copy of SMW.

Enter patch name: asar_patch.asm
Enter rom name: mario.smc
Says:

9080EF
Assembling completed without problems.
Press any key to continue. . .

I try out my patched rom but none of the code is being implemented. I'm stuck. I've tried redownloading Uberasm and Asar but the same problem keeps happening.
The code itself looks fine so it's either the way you're patching it that causes the problem or something else in your rom.

As for the code you can make it shorter by using $19 instead of $7E0019. You can also write it like
Code
level0:
level1:
level2:
LDA #$03
STA $19
RTS


You should probably also change to uberasmtool since all the things submitted to the uberasm section is made for the tool and not for the patch since that one doesn't have all the features that the tool has.
Quick question: how exactly does the SNES handle values currently in A/X/Y when they change size ? (ex: If A is equal to #$1234 and is set back to 8-bit, is it now equal to #$12, #$34 or is it reset to #$00 ?)
The highbyte of A stays however the highbytes of X/Y are cleared.

Code
REP #$30	; A/X/Y 16-bit
	LDA #$1234
	LDX #$1234
	LDY #$1234
SEP #$30	; A/X/Y 8-bit
; A still contains #$1234 however when storing only the lowbyte is written
; You can use XBA to swap A's high/low byte
; X/Y now both contain #$0034 even when going back to index 16-bit mode
Thanks TheBiob !

Another quick question : when you loop through OAM slots and find a free one, are all the following ones guaranteed to be free too or are there exceptions ?
I guess not? Given that you can use ASM to write all over the OAM as you please.
However, if you assume that all sprites search through OAM in an increasing order and write their stuff in one slot at a time, OAM would be filled from the bottom up, thus, once you find a free slot, you CAN* assume the above ones to be free.

I don't know if SMW has some sort of OAM cleanup routine, where it searches for now empty slots through the OAM and moves everything that follows down.

*only applies if no idiot breaks this unwritten law.
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?


SMW by default assigns a set of tiles to each sprite slot, and using any more than this number will cause it to overwrite other sprites (which is what's happening when a sprite's tiles disappear). imamelia has some more information about that here.

Of course, the No More Sprite Tile Limits patch changes that behavior so that a sprite can allocate as many tiles as necessary without issue.
(as long as you aren't using more than 64 tiles at once)

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
I am still having trouble trying to insert the Separate Luigi Graphics v2.2 patch.

What am I suppose to change to make it not hang?

I tried changing the Unused RAM address and it didn't change anything. I really don't want to port to a new ROM.

Any ideas?
100% Orange Juice Playthrough:
https://www.youtube.com/playlist?list=PLf1kPWkjcurtA3xPP3TybfqSiEn1AcX2A

VLDC9 Playthrough:
https://www.youtube.com/playlist?list=PLf1kPWkjcurtiP5de_-e6q0hSVrY37RB-.


Hi,

BGSCroll.cfg (makes background automatically scroll) makes my game freeze on black screen whenever it enters the screen.

Any help? :)
How are you inserting it?
Using the latest version of Romi's Spritetool that I re-downloaded just 2 years ago to make sure it was up to date. The insert shows no error and I've tried inserting other sprites with it and they work just fine.

In Lunar Magic I place it using the Insert Button, and setting extra byte to 2.
Change the [dcb "INIT"] and [dcb MAIN"] to [print "INIT ",pc] and [print "MAIN ",pc]
Then open the .cfg file and add a new line containing a 2

Code
03
FF
FF FF FF FF FF FF
FF FF
BGSCroll.asm
2

^ should look like this then.
Hey there! I have two small questions.

1. I'm using Eric557's falling icicle sprite, and trying to have the sprite adjust its Y position by 1 pixel whenever it spawns.

The main code goes like this:
Code
print "MAIN ",pc
	PHB                       
	PHK                       
	PLB
	JSR FallingSpike        
	PLB                       

print "INIT ",pc
	RTL

Tilemap:
	db $AA,$AC
YDisp:
	db $EF,$FF

Somehow, the init section is running every frame, so adding
DEC $D8 causes the sprite to fly upwards awkwardly.

Any way I can fix this? I feel like a RAM flag would be overkill.

2. Is there a way to change a sprite's hardcoded palette without tiresome trial and error?
yoshicookiezeus' falling block has the following graphics table:
Code
X_OFFSET		dcb $00,$10,$00,$10 
Y_OFFSET		dcb $00,$00,$10,$10 
TILE_MAP		dcb $CC,$CE,$EC,$EE 
PROPERTIES		dcb $03,$0a,$03,$0b

The sprite currently uses palette 5 and I'd like it to use palette F.
1) The "Init" label is run every frame because the Main label runs the init label as well. You can change that by ending the Main routine with an RTL (Below [PLB] but above [print "INIT ",pc])

2) It's never trial and error when you know what you're doing.

The PROPERTIES table probably contains the properties so you can change the palette there. It's format is YXPPCCCT (Y/X = flipped on that axis, PP = priority, CCC = palette, T = Page)
So you want to change the CCC bits in there.

Alternativly you can modify these values before storing to $0303,y by adding

Code
AND #$F1
ORA #$00 ; palette (0 = palette 8, 2 = palette 9, 4 = palette A etc palette F would be 0E in your case)


before the STA $0303,y
Would it be possible (and if so, how?) to execute a 32-bit/16-bit unsigned division using a premade 16-bit/16-bit signed division routine? I'm asking that because I would like to use SA-1's division (which is 16-bit/16-bit signed) to execute an unsigned 32-bit/16-bit routine. The main reason is because my current ellipse windowing code is currently too heavy to process, because it has to calculate a square root + a 32-bit/16-bit division for each scanline. Another option would be if someone could give me an idea of how I could draw an ellipse without needing to 32-bit divide. It seems games such as romancing saga and final fantasy have such effects running without any slowdown, but I have no idea what's the logic behind their code.

At the moment, what my code does is calculate solve for x in x²/a²+y²/b²=1, which leads to b²x²+a²y²=a²b² -> b²x²=a²b²-a²y² -> x² = (a²b²-a²-y²)/b² (that's where the 32-bit division kicks in followed by the sqrt)

If possible, but optional, I'd also like an idea for a code which could draw also rotated ellipses. Using the general conic formula (Ax²+Bxy+Cy²+Dx+Ey+F=0) would be impracticable.

EDIT: Nevermind, doing x = (a*sqrt(b²-y²)) / b doesn't need 32-bit division and it keeps as much information as doing the other way, except this one has no slowdown. Still, if someone has an idea of how I could rotate the ellipse, I would appreciate if you tell me.
(Huh, for some reason I thought I had replied already)

Originally posted by TheBiob
1) The "Init" label is run every frame because the Main label runs the init label as well. You can change that by ending the Main routine with an RTL (Below [PLB] but above [print "INIT ",pc])


Can't believe I missed that.

Quote
Code
AND #$F1
ORA #$00 ; palette (0 = palette 8, 2 = palette 9, 4 = palette A etc palette F would be 0E in your case)

Thank you! This did the trick.

I still have a hard time making the connection between the YXPPCCCT format and the graphics table's actual code though. Sure, they're linked to the properties, but what's the underlying logic?
You mean you don't know how the numbers correspond? YXPPCCCT is just a list of bits. Do you know how to count in binary, or how to convert binary to hexadecimal and back? The first digit of a hexadecimal number is the higher 4 bits in binary, and the second digit is the lower 4 bits. So, for instance, $00 (hex) is %00000000 (binary), while $01 is %00000001, $02 is %00000010, %03 is %00000011, $04 is %00000100, and so on. Then $10 is %00010000, $11 is $00010001, and so on. Using the bytes there as an example:

Code
$03 = %00000011

Y X PP CCC T
0 0 00 001 1

$0A = %00001010

Y X PP CCC T
0 0 00 101 0

$0B = %00001011

Y X PP CCC T
0 0 00 101 1


Since none of the upper 4 bits are set, these all only change the palette and graphics page. For $03, we have T = 1, meaning that tile uses the second GFX page, and CCC = 001, meaning it uses sprite palette 1 (which is palette 9 in Lunar Magic because the sprite palettes start at 8). For $0A, we have T = 0, meaning first GFX page, and CCC = 101, meaning palette 5 (or D in Lunar Magic). Then $0B is second GFX page (1) and palette 5 (101) again.

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

I'm working on a hack! Check it out here. Progress: 64/95 levels.
Okay, I got the the Separate Luigi Graphics v2.2 patch finally working when I ported to new ROM from my Mario Babys hack. But when I selected Luigi Game after those things are done backup-ed. Luigi remains Green Mario. I tried re-inserting it and it worked, but when I try to start a game again, I noticed that the Display Message Sprite stopped working for some reason. Help?
100% Orange Juice Playthrough:
https://www.youtube.com/playlist?list=PLf1kPWkjcurtA3xPP3TybfqSiEn1AcX2A

VLDC9 Playthrough:
https://www.youtube.com/playlist?list=PLf1kPWkjcurtiP5de_-e6q0hSVrY37RB-.


Hey folks, I'm trying to do a (seemingly) simple hex edit here for Mario's overworld speed. However, it seems to be very finicky to work with, as any value I've tried results in Mario getting stuck on a path.

Is there any information on what values are valid? Or is it just a crapshoot?
You can use this patch.
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 418
  • 419
  • 420