randompalette

by nambona

Game:

Description: you need to write to an address to randomize the palette

!palthing = $7FA501

main:
	;LDA !palthing-1
	;BNE +
	;RTL
	;+
	LDA $13
	BEQ +
	RTL
	+
	SEI
	LDA #$00
	STA !palthing-1
	STZ $4200
	REP #$30
	LDX #$01FE
	-
	JSR RNG
	LDA $148D
	STA !palthing,x
	DEX #2
	BPL -
	SEP #$10
	LDX #$80
	STX $2100
	LDA #$2202
	STA $4300
	LDA.w #!palthing
	STA $4302
	LDX.b #!palthing>>16
	STX $4304
	LDA #$0400
	STA $4305
	LDX #$01
	STX $420B
	SEP #$20
	LDA #$81
	STA $4200
	CLI
	LDA #$0F
	STA $2100
	;LDA #$DE
	;LDX #$C0
	;LDY #$DE
	RTL
	

RNG:
; If you know you will be coming here from the SNES side, you can make Accumulator 16-bit, and then jump here to save some time
  LDA $2137		;\ PPU registers
  LDA $213C   ;/
  ADC $13
  ADC $148D   ; 36
  ADC $14
  XBA
  STA $148D
  RTS
back to listings