Language…
7 users online: Daizo Dee Von, ezdeez85, GRIMMKIN,  Ringo,  Segment1Zone2,  Telinc1, toady - Guests: 241 - Bots: 336
Users: 64,795 (2,375 active)
Latest user: mathew

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 418
  • 419
  • 420


It actually is the one at $009250. SMW only calls the routine on power-on, but leaves the HDMA in channel 7 so it continues to be used.
(if you ever write another DMA to channel 7, it ends up getting bombed)

To clarify, here's the table it writes, in a more clear format:
Code
DMAWindowData:          ;$009277    | Windowing DMA settings and data, stored to $4370-$4374.
    db $41,$26                      ;  Translation: write data pointed to by $00927C to $2126/$2127 (window left/right positions).
    dl $00927C

DATA_00927C             ; $00927C   | Pointers to the windowing data in RAM.
    db $F0 : dw $04A0
    db $F0 : dw $0580
    db $00


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


I'd like to be able to use multiple types of HDMA in an area, but simply copy-pasting the code together in one document turns up an error. I'm not sure how the code should be modified to fit them all in, but simply commenting out the offending errors will result in a game crash, so I'm certain that's not the solution.

I'm trying to insert foreground, background, and wavy effects, and they do each use a separate channel.


Other Submissions of mine!
The problem is that you put. But afaik only one label can be defined at time and creating a second one (usually) causes an error.

You should rename all of the INIT and MAIN lables into different ones and create a new init and main label. The new ones contain JSL (or JSR if the HDMA codes ends with RTS) to the HDMA codes.

For example, one INIT is renamed as "HDMA1_Init", another one as "HDMA2_Init" and the third one as "HDMA_Init3" and the new init code is this:
Code
init:
	JSL HDMA1_Init
	JSL HDMA2_Init
	JSL HDMA3_Init
RTL

Repeat the same with the main code.

AND keep in mind that foreground and background HDMAs are technically the same type of HDMA, it's just that foreground HDMAs mess with colour maths (read: simple transparency) and priority which gives the illusion that the HDMA applies to the foreground even though it's still on the background and the foreground (save for some sprites) is transparent to it.
Wavy HDMA and gradients work together fine, though, due to affecting different things (one is the background colour, the other the scrolling of a background).
Hey. I'm creating a block that cuts Mario's speed when he walks through it. The problem is that he can't walk through it, the block acts like its solid no matter what I do.

I've tried looking through other's blocks uploaded here and I don't see anything that distinguishes that the block is solid or not. Basically how do I make it intangible. Thanks much.
Unless you change its behavior in the code, a block will act like the tile it's set to act like in Lunar Magic. Check the "Act as" field in the Map16 editor - 130 is solid and 25 is passable, just to name two. (Those are tile numbers - tile 130 is the cement block, tile 025 is what fills empty space, and so on.)

If you want to change the setting in the block's code (which doesn't seem necessary here), try something like this:

Code
LDY #$01 ; high byte of map16 tile number (iirc)
LDA #$30 ; low byte of map16 tile number (iirc)
STA $1693 ; this would make the block act like tile 130 no matter what LM says



 
I found here a way to disable all controls in a level, but I think I'm missing something in the code.
I did this, which I think would be ok if I used Asar to apply it to the whole hack:
Code
header
lorom

	STZ $15
	STZ $16
	STZ $17
	STZ $18


But I want it in ONE level and UberASM tells me I'm "missing load/init/maint/nmi label". I know UberASM has some particular things to put in it, which I don't really know.
Do I just need to get rid off hearder and lorom and add RTL at the end? Or add maint: or init: at the beginning? Or something else?

Thanks
Super Mario Pants World
Luigi's Lost Levels
New Super Mario Pants World
Luigi's Lost Levels 2 - Back With A Revenge
Luigi's Lost Levels 3 - Electrik Boogaloo
VLDC12 - 72HoKaizo#1
@Romano
yeah, remove the header and lorom then add main: to the top and an RTL to the bottom.
init is for code that only runs when the level starts, main is for code that runs every frame
not sure about the others
I'm trying to make a block that when bounced sideways like the sideways turnblocks, generates a custom sprite and then turns into the SMW default sideways turnblocks.

