; PDP-11 CRC-32 code ; r0=byte ; r1=>data ; r2=count ; r3/r4=crc, r4=lo, r3=hi ; r5=polynomic .bytelp movb (r1)+,r0 ; Fetch byte from memory bic #&FF00,r0 ; Ensure b8-b15 clear ; The following code updates the CRC with the byte in R0 xor r0,r4 ; XOR into CRC low byte mov #8,r0 ; Prepare to rotate 8 bits .rotlp clc ror r3 ; Rotate CRC ror r4 bcc clear ; Carry out clear mov #&EDB8,r5 ; CRC=CRC xor &EDB88320 xor r5,r3 mov #&8320,r5 xor r5,r4 .clear sub #1,r0 bne rotlp ; Loop for 8 bits sub #1,r2 ; num=num-1 bne bytelp ; Loop until num=0 mov r3,r1 ; Return CRC to BASIC in R0/R1 mov r4,r0 rts pc ; Return with R3/R4=updated CRC