Advertisement
Zeda

LineSearch Z80

Dec 15th, 2011
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SearchLine:
  2. ;Inputs:
  3. ;     HL points to the start
  4. ;     BC is the number of bytes to search
  5. ;     DE is the negative of the line number
  6. ;     A is the line byte
  7. ;Outputs:
  8. ;     A is not changed
  9. ;     BC is the number of bytes left in the search
  10. ;     DE points to the line
  11. ;     HL is the length of the line
  12. ;===============================================================
  13.      or a                       ;B7
  14.      ld (TempWord1),hl          ;22****
  15. SearchLoop:                     ;
  16.      cpir                       ;EDA0
  17.      jp po,EndSearchLoop+1      ;E2****
  18.      inc e \ jr nz,SearchLoop-3 ;1C20**
  19.      inc d \ jr nz,SearchLoop-3 ;1420**
  20. EndSearchLoop:                  ;
  21.      scf                        ;37
  22.      ld de,(TempWord1)          ;ED5B****
  23.      sbc hl,de                  ;ED52
  24.      ret                        ;C9        23 bytes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement