Logo Search packages:      
Sourcecode: zoo version File versions  Download package


#pragma inline                            /* tell turbo assemble to use inline assembly */
#ifndef LINT
static char sccsid[]="$Source: /usr/home/dhesi/zoo/RCS/addbftcc.c,v $\n\
$Id: addbftcc.c,v 1.1 91/07/07 18:40:11 dhesi Exp $";
#endif /* LINT */

extern unsigned int crccode;
extern unsigned crctab[];

void addbfcrc(buffer,count)
char *buffer;
int count;
      (void) kbhit();                     /* allow keyboard interrupt to occur */
      _AX = crccode;                            /* ax holds crccode value */
      _CX = count;                              /* cx holds byte count */
      asm   les di,buffer                 /* es:di holds buffer address */

      asm   jcxz  done        /* if zero bytes, just skip */

/* loop begins here */
      asm   sub bh,bh
      asm   mov bl,al
      asm   xor bl,es:[di]          /* now bx = (crccode xor c) & 0x00ff */
      /* next statement shifts _BX left (2-byte items) */
   _DX = crctab[_BX];         /* dx <= *buffer == exp2 */
      asm   sub bh,bh               /* bh = 0 */
      asm   mov bl,ah               /* bx <- exp1 */
      asm   xor bx,dx               /* bx <- exp1 xor exp2 */
      asm   mov ax,bx               /* crccode <- exp1 xor exp2 */
      asm   inc di                        /* inc buffer pointer */
      asm   loop xloop              /* dec CX, jump if not zero */
/* loop ends here */

      crccode = _AX;                      /* put back calculated CRC value */



#if 0
; The following (edited) code was generated by Turbo C from the
; preceding code.  It is supplied here for porting to other systems
; and for user education.

_TEXT segment byte public 'CODE'
_TEXT ends

DGROUP      group _DATA,_BSS
      assume      cs:_TEXT,ds:DGROUP

_DATA segment word public 'DATA'
_DATA ends

_BSS  segment word public 'BSS'
_BSS  ends

_TEXT segment byte public 'CODE'

      assume      cs:_TEXT
_addbfcrc   proc  near
      push  bp
      mov   bp,sp
      push  di

      call  near ptr _kbhit
      mov   ax,word ptr DGROUP:_crccode
      mov   cx,word ptr [bp+8]
            les    di,[bp+4]              
      jcxz  short @1@362
      sub    bh,bh
      mov    bl,al
      xor    bl,es:[di]       
      shl   bx,1
      mov   dx,word ptr DGROUP:_crctab[bx]
      sub    bh,bh                  
      mov    bl,ah                  
      xor    bx,dx                  
      mov    ax,bx                  
      inc    di                     
      loop  short @1@98
      mov   word ptr DGROUP:_crccode,ax
      pop   di
      pop   bp
_addbfcrc   endp
_TEXT ends

      extrn _crccode:word
      extrn _kbhit:near
      extrn _crctab:word
      public      _addbfcrc

Generated by  Doxygen 1.6.0   Back to index