SHARE
TWEET

Animation engine

slydogstudios Sep 19th, 2016 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; basic animation engine
  2.  
  3. p_anim_start_lo:
  4.     .byte <wlk_lt1, <wlk_rt1
  5. p_anim_start_hi:
  6.     .byte >wlk_lt1, >wlk_rt1
  7.  
  8. p_anim:
  9.     lda p_anim_state
  10.     bmi @skip_init
  11.         tax
  12.         lda p_anim_start_lo, x
  13.         sta p_anim_addy+0
  14.         lda p_anim_start_hi, x
  15.         sta p_anim_addy+1
  16.         lda p_anim_state
  17.         eor #$80
  18.         sta p_anim_state
  19. @skip_init:
  20.     jsr p_anim_load
  21.     dec p_anim_count
  22.     rts
  23.  
  24. wlk_lt1:
  25. .byte $00,$00,$10,$10
  26. .byte $01,$03,$11,$13
  27. .byte $00,$00,$00,$00
  28. .byte $00,$08,$00,$08
  29. .byte $08
  30. .byte <wlk_lt2,>wlk_lt2
  31. wlk_lt2:
  32. .byte $00,$00,$10,$10
  33. .byte $05,$07,$15,$17
  34. .byte $00,$00,$00,$00
  35. .byte $00,$08,$00,$08
  36. .byte $08
  37. .byte <wlk_lt3,>wlk_lt3
  38. wlk_lt3:
  39. .byte $00,$00,$10,$10
  40. .byte $01,$03,$13,$11
  41. .byte $00,$00,$40,$40
  42. .byte $00,$08,$ff,$07
  43. .byte $08
  44. .byte <wlk_lt4,>wlk_lt4
  45. wlk_lt4:
  46. .byte $00,$00,$10,$10
  47. .byte $05,$07,$17,$15
  48. .byte $00,$00,$40,$40
  49. .byte $00,$08,$ff,$07
  50. .byte $08
  51. .byte <wlk_lt1,>wlk_lt1
  52.  
  53. wlk_rt1:
  54. .byte $00,$00,$10,$10
  55. .byte $09,$0b,$11,$13
  56. .byte $00,$00,$00,$00
  57. .byte $00,$08,$00,$08
  58. .byte $08
  59. .byte <wlk_rt2,>wlk_rt2
  60. wlk_rt2:
  61. .byte $00,$00,$10,$10
  62. .byte $0d,$0f,$15,$17
  63. .byte $00,$00,$00,$00
  64. .byte $00,$08,$00,$08
  65. .byte $08
  66. .byte <wlk_rt3,>wlk_rt3
  67. wlk_rt3:
  68. .byte $00,$00,$10,$10
  69. .byte $09,$0b,$13,$11
  70. .byte $00,$00,$40,$40
  71. .byte $00,$08,$ff,$07
  72. .byte $08
  73. .byte <wlk_rt4,>wlk_rt4
  74. wlk_rt4:
  75. .byte $00,$00,$10,$10
  76. .byte $0d,$0f,$17,$15
  77. .byte $00,$00,$40,$40
  78. .byte $00,$08,$ff,$07
  79. .byte $08
  80. .byte <wlk_rt1,>wlk_rt1
  81.  
  82.  
  83.  
  84. p_anim_load:
  85.     ldy #$00
  86.     lda p_topleft+0
  87.     clc
  88.     adc (p_anim_addy), y
  89.     sta p_topleft+0
  90.     iny
  91.     lda p_topleft+0
  92.     clc
  93.     adc (p_anim_addy), y
  94.     sta p_topright+0
  95.     iny
  96.     lda p_topleft+0
  97.     clc
  98.     adc (p_anim_addy), y
  99.     sta p_botleft+0
  100.     iny
  101.     lda p_topleft+0
  102.     clc
  103.     adc (p_anim_addy), y
  104.     sta p_botright+0
  105.     iny
  106.     lda (p_anim_addy), y
  107.     sta p_topleft+1
  108.     iny
  109.     lda (p_anim_addy), y
  110.     sta p_topleft+5
  111.     iny
  112.     lda (p_anim_addy), y
  113.     sta p_topleft+9
  114.     iny
  115.     lda (p_anim_addy), y
  116.     sta p_topleft+13
  117.     iny
  118.     lda (p_anim_addy), y
  119.     sta p_topleft+2
  120.     iny
  121.     lda (p_anim_addy), y
  122.     sta p_topleft+6
  123.     iny
  124.     lda (p_anim_addy), y
  125.     sta p_topleft+10
  126.     iny
  127.     lda (p_anim_addy), y
  128.     sta p_topleft+14
  129.     iny
  130.     lda p_topleft+3
  131.     clc
  132.     adc (p_anim_addy), y
  133.     sta p_topleft+3
  134.     iny
  135.     lda p_topleft+3
  136.     clc
  137.     adc (p_anim_addy), y
  138.     sta p_topright+3
  139.     iny
  140.     lda p_topleft+3
  141.     clc
  142.     adc (p_anim_addy), y
  143.     sta p_botleft+3
  144.     iny
  145.     lda p_topleft+3
  146.     clc
  147.     adc (p_anim_addy), y
  148.     sta p_botright+3
  149.  
  150.     lda p_anim_count
  151.     bne :+
  152.         iny
  153.         lda (p_anim_addy), y
  154.         sta p_anim_count
  155.         iny
  156.         lda (p_anim_addy), y
  157.         sta temp_addy2+0
  158.         iny
  159.         lda (p_anim_addy), y
  160.         sta temp_addy2+1
  161.  
  162.         lda temp_addy2+0
  163.         sta p_anim_addy+0
  164.         lda temp_addy2+1
  165.         sta p_anim_addy+1
  166. :   rts
RAW Paste Data
Top