Language…
14 users online: 1337doom, AbuseFreakHacker,  BeeKaay, ben15420, Doopu, Gorry, LadiesMan217, Mecke1990, OrangeBronzeDaisy, Pink Gold Peach, playagmes169, rafaelfutbal, signature_steve, Skewer - Guests: 289 - Bots: 410
Users: 64,795 (2,369 active)
Latest user: mathew

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 418
  • 419
  • 420
Depends how you want to do it. Do you want to disable it through the whole game, just certain rooms, just certain sprites?
In the whole game.
Guys, I'm having trouble with palette changing. Let me explain you.
I want to change Mario's palette depending on what is stored on $0DC6, (I change the value of $0CD6 pressing L or R button). So I made a generator that change the Mario palette. Let me show you some of the code:

Palette1:
LDA $0DC6
CMP #$01
BNE Palette2

LDY #$83
STY $2121
LDA #$FD
STA $2122
LDA #$01
STA $2122


LDY #$84
STY $2121
LDA #$3F
STA $2122
LDA #$06
STA $2122


So as you can see, I change the values of the colors depending on $0DC6.

It works when there is not any sprite on screen. But when there is some sprites, like 3, the Mario palette goes back to the original, and then goes to the custom, and then to the original... it seems like mario is flashing the palettes. =/

So, what do you think? Any solution to this problem?
Thanks.
Mega Mario:
Originally posted by Logup
In the whole game.

Hrm...

A patch that hijacks a routine that runs every frame. You could check $71. If it's 05 or 06 (player entering a horizontal or vertical pipe), you could check every sprite on the screen and instantly kill any carried ones.

Mario probably will still turn around as if he was holding something, though. If that's no huge deal, then you're done. If it is, it'd be hard to find in all.log, but you could disable that animation too.


Though there might be a better way. I don't see anything in the ram map, but the game must store the sprite type somewhere when changing levels. It'd be possible to disable that (though again mario would still animate as if he was carrying it through the pipe).


@Carlos:

No frickin' clue. I have no experience with dynamically editing palettes. I'd be interested if you find the cause of the problem/solution.
  
  
 



Originally posted by carlos-182
Guys, I'm having trouble with palette changing. Let me explain you.
I want to change Mario's palette depending on what is stored on $0DC6, (I change the value of $0CD6 pressing L or R button). So I made a generator that change the Mario palette. Let me show you some of the code:

(...)

It works when there is not any sprite on screen. But when there is some sprites, like 3, the Mario palette goes back to the original, and then goes to the custom, and then to the original... it seems like mario is flashing the palettes. =/

So, what do you think? Any solution to this problem?
Thanks.


Don't use levelASM, hijack something that's run every frame (like the status bar) and set the palette through that instead. LevelASM seems to skip frames very occasionally, which can cause the effect you described. That's still a very inefficient method, but it should work.


 
 
       

Fluffy video games by me and Raibys!
 
 
   
 
 
He's using a generator sprite, which to my knowledge is run every frame.
  
  
 



I had a similar problem with LevelASM, though, and it was fixed by using the status bar routine instead. Even if he's using a different method, the solution should still work.


 
 
       

Fluffy video games by me and Raibys!
 
 
   
 
 