Anyone know how do I set-up it so it will just bounce from the sides and not from below/above?

Code
!use_kaijyuu_map16	= 0
!bounce_num		= $04
!bounce_block		= $11

db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide
JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireball
JMP TopCorner : JMP BodyInside : JMP HeadInside

MarioAbove:		
TopCorner:		
		LDA	#$03
		BRA	SharedCode
		
SharedSprite:		
		%sprite_block_position()
MarioCape:	
MarioSide:	
MarioBelow:		
		LDA	#$00
SharedCode:		
		PHY	
		PHX	
		TAY	
	if !use_kaijyuu_map16 == 1
		LDA	$03
		PHA	
		LDA	$04
		PHA	
	endif		
		LDA	#!bounce_num ($1699)
		LDX	#!bounce_block
		%spawn_bounce_sprite()
	if !use_kaijyuu_map16 == 1
		PLA	
		STA	$04
		PLA	
		STA	$03
		TYA	
		ASL	
		TAX	
		REP	#$20
		LDA	$03
		STA	$7FAB94,x
		SEP	#$20
	endif		
		LDA	#$02
		STA	$9C
		JSL	$80BEB0
		PLX	
		PLY	
		
BodyInside:		
HeadInside:	
SpriteV:		
SpriteH:	
MarioFireball:		
		RTL	
Originally posted by Yan
I'm trying to make a block that when bounced sideways like the sideways turnblocks, generates a custom sprite and then turns into the SMW default sideways turnblocks.

Anyone know how do I set-up it so it will just bounce from the sides and not from below/above?


You want to RTL out MarioAbove and MarioBelow (and as a personal suggestion, TopCorner too). You can just move them to the bottom of the code where your RTL is, so the last few lines would look like:
Code
MarioBelow:
MarioAbove:
TopCorner:
BodyInside:		
HeadInside:	
SpriteV:		
SpriteH:	
MarioFireball:		
RTL	
Originally posted by UltiMario
You want to RTL out MarioAbove and MarioBelow (and as a personal suggestion, TopCorner too). You can just move them to the bottom of the code where your RTL is, so the last few lines would look like:
Code
code...


It is working partially now, but there's some stuff to perfect it xD. Thank you!
I am trying to convert an old 32x32 custom block that shatters to use the better optimized ChangeMap16 routine from G.P.S., but I don't get it to work propperly. Either it only shatters (breaks) 1 of the 4 blocks or it instantly crashes the game.

The old routine would use A instead of X to load the tile number.

According to the routine in GPS:
; Usage:
; REP #$10
; LDX #!block_number
; %change_map16()
; SEP #$10

Basically what I did was to change:

Code
       		PHP
	        REP #$30                ; \ 
	        LDA #$0025 	;  | change block displaced
	        STA $03                 ;  |     
		JSR SUBL_SET_MAP16
		PLP                     ; / 


To:

Code
       		PHP
	        REP #$10                ; \ 
	        LDX #$0025 	;  | change block displaced
	        %change_map16()
		SEP #$10
		PLP                     ; / 


But it wouldn't work. Anyone have any clues?

Here it is the relevant parts of the block code:
Code
(...)
MarioBelow:
MarioCape:
JSR TILE_ROUTINE
BRA MarioAbove

(...)
MarioAbove:
MarioSide:
TopCorner:
HeadInside:
BodyInside:
MarioFireball:
		LDY #$01
		LDA #$30
		STA $1693
		RTL

(...)

TILE_X_OFFSET: 	db $00,$10,$F0,$10
TILE_X_OFFSET2: db $00,$00,$FF,$00

TILE_Y_OFFSET:  db $00,$00,$10,$00
TILE_Y_OFFSET2: db $00,$00,$00,$00

TILE_ROUTINE:
		PHX
		LDX #$03

TILE_LOOP:
	
       		PHP
	        REP #$30                ; \ 
	        LDA #$0025 	;  | change block displaced
	        STA $03                 ;  |     
		JSR SUBL_SET_MAP16
		PLP                     ; / 

		LDA $9A
		CLC
		ADC TILE_X_OFFSET,x
		STA $9A
		LDA $9B

		ADC TILE_X_OFFSET2,x
		STA $9B
		LDA $98
		SEC
		SBC TILE_Y_OFFSET,x
		STA $98
		LDA $99
		;SEC
		SBC TILE_Y_OFFSET2,x
		STA $99

 
		    DEX	
		    BPL TILE_LOOP		
		    PLX	

		RTS


