Geekboy

Untitled

Apr 10th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LutHandlerStart:
  2. ; hl,-3
  3. ; %ccccccff c = Count F = flags
  4. ;The Flow
  5. ;first Decrement timer
  6. ;Check for z or c
  7. ;If Count = 2 move to next
  8. ;if Count = 1 move to follow player
  9. ;If count = HCF
  10. ;Else increment based on LUT parameters
  11. ;assume nothing is loaded as we may jump back here. later. can be removed if needed tho
  12.   ld hl,-3
  13.   add hl,sp
  14.   ld a,(hl)  ; ld a with flags
  15.   ld b,a     ; save in b
  16.   and %00000011 ; clear count for later
  17.   ld d,a        ; save for later
  18.   ld a,b        ; restore
  19.   and %11111100 ; clear for math
  20.   rrca \ rrca       ;div4  / move count to front of byte
  21.   ld e,a            ; save Count
  22.   dec a             ; shift dec
  23.   add a,a \ add a,a ; shift back
  24.   or d              ; merge back
  25.   ld (hl),a         ; save back into flagsk with new values
  26.   ld a,e            ; Restore count
  27.   cp 2              ; check values
  28.   jp c,FollowP      ; if 1 move to followP
  29.   jr z,IncLut       ; if 2 move to next position on lut
Advertisement
Add Comment
Please, Sign In to add comment