Explorar el Código

menu: fade in screen on cold boot

Maximilian Rehkopf hace 12 años
padre
commit
5eae77f626
Se han modificado 3 ficheros con 40 adiciones y 2 borrados
  1. 5 0
      snes/data.a65
  2. 14 2
      snes/main.a65
  3. 21 0
      snes/reset.a65

+ 5 - 0
snes/data.a65

@@ -184,6 +184,11 @@ direntry_xscroll
 direntry_xscroll_wait
 	.word	0
 infloop	.byt 0,0  ; to be filled w/ 80 FE
+tgt_bright
+	.byt 0
+cur_bright
+	.byt 0
+
 ;------------------------
 saved_sp
 	.word 0

+ 14 - 2
snes/main.a65

@@ -29,8 +29,12 @@ GAME_MAIN:
 	sta $420d 		; fast cpu
 	jsr setup_gfx
 	jsr colortest
-	jsr setup_hdma
 	jsr tests
+	jsr setup_hdma
+	lda #$0f
+	sta cur_bright
+	sta tgt_bright
+	sta $2100
 
 	jmp @set_bank		; Set bios bank, just to be sure
 set_bank:
@@ -277,6 +281,14 @@ tests:
 	sta $2100		;screen on, full brightness
 	lda #9
 	sta bar_yl
+	stz cur_bright
+	stz tgt_bright
+	rts
+
+screen_on:
+	stz $2100		;screen on, 0% brightness
+	lda #$0f
+	sta tgt_bright
 	rts
 
 snes_init:
@@ -387,7 +399,7 @@ snes_init:
 
 fadeloop:
 	sep #$30 : .as : .xs
-	ldx #$0f
+	ldx cur_bright
 	and #$00
 	pha
 	plb

+ 21 - 0
snes/reset.a65

@@ -87,6 +87,27 @@ math_cont
 	lda #$3e	; ch. 1-5
 	sta @$420c	; trigger HDMA
 	lda #$01
+
+	lda cur_bright
+	cmp tgt_bright
+	beq +
+	bpl bright_down
+bright_up
+	inc
+	sta cur_bright
+	lda $2100
+	and #$f0
+	ora cur_bright
+	sta $2100
+	bra +
+bright_down
+	dec
+	sta cur_bright
+	lda $2100
+	and #$f0
+	ora cur_bright
+	sta $2100
++	lda #$01
 	sta isr_done
         rtl