home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / h / hldevkit.zip / PUTVNUM.ASM < prev    next >
Assembly Source File  |  1992-04-28  |  1KB  |  32 lines

  1. ************************************************************************* 
  2. *   This routine is used to convert a signed long int in d0 to a        *
  3. *   vnum (signed variable length number) to a buffer in a0.             *
  4. *   The number of bytes used in the buffer is returned in d0.           *
  5. *                                                                       *
  6. * SAS C prototype:                                                      *
  7. * extern int __asm putvnum(register __d0 int, register __a0 char *);    *
  8. *                                                                       *
  9. *************************************************************************
  10. _putvnum:
  11. * called by: 
  12. * d0 = number to transform into a vnum
  13. * a0 = char * for buffer to fill with vnum
  14. *
  15. * returns number of bytes in the buffer in d0
  16. *
  17.         clr.l   d1              ;clear the counter
  18.         bsr.s   pvnm1
  19.         bclr    #7,-1(a0)
  20.         move.l  d1,d0           ;return number of characters in vnum in d0
  21.         rts
  22. pvnm1:  cmp.l   #$80,d0
  23.         bcs.s   1$
  24.         move.w  d0,-(sp)
  25.         lsr.l   #7,d0
  26.         bsr.s   pvnm1
  27.         move.w  (sp)+,d0
  28. 1$      bset    #7,d0
  29.         move.b  d0,(a0)+
  30.         addq.l  #1,d1
  31.         rts
  32.