SHARE
TWEET

Untitled

a guest Oct 28th, 2018 120 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. IncreaseMinute:
  2. {
  3.  
  4.     LDA !TimerMinutes : INC : STA !TimerMinutes
  5.     AND #$80 : BNE .NightTime
  6.     .DayTime
  7.     LDA !TimerMinutes : AND #$3F
  8.         CMP !DayTimeDuration : BNE +
  9.             LDA #$4F : STA !Darkness ;Set Decrease Flag on
  10.         +
  11.     BRA .return
  12.     .NightTime
  13.     LDA !TimerMinutes : AND #$3F
  14.         CMP !DayTimeDuration : BNE +
  15.             LDA #$83 : STA !Darkness ;Set Increase Flag On
  16.         +
  17.     .return
  18.     RTS
  19. }
  20.  
  21. IncreaseBrightness:
  22. {
  23.     LDA !Darkness : INC : STA !Darkness ;Increase Brightness by 1
  24.     AND #$0F : CMP #$0F : BNE .maxNotReached ;If (Brightness == 0x0F)
  25.     ;{
  26.         STA !Darkness ; Remove increase/decrease flag
  27.         BRA .dontchangesprite
  28.     ;}
  29.     ;else
  30.     ;{
  31.     .maxNotReached
  32.     CMP #$09 : BNE .dontchangesprite ;If (Brightness == 0x09)
  33.         LDA #$10 : JSL change_sprite ;Change sprite to link
  34.         LDA #$00 : STA !TimerMinutes ;Set Night Flag OFF and minutes counter to 0
  35.     ;}
  36.     .dontchangesprite  
  37.  
  38.     JSR SetBrightness
  39.  
  40.     RTS
  41. }
  42.  
  43. DecreaseBrightness:
  44. {
  45.     LDA !Darkness : DEC : STA !Darkness ;Decrease Brightness by 1
  46.     AND #$0F : CMP #$03 : BNE .minNotReached ;If (Brightness == 0x03)
  47.     ;{
  48.         STA !Darkness ; Remove increase/decrease flag
  49.         BRA .dontchangesprite
  50.     ;}
  51.     .minNotReached
  52.     ;else
  53.     ;{
  54.     CMP #$09 : BNE .dontchangesprite ;If (Brightness == 0x09)
  55.         LDA #$25 : JSL change_sprite ;Change sprite to Wolf
  56.         LDA #$80 : STA !TimerMinutes ;Set Night Flag and minutes counter to 0
  57.     ;}
  58.     .dontchangesprite  
  59.     JSR SetBrightness
  60.  
  61.     RTS
  62. }
  63.  
  64.  
  65. IncreaseSeconds:
  66. {
  67.     LDA !TimerSeconds : INC : STA !TimerSeconds ;Increase seconds by 1
  68.     CMP #$70 : BNE + ; if timerseconds == 0x70 (don't ask)
  69.         JSR IncreaseMinute ;increase minute (if max minute is reach for day/night set increase/decrease flag)
  70.         LDA #$00 : STA !TimerSeconds ;set seconds to 00
  71.     +
  72.     LDA !TimerSeconds : CMP #$10 : BNE .return;if timerseconds == 0x10
  73.     ;{
  74.         LDA !Darkness : AND #$80 : BNE + ;if Increase Flag is ON
  75.         ;{
  76.                 JSR IncreaseBrightness
  77.                 LDA #$00 : STA !TimerSeconds ;set seconds to 00
  78.             BRA .return
  79.         ;}
  80.         +
  81.         LDA !Darkness : AND #$40 : BNE + ;if Decrease Flag is ON
  82.         ;{
  83.             JSR DecreaseBrightness
  84.             LDA #$00 : STA !TimerSeconds ;set seconds to 00
  85.         ;}
  86.         +
  87.     ;}
  88.     .return
  89.     RTS
  90. }
  91.  
  92. SetBrightness:
  93. {
  94.     LDA $1B : BNE .indoor
  95.     LDA !Darkness : AND #$0F : BRA .setBrightness
  96.     .indoor
  97.         LDA #$0F
  98.     .setBrightness
  99.         STA $13
  100.     RTS
  101. }
  102.  
  103. HandleTime:
  104. {
  105.     PHP
  106.     SEP #$30
  107.  
  108.         JSR SetBrightness
  109.         JSR IncreaseSeconds
  110.     LDA !TimerMinutes : AND #$80 : BEQ .notNight
  111.         LDA $BC : CMP #$25 : BEQ .WolfAlready
  112.             LDA #$25 : JSL change_sprite
  113.         .WolfAlready
  114.         LDA #$18 : STA $5E ;Set speed
  115.         BRA .linkAlready
  116.     .notNight
  117.         LDA $BC : CMP #$10 : BEQ .linkAlready
  118.             LDA #$10 : JSL change_sprite
  119.         .linkAlready
  120.     PLP
  121.     RTL
  122. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top