Hijacking the status bar routine doesn't work. I tryied that days ago and let me tell you the generator works better... and that's even bad.
Any other suggestion? I'd like to continue my hack but it would be a bad hack without changing the Mario's palette. It would lost the Megaman idea. =(


Edit: Oh yeah, I remember why hacking the status bar routine wasn't a good idea, because I can't change some colours of Mario Palette. It's very strange, but I can't. Maybe it has to be something about the OW palette, because as far as I know, some colors are shared with the level colors.
Mega Mario:
Try changing this instead of directly changing the palette:

Code
$7E:0905	480 bytes	Misc.	Copy of palettes 0-D from $0703-$08E2. Palettes E and F are not included.
Originally posted by Kaijyuu
Try changing this instead of directly changing the palette:

Code
$7E:0905	480 bytes	Misc.	Copy of palettes 0-D from $0703-$08E2. Palettes E and F are not included.


Oh, I don't know how to use that. What is suppoused to do?

Mega Mario:
It's the palette. Two bytes per color for 65536 total possible colors.
Pull up the palette editor in LM and you'll see "SNES RGB: 0000". That's how it's formatted.
So, if you wanted to use a dark green with a value of 1685 in the second color of palette 0, you'd write 85 to $0907 and 16 to $0908. Or, switch to 16 bit, LDA #$1685 STA $0907.

It's very likely that the game is pulling and refreshing the palette from RAM. That's the probable address for it (though I could be wrong). Change that, and it should no longer flicker.


EDIT: Hrm... either the byte count is wrong on that RAM map address, or palette E is included (480 bytes would be 15 palettes). I'd be wary of writing past $0AC5.
But it says "copy of palettes". Shouldn't be better if I modify the original palettes? Or doesn't matter?
Mega Mario:
If you look in the ram map, the palettes at $0703 are only used during the level load. I'm not sure what for.
I need some help: Is there a way, to make the code activating, if a event on the overworld was activated? For example:

Code
LDA $XX ; If Event 40 (insert random event here to) happens
AND #$XX ; 
BEQ Return ;if Event 40 does not activated
"Code"

Return:
RTL


Do you get what I wanna say?
I think you need to check if the event bits ($1EA2) are activated along with $1F02 for the overworld event passed flags.

From a block from BTSD:

LDA #!EVENT ;load event
AND #$07 ;low 3 bits = mask index
TAY ;into Y
LDA #!EVENT ;load event again
LSR A
LSR A
LSR A ;get byte index
TAX ;into X
LDA $1F02,x ;load byte
AND Mask,y ;apply mask
;EOR Mask,y ;uncomment this to invert the effect (pass on uncleared event)
BNE EventPassed

;event not passed
LDY #$01 ;act like 130
LDA #$30
STA $1693
RTL ;just return here

EventPassed:
;Code to execute if a event is passed.

Where !EVENT is the event number you want to check for.
Ah it works fine THANKS! (okay, I'm still worry about some special conditions on the overworld after the "special world is passed" thing, but who cares?)
Originally posted by Kaijyuu
It's the palette. Two bytes per color for 65536 total possible colors.
Pull up the palette editor in LM and you'll see "SNES RGB: 0000". That's how it's formatted.
So, if you wanted to use a dark green with a value of 1685 in the second color of palette 0, you'd write 85 to $0907 and 16 to $0908. Or, switch to 16 bit, LDA #$1685 STA $0907.

It's very likely that the game is pulling and refreshing the palette from RAM. That's the probable address for it (though I could be wrong). Change that, and it should no longer flicker.


EDIT: Hrm... either the byte count is wrong on that RAM map address, or palette E is included (480 bytes would be 15 palettes). I'd be wary of writing past $0AC5.


I tried that with no success. I don't know why I couldn't modify the palette in that way. That's bad =(


Edit: Problem solved. I avoided it, hehe. Colors 86, 87, 88,..., 8F (Mario Palette) seems to have a conection with OW palette, so that's why they are problematic. I just changed that colors into the first ones, and vualá =P
Mega Mario:
I've got a couple more questions related the sprite graphics routine...

When I changed the LDY #$02 at the end of the graphics routine to LDY #$00, it did only draw an 8x8 tile, but it displayed tile C3 when I set it to C2. Also, the displayed tile was floating (what I assume to be 8 pixels, but I didnt count) off the ground. Can someone explain?

Drawing multiple 16x16 tiles, I made 16x32 and a 32x32 sprite with no problems. What would I need to do to make a sprite that was 16x24, or some other size that can't be made by stacking 16x16s on top of and next to eachother?
I have a hack thread - Link (Now with a demo!)
Also a music thread - Link

C3 Projects
2013: Modern Spiny Pack
2012: MGSS v0.1
Spring 2010: SMB2 Autobomb Sprite
Originally posted by Kaijyuu
Question about compilers:

When I worked with C++ and C a few years ago, there were two types of comments: "//" (equivalent to ;) and "/* */".

The second one commmented out everything within the two symbols, and it was really nice in temporarily disabling large blocks of code. Is there an equivalent with xkas/trasm/addmusic?

It would be especially nice for Addmusic, as I would be able to test various parts of the song without having to wait for the song to play. I could cut and paste the code elsewhere, or spam ;'s behind a few dozen lines, but that's rather tedious.


I never used trasm nor addmusic, but I know that xkas has not any equivalent to "/* */".

If you port everything from xkas to wla-65816, then you gain several ways to comment your code:

Code
;;; mp-no-random.s
.include "mario-paint.i"

;;; Cause jsl $01e20c to return a constant value,
;;; not a random value.
.bank $01
.orga $e20c
.section "patch" overwrite
	php
/*
	This is a valid comment
	in wla-65816.
*/
	rep	#$20		; 16-bit A
.if 1 > 2
	This is another valid comment
	in wla-65816.
.endif
	lda	#0
.endasm
	This is a third valid comment
	in wla-65816.
.asm
	plp
	/* This comment is valid. */ rtl
.ends


If you want to stay with xkas/trasm/addmusic, then you can run your text files through some preprocessor that deletes the comments. I found a way to do this with the m4 preprocessor, but it looks ugly.

Code
dnl no-y-button.s.m4
changecom(//)dnl			no m4 in xkas comment
define(endasm, `divert(-1)')dnl		m4 macro to start comment
define(asm, `divert(0)dnl')dnl		m4 macro to end comment
// no-y-button.s
arch snes.cpu
header
lorom

define free_space $0ff000

org $00a299
endasm
	each frame,
	after reading controller
	but before moving Mario
asm
	jsl	{free_space}		// was jsl $00f6db

org {free_space}
endasm
	Remove flag $80 (the Y or X button) from
	the controller data in DP $15.
asm
	lda.b	$15
	and.b	#$bf			// no Y or X button $80
	sta.b	$15			// controller
endasm
	Do likewise with DP $16,
	the controller data for this frame.
asm
	lda.b	$16
	and.b	#$bf			// no Y or X button $80
	sta.b	$16			// controller, this frame
	jml	$00f6db			// tail call for displaced jsl


To use above code, I need m4 and xkas v0.12.

Code
$ m4 no-y-button.s.m4 > no-y-button.s
$ xkas rom.smc no-y-button.s


m4 is standard Unix command (so BSD, GNU/Linux, Solaris and Mac OS X already have m4), but I know not where to get m4 for Microsoft Windows.

Hacking Super Mario World since 28 February 2009
SMWDISC
How would I make Mario flash? This:

LDA #$01
STA $149B ; Time to flash
LDA #$04
STA $71 ; Action (Get Fire Flower animation)

renders Mario immobile. Maxx gave me a code:

LDY #$81 ;\ Write palette 8 & color 1
STY $2121 ;| to CG-RAM Address Write
LDA #$FF ;| Write new color (low byte)
STA $2122 ;| to CG-RAM Data Write
LDA #$7F ;| Write new color (high byte)
STA $2122 ;/ to CG-RAM Data Write

but I realized that since I'd need to set it back to default palette via code, it would mess up the colors if the player palettes had been edited.

World Community Grid: Thread | Team
 
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 418
  • 419
  • 420