1 // CRC nach CCITT
  2 // Datei: crc.cpp
  3 #include "crc.hpp"
  4 #include <stdio.h>
  5 // Die ASM-Syntax ist Plattform abhängig!
  6 void crc::updcrc(unsigned char crc_char)
  7 {
  8 asm     mov     ax,crc_char
  9 asm     mov     bx,this
 10 asm     mov     cl,8
 11 asm     mov     dx,[bx].crc_accu
 12 u1:asm  rcl     al,1
 13 asm     rcl     dx,1
 14 asm     jnc     u2
 15 asm     xor     dx, 1021H
 16 u2:asm  loop    u1
 17 asm     mov     [bx].crc_accu,dx
 18 }
 19
 20 unsigned int crc::fincrc()
 21 {
 22         updcrc(‘\0’);
 23         updcrc(‘\0’);
 24         return (crc_accu);
 25 }

Bild 14-3: Implementierung von "crc" mit Assembler