Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. chktimer ;Timer vector cannot be in ZP.
  2. ;If timer vector MSB is 0, RTS.
  3. ;Checks timer, JSR if reached.
  4.  
  5. lda timervec+2
  6. beq timerexit
  7.  
  8. lda jiffyhi
  9. cmp timer+2
  10. bcc timerexit ;Not reached
  11. bne timervec ;Reached
  12.  
  13. lda jiffymi
  14. cmp timer+1
  15. bcc timerexit ;Not reached
  16. bne timervec ;Reached
  17.  
  18. lda jiffylo
  19. cmp timer+0
  20. bcc timerexit ;Not reached
  21.  
  22. timervec jsr $00 ;Self-modifying
  23. bcs timerexit
  24. lda #0
  25. sta timervec+2 ;Clear the timer
  26. timerexit
  27. rts
  28.  
  29. timer .byte 0,0,0
  30.  
  31. settimer ;Copy ZP Vector to JSR's addr
  32. lda $fb
  33. sta timervec+1
  34. lda $fc
  35. sta timervec+2
  36.  
  37. ;Write .X.Y relative time.
  38. stx timer+0
  39. sty timer+1
  40. clc
  41.  
  42. ;Add current Jiffy Time.
  43. lda jiffylo
  44. adc timer+0
  45. sta timer+0
  46.  
  47. lda jiffymi
  48. adc timer+1
  49. sta timer+1
  50.  
  51. lda jiffyhi
  52. adc #0
  53. sta timer+2
  54. rts
  55.  
  56. ;AMAZINGLY, Assembles to just 88 bytes.
  57. ;abcdefghijklmnopqrstuvwxyz
  58. ;abcdefghijklmnopqrstuvwxyz
  59. ;abcdefghijklmnopqrstuvwxyz
  60. ;abcdefghi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement