home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / buffers.lbr / DTEN.MZC / DTEN.MAC
Text File  |  1987-01-14  |  512b  |  21 lines

  1. ;
  2. ; divide unsigned integer (hl) by 10
  3. ; remainder appears in (a) with flags set
  4. ; a,f,h,l
  5. .dten::    push    b;        save bc
  6.     lxi    b,0f00ah;    c=divisor=10; b=iter.cnt=-16
  7.     xra    a;        clear
  8. dten1:    dad    h
  9.     ral;            shift off into (a)
  10.     cmp    c;        test
  11.     jc    dten2;        no bit
  12.     sub    c;        bit=1
  13.     inx    h
  14. dten2:    inr    b;        done?
  15.     jm    dten1;        no
  16.     ora    a;        set flags for rdr., clear carry
  17.     pop    b;        restore
  18.     ret
  19.  
  20.     end
  21. rz