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

  1.  
  2. * Maxon C++ Library:
  3. * Modul "istream_byte"
  4. * Jens Gelhar 16.04.92, 08.04.94
  5.  
  6.     xdef    op__rightshift__istream__TRSc,op__rightshift__istream__TRUc
  7.  
  8.     xref    fgetc_P06stream,ungetc__iP06stream,strtol__PCcPPci
  9.     xref    _errno,_fgetlong
  10.  
  11. op__rightshift__istream__TRSc:    ; (istream&, signed char&)
  12.     move.l    4(a7),a0
  13.     move.l    (a0),a0
  14.     move.l    (a0),-(a7)
  15.     jsr    _fgetlong
  16.     addq.l    #4,a7
  17.     move.l    8(a7),a0
  18.     tst.l    d1
  19.     beq.b    ciniPlus
  20.     addq.l    #1,d1
  21.     beq.b    ciniMinus
  22.     tst.l    d1
  23.     bmi.b    ciniMinInt
  24.     bra.b    ciniMaxInt
  25. ciniPlus:
  26.     cmp.l    #$7F,d0
  27.     bls.b    ciniOk
  28. ciniMaxInt:
  29.     moveq    #$7F,d0
  30.     bra.b    ciniErr
  31. ciniMinus:
  32.     cmp.l    #$FFFFFF80,d0
  33.     bge.b    ciniOk
  34. ciniMinInt:
  35.     move.w    #$80,d0
  36. ciniErr:
  37.     move.l    #1000,_errno     ; ERANGE
  38. ciniOk:    move.b    d0,(a0)
  39.     move.l    4(a7),d0
  40.     rts
  41.  
  42. op__rightshift__istream__TRUc:    ; (istream*, unsigned char&)
  43.     move.l    4(a7),a0
  44.     move.l    (a0),a0
  45.     move.l    (a0),-(a7)
  46.     jsr    _fgetlong
  47.     addq.l    #4,a7
  48.     move.l    8(a7),a0
  49.     tst.l    d1
  50.     bne.b    cinuErr
  51.     cmp.l    #$FF,d0
  52.     bls.b    cinuOK
  53. cinuErr:
  54.     moveq    #-1,d0
  55.     move.l    #1000,_errno     ; ERANGE
  56. cinuOK:    move.b    d0,(a0)
  57.     move.l     4(a7),d0
  58.     rts
  59.  
  60.     end
  61.