I linked the old Map16 routine it was using here.


That's simple: You had changed X inside a loop that is controlled by the same register. The better alternative in this case is to preserve X before calling the ChangeMap16 routine, like this:

Code
	PHX
	PHP
	REP #$10                ; \ 
	LDX #$0025 	;  | change block displaced
	%change_map16()
	PLP                     ; /
 	PLX






Dream team (feed them, please):






Originally posted by Fierce Deity Manuz OW Hacker
That's simple: You had changed X inside a loop that is controlled by the same register. The better alternative in this case is to preserve X before calling the ChangeMap16 routine, like this:

Code
	PHX
	PHP
	REP #$10                ; \ 
	LDX #$0025 	;  | change block displaced
	%change_map16()
	PLP                     ; /
 	PLX


Thank you very much Manuz! You made my day ;D

I tried doing something similar later, but I believe it didn't work because I used PHP and PHX and then PLX and PLP respectively, and I didn't tried doing the opposite way (PHX/PHP and PLP/PLX). Looks like you have to preserve X before preserving processor status #tb{^V^}
hey
im having trouble with this sprite priority
https://www.smwcentral.net/?p=section&a=details&id=13807

how do i make it appear in front of other layers/sprites like the vanilla boo ring?
ive tried messing around, but no matter what i do it always stay behind everything

*** Weirdly, just changing some sprites position fixed the issue..
¯\_(ツ)_/¯


Try taking these lines:

Code
    LDA !15F6,x
    ORA $64
    EOR #$40
    STA $04


and changing the ORA $64 part to ORA #$30.

However, even with that, you probably won't be able to make it appear in front of other sprites, only other layers. Sprite order is handled by the OAM indices the sprite tiles actually end up in; the original boo ring uses the cluster sprite slots (in the $0200 block) and hence appears in front of most sprites, but this custom sprite uses the standard sprite slots (in the $0300 block) and won't appear below sprites using those lower slots.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
I am also having some issues with OAM index in relation to sprites > layers.
I'm trying to get the Urchin Disassembly to have low priority and go behind layer 1 (similar to how pipe piranha plants do).

I tried adding Thomas' code above into the sprite (in varying locations) with no luck. I also looked at how piranha plants and lakitu handle priority but that left me lost.

It seems in the Urchin's case the following code handles some of it's priority, but I don't know how to modify this sprite to go behind layer 1.
Code
LDX $15E9	;
LDY #$02	;
LDA #$04	;
JSL $81B7B3	;


Any help?
What you posted is the call to the "finish OAM write" routine, which needs to be at the end of every sprite's GFX routine and (IIRC) sets tile sizes (LDY #$02 means the sprite uses 16x16 tiles, LDA #$04 means it has five tiles).

What you need to look for is the properties byte, which is usually stored to $0303,y (or apparently $04 in the above case). In the Urchin disassembly these bytes come from the table named "TileProp", so all you should need to do is edit the numbers there.

They're in YXPPCCCT format, which means that when you read the number in binary, each bit corresponds to a setting. The first number in the disassembly is $37, which is 00110111 in binary and gives us the following settings:

Code
YXPPCCCT
00110111

  • Y and X stand for "Y flip" and "X flip", and they're both 0, so this tile isn't flipped.
  • CCC stands for the palette to use, and it's 011, so this tile uses palette B.
  • T stands for "use SP1/SP2 or SP3/SP4", and it's 1, so this tile comes from SP3/SP4.
  • The bits you care about are PP, standing for "priority". They can be 00, 01, 10 or 11 (in order from lowest to highest), and here they're 11, which gives this tile the highest priority.


To give the tile the lowest priority instead, change those bits to 00. If you do that and read the resulting number in Hex, you get $07, so that's what you should replace the $37 with. Do the same with the rest of the entries in the TileProp table and you should be good to go.

(as Thomas noted, though, that will only affect priority against layers, not other sprites).


 
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 418
  • 419
  • 420