home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / MAXONC3_6OF8.DMS / in.adf / LIBSRC.LHA / LIBSRC / getstring.asm < prev    next >
Encoding:
Assembly Source File  |  1994-04-08  |  725 b   |  47 lines

  1.  
  2. * Maxon C++ Library:
  3. * Modul "getstring"
  4. * Jens Gelhar 11.05.93
  5.  
  6.     xdef    _gets,gets__Pc,_fgets,fgets__PciP06stream
  7.  
  8.     xref    _std__in,fgetc__P06stream
  9.  
  10. _gets:
  11. gets__Pc:    ; Stack-Parameter: char*
  12.     pea    _std__in
  13.     move.l    #80,-(a7)
  14.     move.l    8+4(a7),-(a7)
  15.     bsr.b    _fgets
  16.     lea    12(a7),a7
  17.     rts
  18.  
  19. _fgets:
  20. fgets__PciP06stream:    ; Stack-Parameter: char*, int, stream*
  21.     movem.l d1/a0,-(a7)
  22.     move.l 8+4(a7),a0
  23.     move.l 8+8(a7),d1
  24.     beq.b    fgerr
  25.     subq.l    #1,d1
  26.     beq.b    fgend
  27. fgLoop:    move.l    8+12(a7),-(a7)
  28.     jsr    fgetc__P06stream
  29.     addq.l    #4,a7
  30.     cmp.l    #256,d0
  31.     bhs.b    fgerr
  32.     cmp.b    #10,d0
  33.     beq.s    fgend
  34.     move.b    d0,(a0)+
  35.     subq.l    #1,d1
  36.     bne.s    fgLoop
  37. fgend:    clr.b    (a0)
  38.     movem.l    (a7)+,d1/a0
  39.     move.l    4(a7),d0
  40.     rts
  41. fgerr:    movem.l    (a7)+,d1/a0
  42.     moveq    #0,d0
  43.     rts
  44.  
  45.     end
  46.  
  47.