home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / driver6s / multicrc.asm < prev    next >
Assembly Source File  |  1990-03-13  |  1KB  |  60 lines

  1. add_mc_bits:
  2. ;entry:    ds:si -> multicast address, di-> sixty-four bit multicast filter.
  3. ;preserve cx, di, increment si by EADDR_LEN
  4.     push    cx
  5.     mov    cx,EADDR_LEN
  6.     mov    dx,0ffffh            ; this is msw.
  7.     mov    bx,0ffffh            ; set 32 bit number
  8. add_mcb_1:
  9.     lodsb
  10.     call    upd_crc            ; update crc
  11.     loop    add_mcb_1        ; and loop.
  12.  
  13.     mov    al,dh            ; get ms 8 bits,
  14.     rol    al,1
  15.     rol    al,1
  16.     rol    al,1            ; put 3 bits at bottom
  17.     and    al,7
  18.     mov    bl,al            ; save in bl
  19.     xor    bh,bh            ; make bx into an index to the byte.
  20.  
  21.     mov    al,dh            ; get ms 8 bits,
  22.     ror    al,1
  23.     ror    al,1            ; but at bottom
  24.     and    al,7
  25.     mov    cl,al            ; save in cl
  26.     mov    al,1
  27.     shl    al,cl            ; set the correct bit,
  28.  
  29.     or    [bx+di],al
  30.     pop    cx
  31.     ret
  32.  
  33. ;
  34. ;    dx is high,
  35. ;    bx is low.
  36. ;    al is data
  37.  
  38. upd_crc:
  39.     push    cx
  40.     mov    cx,8        ; do 8 bits
  41.     mov    ah,0
  42. upd_crc1:
  43.     shl    bx,1        ; shift bx
  44.     rcl    dx,1        ; through dx
  45.     rcl    ah,1        ; carry is at bottom of ah
  46.     xor    ah,al        ; xor with lsb of data
  47.     rcr    ah,1        ; and put in carry bit
  48.     jnc    upd_crc2
  49. ;
  50. ;    autodin is x^32+x^26+x^23x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+1
  51.  
  52.     xor    dx,0000010011000001b
  53.     xor    bx,0001110110110111b
  54. upd_crc2:
  55.     shr    al,1        ; shift the data
  56.     loop    upd_crc1
  57.     pop    cx
  58.     ret
  59.  
  60.