searchline.z80 526 B

1234567891011121314151617181920212223242526
  1. SearchLine:
  2. ;Inputs:
  3. ; HL points to the start
  4. ; BC is the number of bytes to search
  5. ; DE is the line number
  6. ; A is the line byte
  7. ;Outputs:
  8. ; A is not changed
  9. ; BC is the number of bytes left for the search
  10. ; DE points to the line
  11. ; HL is the length of the line
  12. ;===============================================================
  13. inc bc
  14. dec de \ inc d \ inc e
  15. ; or a
  16. _:
  17. ld (TempWord1),hl
  18. cpir
  19. jp po,+_
  20. dec e \ jr nz,-_
  21. dec d \ jr nz,-_
  22. _:
  23. scf
  24. ld de,(TempWord1)
  25. sbc hl,de
  26. ret