Banner
Views: 790,862,691
Time:
13 users online: Arobam, blaze800000, Diego, ExONightZ, Face, Flamesofshadow, goldenrules, Green Jerry, Linatic, Nic Nac,  Ninja Boy,  Sayuri, WhiteYoshiEgg - Guests: 42 - Bots: 207 Users: 41,293 (1,503 active)
Latest: suri
Tip: Before asking for help on the forums, make sure you've tried to figure out the problem on your own first.Not logged in.
Official Hex/ASM/Etc. Help Thread
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Official Hex/ASM/Etc. Help Thread
Pages: « 1 2398 399 400 401 402410 411 »
the m7 battles run their own nmi thing (starting at $0082C4), and then jump to $008294 aka the middle of your hijack.
That makes a lot of sense! I had found $0082C4 in SMWDisC but didn't actually look that far down.

Ladida to the rescue again. Thanks a bunch!

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


 
Can someone help me make this thing shoot custom sprites (if that's even possible)?

I don'tlike to ask for people to do things for me but when it comes to Sprite related ASM, I have absolutely zero clue on how to; and this is a MUST for the thing I'm working on... actually it's my last resort lul.

I've only tried one thing so far, and that was replacing the part that was supposed to handle the spawning of sprites with the "Is Custom" one found in MFG's Custom Shooter sprite. It's no surprise but it breaks everything :D
Im messing around with custom triggers but im having no success at all.

For this im using custom blocks.

so im trying to set 1 bit. im doing this:
Code
	REP #$20
	LDA $7FC0FC 
	ORA #$0001
	STA $7FC0FC
	SEP #$20


BUT looking at $7fc0fc its always set to 5555.
Makes sense it not changing because the bit is already set.
So i wanted to reset 7fc0fc doing just an stz:
Code
	
	REP #$20
	STZ $7FC0FC 
	SEP #$20


BUT gps returns me:
Code
blocks/CustomTriggerSTZ.asm:23: error: Unknown command.
 [STZ $7FC0FC]


Whats going on?
The #$5555 is probably just the default value for uninitialized RAM in whatever emulator you're using. Lunar Magic has an option to initialize custom triggers; you can find it under the "Trigger Init" button in the ExAnimation menu.

And STZ doesn't work with 24-bit addresses. You'd have to do
Code
	REP #$20
	LDA #$0000
	STA $7FC0FC 
	SEP #$20
instead.
is there any problem if i treat 7fc0fc and 7fc0fd as 2 distinct 8-bit adresses?
Nope, that's also fine.
I'm trying to properly implement switch palace messages in my Message Box Expansion patch so I'm recreating the "draw switch block tiles in the message box" routine. I've run into a small issue here: the tiles are being drawn, but they appear behind the windowing, so they're hidden. The tiles are already given full priority, and they're using the same slots as in the original game.

What does SMW do (or rather, what can I do) to make the tiles appear in front of the window?


edit: got it working - looks I had the wrong values in the $41-$43 area. Don't know which of the settings was the wrong one, but copypasting SMW's values did the trick.

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


 
How do I directly write tiles to layers via ASM? Is there any documentation on that subject?
I can only think of the Status Bar IRQ map, but that's also very limited when working with custom status bar patches.
(I don't even understand what an interrupt request is to begin with)


In order to write tiles, you need do two things:
1) Upload any onscreen tiles to VRAM, to change those tiles visually ($7F837D).
2) If you require interaction (for Layer 1/2), update the Map16 tables in RAM ($7EC800 and $7FC800). This will also handle graphics for offscreen tiles as they scroll onscreen.

The first part is the important thing. If you want to update any onscreen tiles (including anything in Layer 3), you need to update VRAM accordingly. Thankfully, SMW has a nice framework for doing so in $7F837D, using a format known as the "stripe image format". It's called such because tiles are uploaded in horizontal or vertical "stripes", of course. The basic format is just a four-byte header containing information about the stripe, and then a sequence of bytes for each tile in it (in 2-byte pairs, one byte for the tile number and another for the YXPPCCCT properties).

To actually use $7F837D then, simply load the current index from $7F837B, then go through $7F837D writing your bytes (usually, it's easiest to just write them into a table and loop through that). Once you're done writing all your stripes, append an $FF byte to end the data and update $7F837B with the index to that byte.
(as an example, here's how the file select stripe image looks. hopefully it should make sense if you stare at it long enough)



For the second part, you have to do a little bit more work, since the Map16 tables aren't exactly simple to index. To actually find the index, I'd recommend taking a look at SMW's original code for doing so between $00BEBE and $00BF2F; when that code finishes, it stores the two 24-bit pointers to the tile (based on its position in $98-$9B) into $6B and $6E.
Of course, if you're writing a large number of tiles, you'd want to optimize this; just find the location for one tile, then increment the pointer as you go to write the rest.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
How do i round a value? lets say 54 to 50, or 5A to 60.

Ive looked at most ASM tutorials ive found and apparently theres no thing like floor/ceil.

So im thinking about a bit operation maybe?
heres what im thinking (probably really dumb):

Code
LDA #$54
ORA #$0F 	;bits 0n
EOR #$0F	;bits Off
; the result should be 50 right?!?


im not really sure how to test it.. but in theory if i do the same with 5A it will give me the same result!? so how would go to round it to 60?
or am i tripping?
Originally posted by NaroGugul
How do i round a value? lets say 54 to 50, or 5A to 60.

Ive looked at most ASM tutorials ive found and apparently theres no thing like floor/ceil.

So im thinking about a bit operation maybe?
heres what im thinking (probably really dumb):

Code
LDA #$54
ORA #$0F 	;bits 0n
EOR #$0F	;bits Off
; the result should be 50 right?!?


im not really sure how to test it.. but in theory if i do the same with 5A it will give me the same result!? so how would go to round it to 60?
or am i tripping?


The result of that is indeed 50, however if you want to unset bits it's easier to mask them out using AND rather than setting them, then flipping them again

Code
LDA #$54
AND #$F0
;;result A = 50

The AND sets the second digit to 0 in this case.

To round up you'd set the bits instead then add one
Code
LDA #$54
ORA #$0F
;; result A = 5F
INC
;; result A = 60



then you can combine these to make it round

Code
Round:
	BIT #$08	; Check bit 3
	BNE +		; If it's set, round up
	AND #$F0	; Otherwise round down
	RTS
+	ORA #$0F	; Round up
	INC : RTS


example:
Code
LDA #$54
JSR Round
;; Result A = 50
LDA #$5A
JSR Round
;; Result A = 60
Hi

I'd like to change Wendy's Y position, because it's pretty high on the screen and I need more room above.
The ROM Map is $03CCB7 for her initial Y position.

I have no idea how to do the next step though. I don't know how to find the value I need to put to have a lower Y-position (I'd like something around 2-3 tiles lower, but I'd like to be able to play around a bit by myself without asking all the time).

Thanks for help

--------------------
Super Mario Pants World by Romano338 - Playthough
Luigi's Lost Levels by Romano338 - Playthough
Baby Kaizo World by Romano338 [Cancelled] playthrough


Wendy's initial position is set to 0x50, which corresponds to 5 blocks down from top of the subscreen (subscreen referring to the 16x16 blocks of tiles that you see when you press F2 in LM). To move her down one more tile, add 0x10 to make it 0x60. And then another would be 0x70, and so forth so on.

So, to move Wendy down two tiles, you would patch this:
Code
org $03CCB7
	db $70


Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by Thomas
Wendy's initial position is set to 0x50, which corresponds to 5 blocks down from top of the subscreen (subscreen referring to the 16x16 blocks of tiles that you see when you press F2 in LM). To move her down one more tile, add 0x10 to make it 0x60. And then another would be 0x70, and so forth so on.

So, to move Wendy down two tiles, you would patch this:
Code
org $03CCB7
	db $70


Thank you, I'll do that ;)
How do you find out what the original value is? In a hex editor?

--------------------
Super Mario Pants World by Romano338 - Playthough
Luigi's Lost Levels by Romano338 - Playthough
Baby Kaizo World by Romano338 [Cancelled] playthrough
thank you TheBiob
i think im finally starting to understand some of the basics of asm logic
How do I change this custom sprite's palette from the ASM file?

I inserted a custom shooter with PIXI (a shooter given with PIXI), and the CFG Editor doesn't let me modify anything.
My problem is, I want the shooter to shoot something else than bullets, so I changed that bullet's graphics for the level, except now, what I want isn't in the right palette...

I read an old thread talking about "$0303" where I could change the palette (in YXPPCCCT format), but I don't have that in my file.

Here is the file:

Code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; original shooters by mikey and 682
; update and sa-1 support by JackTheSpades
;
; Vertical (up and down) Bullet Bill Shooter
; 
; Extra Bit Set   = Shoots Up
; Extra Bit Clear = Shoots Down
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


; Cheat Sheet for Bullet Bill $C2,x						  
; #$00 = Right
; #$01 = Left
; #$02 = Up
; #$03 = Down
; #$04 = Right Up
; #$05 = Right Down
; #$06 = Left Down
; #$07 = Left Up

!C2ExSet = $02
!C2ExClr = $03

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite code JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print "INIT ",pc 
print "MAIN ",pc                                    
		PHB                     
		PHK                     
		PLB                     
		JSR SPRITE_CODE_START   
		PLB                     
		RTL      

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main bullet bill shooter code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Return:
		RTS                     ; RETURN
		
SPRITE_CODE_START:
		
		LDA #$60 : CLC          ; \ if necessary, restore timer to 60 and ignore Mario next to shooter
		%ShooterMain()          ; | check if time to shoot, return if not. (Y now contains new sprite index)
		BCS Return              ; /

Shoot:
		LDA #$09                ; \ play sound effect
		STA $1DFC|!Base2        ; /
		;LDA #$01                ; \ set sprite status for new sprite
		;STA !14C8,y             ; /
		LDA #$1C                ; \ set sprite number for new sprite
		STA.w !9E,y             ; /
		LDA $179B|!Base2,x      ; \ set x position for new sprite
		STA.w !E4,y             ;  |
		LDA $17A3|!Base2,x      ;  |
		STA !14E0,y             ; /
		LDA $178B|!Base2,x      ; \ set y position for new sprite
		SEC                     ;  | (y position of generator - 1)
		SBC #$01                ;  |
		STA.w !D8,y             ;  |
		LDA $1793|!Base2,x      ;  |
		SBC #$00                ;  |
		STA !14D4,y             ; /
		PHX                     ; \ before: X must have index of sprite being generated
		TYX                     ;  | routine clears old sprite values...
		JSL $07F7D2             ;  | ...and loads in new values for the 6 main sprite tables
		PLX                     ; / 
		LDA #$08                ;
		STA !14C8,y             ;

		
		LDA $1783|!Base2,x      ; \
		AND #$40                ;  |
		BEQ +                   ;  |
		LDA #!C2ExSet           ;  | get C2 value depending on extra bit of sprite.
		BRA ++                  ;  |
+		LDA #!C2ExClr           ;  |
++		STA.w !C2,y             ; /
		
		JSR Smoke_spawn
		RTS

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; display smoke effect bullet bill shooter
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
Smoke:
.y_off:	db $00,$00,$00,$00,$FA,$04,$04,$FA
.x_off:	db $00,$00,$00,$00,$04,$04,$FA,$FA	  

.spawn
		PHX                     ;
		LDA !C2,y               ; \ Get index for smoke sprite offset.
		TAX                     ; | 
		LDA .x_off,x : STA $00  ; | x offset
		LDA .y_off,x : STA $01  ; | y offset
		LDA #$1B : STA $02      ; | smoke timer
		LDA #$01                ; | smoke sprite
		TYX                     ; | cheating*
		%SpawnSmoke()           ; / ~SPAWNING~
		PLX
		RTS           
		
;*cheating because the SmokeSprite routine is actually intended for sprites, not shooters.
;however, since we just spawned a sprite (which's index is in Y) we can just take it's index
;and put it into x


Basically, right now the sprite palette of the level is set on 0 (palette 9 overall), and I'd like to change to, let say, palette 10 overall.

Is it even possible?
Thanks

PS: If I can disable the smoke too, I'd be interested

--------------------
Super Mario Pants World by Romano338 - Playthough
Luigi's Lost Levels by Romano338 - Playthough
Baby Kaizo World by Romano338 [Cancelled] playthrough
The shooter doesn't have graphics, it just spawns a sprite. You'd want to change the palette of the sprite it spawns either via tweaker or in the asm file of the sprite if it's custom.

As for disabling smoke you can just remove everything below and including "Smoke:" as well as "JSR Smoke_spawn"
I'm not too sure I know how to do that.
So my shooter spawns a vertical bullet bill, but I didn't have the good GFX fileso the sprite looked like blaarg eyes. So I edited that file, and changed the blaarg eyes to a lighting bolt (like the one the sumo bros kicks to the ground). That bolt isn't originally on the graphic files I use on the level (I use the underground sprite set).

To keep the other sprite with their right color (like the spike top), I kept the original Sprite palette( which is palette 0 in the palette menu). But there is no yellow on that palette, so my lighting bolt is grey.

So the sprite I want to change the palette of isn't custom, we agree on that I guess? The shooter, yes, not the sprite ?
So I need to use Tweaker (never heard of, I found it in the tools section)?


Sorry for the big text and confirmation-asking, I'm trying to get into sprite insertion and after 2 days my mind is kind of foggy on what I can/can't do and how I can/can't!

EDIT: Oh, it looks like Tweaker would modify it for the whole game #tb{D:}

--------------------
Super Mario Pants World by Romano338 - Playthough
Luigi's Lost Levels by Romano338 - Playthough
Baby Kaizo World by Romano338 [Cancelled] playthrough
Yes, tweaker modifies it for the whole game, if you do not want that you need to use custom disassembly of the sprite with a changed palette and spawn that. I'm not sure if that sprite has a disassembly though
Pages: « 1 2398 399 400 401 402410 411 »
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.

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


Total queries: 7

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • SMBX Community
  • ROMhacking.net
  • MFGG