Language…
6 users online: anoMaly666, HD_DankBaron, Jordan, monkey03297,  Nanako, Shiki_Makiro - Guests: 235 - Bots: 332
Users: 64,795 (2,377 active)
Latest user: mathew

Changing palette of 0A and 0B when RAM is set

Does anyone know how to change the color of 0A and 0B when certain ram values are set? I have been looking for an uberasm or something but all I am finding is ways to change the entire palette row. I am really just trying to get Mario and Luigi's names in the status bar and course clear to change colors when certain ram conditions are met.
Trust the Fungus.
Direct CGRAM write.
$0703+ is the entire palette in SMW.
https://www.smwcentral.net/?p=memorymap&game=smw®ion=ram&address=7E0703&context=

To change color 0A and 0B you might want to check these registers:
$0715 (low byte), $0716 (high byte) and $0717 (low byte), $0718 (high byte).

Store the SNES color value via uberASM and it should change.
ok, so I have this


Code
main:
    LDA $1F31|!addr               
    CMP #$20
    BCS Toad
    RTL	
	
Toad:
	
LDA.l $6D08
STA   $0715|!addr
SEP   #$20
LDA.l $6D08
STA   $0716|!addr
RTL


But it isn't doing anything. I am not finding a lot on uploading palettes this way and there is still a lot to asm that I don't understand yet. What am I doing wrong here?
Trust the Fungus.
Well as the description of that address says, the table at $0703 is only uploaded to CGRAM during level load, so if you change it in the middle of the level it won't do anything. A solution is to use this code, for example.
An alternative that doesn't require that would be to use $0682 to change the colors dynamically without having to use $0703.
Finally, the code you're using right now needs some fixes: "LDA #$6D08", not "LDA.l $6D08" (right now you're loading the value from some random ram address), and add a REP #$20 at the beginning of the "Toad:" block. After "SEP #$20" you can delete the LDA : STA.
well I got it to work for the most part. Only issue with it now is that it flickers when it is doing the "course clear" fade.

MevinK, I ended up using a code I found of yours to do this. I know it's overkill cause it is designed to handle multiple colors but its the only thing that would work that I tried. I really only need it to do one color per ram address set. As in when I have the ram for Toad loaded it will change the status name color to blue but I am also going to have pink for peach and others. I am not sure how to reconfigure this for efficiency with that in mind.

I found this code of yours on another post (including my settings for Toad's name color)


Code
main:
    LDA $1F31|!addr               
    CMP #$20
    BCS Toad
    RTL	
	
Toad: 

    lda.b #Colors       ;\
    sta $00             ;| Copy table address to $00.
    lda.b #Colors>>8    ;|
    sta $01             ;/
    lda #$0A            ; Color number to upload to
    jsr ChangeColors
    RTL
	
Colors:
    dw $6DAD, $FFFF       ; Needs $FFFF terminator

ChangeColors:
    ldx $0681|!addr
    sta $0683|!addr,x
    ldy #$00
    rep #$20
.loop
    lda ($00),y
    bmi .end
    sta $0684|!addr,x
    inx #2
    iny #2
    bra .loop
.end
    sep #$20
    stz $0684|!addr,x
    txa
    ldx $0681|!addr
    sta $0682|!addr,x
    inc #2
    sta $0681|!addr
.return
    rts

Trust the Fungus.
It may be overkill, but if it works... :shrug:
Since you only need it for a single color, I have a more efficient routine for it:
Code
ChangeColor:
    ldx $0681|!addr
    sta $0684|!addr,x
    sep #$20
    stz $0686|!addr,x
    lda #$02
    sta $0682|!addr,x
    tya
    sta $0683|!addr,x
    txa
    clc
    adc #$04
    sta $0681|!addr
    rts

To use it, instead of having the table you can load the color directly in A:
Code
    ldy #$0A   ; Color index
    rep #$20
    lda #$6DAD ; Color value
    jsr ChangeColor
Thanks that works great.

2 things tho

1. do you know what I need to do to stop the flickering at the level course clear fade?

2. I want to change the star icon for the bonus stars to use the same palette as the yoshi coins, do you know which byte I need to change? I am having trouble making sense of the diagram.
Trust the Fungus.
1. I guess the color fade tries to fade out the color, but your code is still writing to it every frame... so to fix it you could avoid changing the color during the end level march (maybe check for $1493?). Either way you don't need to call the code every frame, just once is enough, so an alternative solution would be to change the color only once when the RAM address changes.
2. Well the status bar addresses are only used to change the tile numbers, to change the palette you'd need to do a hex edit. You can find the static tiles used by the status bar at $008C81, so edit one of the bytes there (there's 2 bytes for each tile, with the second being the YXPCCCTT properties). I'll leave the task of finding the star tile bytes to you
Fair enough. Thanks for all the help. That code was a life saver lol.
Trust the Fungus.