Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IncreaseMinute:
- {
- LDA !TimerMinutes : INC : STA !TimerMinutes
- AND #$80 : BNE .NightTime
- .DayTime
- LDA !TimerMinutes : AND #$3F
- CMP !DayTimeDuration : BNE +
- LDA #$4F : STA !Darkness ;Set Decrease Flag on
- +
- BRA .return
- .NightTime
- LDA !TimerMinutes : AND #$3F
- CMP !DayTimeDuration : BNE +
- LDA #$83 : STA !Darkness ;Set Increase Flag On
- +
- .return
- RTS
- }
- IncreaseBrightness:
- {
- LDA !Darkness : INC : STA !Darkness ;Increase Brightness by 1
- AND #$0F : CMP #$0F : BNE .maxNotReached ;If (Brightness == 0x0F)
- ;{
- STA !Darkness ; Remove increase/decrease flag
- BRA .dontchangesprite
- ;}
- ;else
- ;{
- .maxNotReached
- CMP #$09 : BNE .dontchangesprite ;If (Brightness == 0x09)
- LDA #$10 : JSL change_sprite ;Change sprite to link
- LDA #$00 : STA !TimerMinutes ;Set Night Flag OFF and minutes counter to 0
- ;}
- .dontchangesprite
- JSR SetBrightness
- RTS
- }
- DecreaseBrightness:
- {
- LDA !Darkness : DEC : STA !Darkness ;Decrease Brightness by 1
- AND #$0F : CMP #$03 : BNE .minNotReached ;If (Brightness == 0x03)
- ;{
- STA !Darkness ; Remove increase/decrease flag
- BRA .dontchangesprite
- ;}
- .minNotReached
- ;else
- ;{
- CMP #$09 : BNE .dontchangesprite ;If (Brightness == 0x09)
- LDA #$25 : JSL change_sprite ;Change sprite to Wolf
- LDA #$80 : STA !TimerMinutes ;Set Night Flag and minutes counter to 0
- ;}
- .dontchangesprite
- JSR SetBrightness
- RTS
- }
- IncreaseSeconds:
- {
- LDA !TimerSeconds : INC : STA !TimerSeconds ;Increase seconds by 1
- CMP #$70 : BNE + ; if timerseconds == 0x70 (don't ask)
- JSR IncreaseMinute ;increase minute (if max minute is reach for day/night set increase/decrease flag)
- LDA #$00 : STA !TimerSeconds ;set seconds to 00
- +
- LDA !TimerSeconds : CMP #$10 : BNE .return;if timerseconds == 0x10
- ;{
- LDA !Darkness : AND #$80 : BNE + ;if Increase Flag is ON
- ;{
- JSR IncreaseBrightness
- LDA #$00 : STA !TimerSeconds ;set seconds to 00
- BRA .return
- ;}
- +
- LDA !Darkness : AND #$40 : BNE + ;if Decrease Flag is ON
- ;{
- JSR DecreaseBrightness
- LDA #$00 : STA !TimerSeconds ;set seconds to 00
- ;}
- +
- ;}
- .return
- RTS
- }
- SetBrightness:
- {
- LDA $1B : BNE .indoor
- LDA !Darkness : AND #$0F : BRA .setBrightness
- .indoor
- LDA #$0F
- .setBrightness
- STA $13
- RTS
- }
- HandleTime:
- {
- PHP
- SEP #$30
- JSR SetBrightness
- JSR IncreaseSeconds
- LDA !TimerMinutes : AND #$80 : BEQ .notNight
- LDA $BC : CMP #$25 : BEQ .WolfAlready
- LDA #$25 : JSL change_sprite
- .WolfAlready
- LDA #$18 : STA $5E ;Set speed
- BRA .linkAlready
- .notNight
- LDA $BC : CMP #$10 : BEQ .linkAlready
- LDA #$10 : JSL change_sprite
- .linkAlready
- PLP
- RTL
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement