home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / fileutil / scan.lha / src / countcr.asm < prev    next >
Encoding:
Assembly Source File  |  1992-05-21  |  1.3 KB  |  53 lines

  1. ;
  2. ; Copyright © 1991, 1992 by Walter Rothe. You may freely use and modify this
  3. ; program, but not for commercial profit. A modest fee for distribution is
  4. ; allowed. Derivative works must be released with source along with the
  5. ; executable or provisions made to provide the user source, if requested.
  6. ; Uploading source to a major bulletin board system within 6 months of the
  7. ; time of the request satisfies this requirement. This copyright notice
  8. ; must not be deleted from the source.
  9. ;
  10. ;:ts=8
  11.         far     data
  12. ;void CountCR()
  13. ;/* Count number of line feeds in current buffer and add total count */
  14. ;{
  15.         xdef    _CountCR
  16. _CountCR:
  17.         movem.l a2,-(sp)
  18. ;   extern char *SOCB;
  19. ;   extern char *EOCB;
  20. ;   extern int NumOfCR;
  21. ;   extern int NumOfCRInCurBuf;
  22. ;
  23. ;   char *i;
  24. ;
  25. ;   for( i=SOCB; i<EOCB; i++) { if( *i == '\n') { NumOfCR++; } }
  26.         move.l  _SOCB,a2
  27.         bra     .10004
  28. .10005
  29.         add.l   #1,_NumOfCR
  30.         bra     .10004
  31. .10003
  32.         cmp.b   #10,(a2)+
  33.         beq     .10005
  34. .10004
  35.         cmp.l   _EOCB,a2
  36.         bcs     .10003
  37. .10002
  38. ;   NumOfCRInCurBuf = 0;
  39.         clr.l   _NumOfCRInCurBuf
  40. ;   return;
  41. .2
  42.         movem.l (sp)+,a2
  43.         rts
  44. ;}
  45. ;
  46.         xref    .begin
  47.         dseg
  48.         xref    _NumOfCRInCurBuf
  49.         xref    _NumOfCR
  50.         xref    _EOCB
  51.         xref    _SOCB
  52.         end
  53.