diff --git a/snes/data.a65 b/snes/data.a65 index 08a3397..54b9d24 100644 --- a/snes/data.a65 +++ b/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 diff --git a/snes/main.a65 b/snes/main.a65 index 2fba8b7..2ccd605 100644 --- a/snes/main.a65 +++ b/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 diff --git a/snes/reset.a65 b/snes/reset.a65 index e4c8371..3f8a484 100644 --- a/snes/reset.a65 +++ b/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