# QIC Tape help with CRC - Dwight?

Microtech Dart microtechdart at gmail.com
Sun Nov 15 04:15:53 CST 2015

```While I'm new to speak up here, I've been watching for a while.  I've also
used the name "MightyFrame" on groups, although that email address is not
registered with this list.

A few months back, I published a page decoding QIC-24 format.

http://mightyframe.blogspot.com/2015/08/qic-24-tape-data-block-format-decoding.html

Dwight posted a very meaningful response to this about the CRC on my site,
and it has taken me this long just to get to it.  Thanks again for that,
Dwight!

This project has gone very well for me, with one hangup...the CRC.

I've never calculated one of these before, and I'm struggling with this one.

I have a QIC-24 block of data attached in a .txt file, and I just can't get
the calculations to work.

For my simple understanding so far, I'm using an online calculator to test
this:

http://bit.ly/1YbHUZ7

That URL is pre-programmed with the polynomial and the "message" that
should provide the CRC result of

0xE8CE   (decimal 59598)

But, it doesn't.

I created this file, wrote it to tape, then read it again and tested it.
It is 100% correct for the QIC-24 tape system.  This is block 3 of 4 of the
file that I have extracted, and am testing here.

The ANSI QIC-24 standard booklet (X3.136-1986) says something that I know
is a clue, but I just don't understand.

"The cyclical redundancy check (CRC) shall consist of two bytes, calculated
over the 512 bytes of interchange data, and the 4-byte block address, *starting
with all ONEs, CRC initial value*, and using the CRC Generating polynomial:
x16 + x12 + x5 + 1

*"starting with all ONEs, CRC initial value"*?  What does THAT mean?  Do I
need to do some kind of register shift?  xorin or xorout?

I've even played with http://reveng.sourceforge.net/, but I'm having
trouble even understanding the meaning of the input values and parameters
with this.

I appreciate any feedback that anyone can give, here.

--

Thanks,
-AJ
http://MicrotechM1.blogspot.com
http://MightyFrame.com
-------------- next part --------------
Here's The 512-byte Data Block, ending with 4-byte block address of "00000003":

75650D0A4D6F6469666965722073776974636865733A0D0A20202020202020202D62206269672D656E6469616E204352432020202020202020202020202020202D42206269672D656E6469616E20435243206F75747075740D0A20202020202020202D6620726561642066696C6573206E616D656420696E20535452494E477320202D462066696E642070726573657473206C65737320717569636B6C790D0A20202020202020202D6C206C6974746C652D656E6469616E204352432020202020202020202020202D4C206C6974746C652D656E6469616E20435243206F75747075740D0A20202020202020202D4D206E6F6E2D6175676D656E74696E6720616C676F726974686D20202020202D722072696768742D6A7573746966696564206F75747075740D0A20202020202020202D53207072696E7420737061636573206265747765656E2063686172732020202D74206C6566742D6A7573746966696564206F75747075740D0A20202020202020202D56207265766572736520616C676F726974686D206F6E6C79202020202020202D58207072696E7420757070657263617365206865780D0A20202020202020202D79206C6F7720627974657320666972737420696E2066696C657320202020202D7A207261772062696E61727920535452494E47730D0A4D6F64652073776974636865733A0D0A2020202020202000000003

CRC SHOULD BE = E8CE =  59598

Use polynomial:

x16 + x12 + x5 + 1

which should be 10001000000100001

The ANSI QIC-24 standard booklet (X3.136-1986) says something that I know is a clue, but I just don't understand.

"The cyclical redundancy check (CRC) shall consist of two bytes, calculated over the 512 bytes of interchange data, and the 4-byte block address, starting with all ONEs, CRC initial value, and using the CRC Generating polynomial:
x16 + x12 + x5 + 1

"starting with all ONEs, CRC initial value".  What does THAT mean?  Do I need to do some kind of register shift?  xor
-------------- next part --------------
4D6963726F736F66742057696E646F7773205B56657273696F6E20362E312E373630315D0D0A436F70797269676874202863292032303039204D6963726F736F667420436F72706F726174696F6E2E2020416C6C207269676874732072657365727665642E0D0A0D0A433A5C446174615C4D69676874794672616D655C4352435C726576656E672D312E332E315C62696E5C77696E33323E726576656E672E657865202D680D0A43524320526576456E672C20616E206172626974726172792D707265636973696F6E204352432063616C63756C61746F7220616E6420616C676F726974686D2066696E6465720D0A55736167653A2020726576656E672E6578652020202020202D63644465737668753F205B2D624266466C4C4D7253745658797A5D0D0A202020202020202020202020202020205B2D6120424954535D205B2D41204F424954535D205B2D6920494E49545D205B2D6B204B504F4C595D205B2D6D204D4F44454C5D0D0A202020202020202020202020202020205B2D7020504F4C595D205B2D502052504F4C595D205B2D712051504F4C595D205B2D772057494454485D205B2D7820584F524F55545D0D0A202020202020202020202020202020205B535452494E472E2E2E5D0D0A4F7074696F6E733A0D0A20202020202020202D612042495453202020202020202020626974732070657220636861726100000001964CPPPPPPPPPPPPPPPP
Track Number = 00 =  0
Control Nybble = 0
Block Number = 00001 =  1
CRC = 964C =  38476
Block Sequential Count = 1
Warnings = None
Time Stamp of End Of Block = Block 1,1.36962704166667, 0~~~~~~~~~~

6374657220283120746F203332290D0A20202020202020202D41204F4249545320202020202020206269747320706572206F75747075742063686172616374657220283120746F203332290D0A20202020202020202D6920494E4954202020202020202020696E697469616C2072656769737465722076616C75650D0A20202020202020202D6B204B504F4C59202020202020202067656E657261746F7220696E204B6F6F706D616E206E6F746174696F6E2028696D706C696573205749445448290D0A20202020202020202D6D204D4F44454C20202020202020207072657365742043524320616C676F726974686D0D0A20202020202020202D7020504F4C5920202020202020202067656E657261746F72206F72207365617263682072616E676520737461727420706F6C796E6F6D69616C0D0A20202020202020202D502052504F4C59202020202020202072657665727365642067656E657261746F7220706F6C796E6F6D69616C0D0A20202020202020202D712051504F4C5920202020202020207365617263682072616E676520656E6420706F6C796E6F6D69616C0D0A20202020202020202D77205749445448202020202020202072656769737465722073697A652C20696E20626974730D0A20202020202020202D7820584F524F55542020202020202066696E616C20726567697374657220584F522076616C000000027CD6PPPPPPPPPPPPPPPP
Track Number = 00 =  0
Control Nybble = 0
Block Number = 00002 =  2
CRC = 7CD6 =  31958
Block Sequential Count = 2
Warnings = None
Time Stamp of End Of Block = Block 2,1.375681625, 0~~~~~~~~~~

75650D0A4D6F6469666965722073776974636865733A0D0A20202020202020202D62206269672D656E6469616E204352432020202020202020202020202020202D42206269672D656E6469616E20435243206F75747075740D0A20202020202020202D6620726561642066696C6573206E616D656420696E20535452494E477320202D462066696E642070726573657473206C65737320717569636B6C790D0A20202020202020202D6C206C6974746C652D656E6469616E204352432020202020202020202020202D4C206C6974746C652D656E6469616E20435243206F75747075740D0A20202020202020202D4D206E6F6E2D6175676D656E74696E6720616C676F726974686D20202020202D722072696768742D6A7573746966696564206F75747075740D0A20202020202020202D53207072696E7420737061636573206265747765656E2063686172732020202D74206C6566742D6A7573746966696564206F75747075740D0A20202020202020202D56207265766572736520616C676F726974686D206F6E6C79202020202020202D58207072696E7420757070657263617365206865780D0A20202020202020202D79206C6F7720627974657320666972737420696E2066696C657320202020202D7A207261772062696E61727920535452494E47730D0A4D6F64652073776974636865733A0D0A2020202020202000000003E8CEPPPPPPPPPPPPPPPP
Track Number = 00 =  0
Control Nybble = 0
Block Number = 00003 =  3
CRC = E8CE =  59598
Block Sequential Count = 3
Warnings = None
Time Stamp of End Of Block = Block 3,1.38174466666667, 0~~~~~~~~~~

202D632063616C63756C61746520435243732020202020202020202020202020202D642064756D7020616C676F726974686D20706172616D65746572730D0A20202020202020202D44206C6973742070726573657420616C676F726974686D73202020202020202D65206563686F2028616E64207265666F726D61742920696E7075740D0A20202020202020202D732073656172636820666F7220616C676F726974686D2020202020202020202D762063616C63756C61746520726576657273656420435243730D0A20202020202020202D68207C202D75207C202D3F2073686F7720746869732068656C700D0A0D0A436F707972696768742028432920323031302C20323031312C20323031322C20323031332C20323031342C20323031352020477265676F727920436F6F6B0D0A54686973206973206672656520736F6674776172653B207365652074686520736F7572636520666F7220636F7079696E6720636F6E646974696F6E732E20205468657265206973204E4F0D0A77617272616E74793B206E6F74206576656E20666F72204D45524348414E544142494C495459206F72204649544E45535320464F52204120504152544943554C415220505552504F53452E0D0A56657273696F6E20312E332E3120202020202020202020202020202020202020202020202020202020202020202020202020202020202000000004ECD3PPPPPPPPPPPPPPPP
Track Number = 00 =  0
Control Nybble = 0
Block Number = 00004 =  4
CRC = ECD3 =  60627
Block Sequential Count = 4
Warnings = None
Time Stamp of End Of Block = Block 4,1.387773, 0~~~~~~~~~~

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM0000000569C9PPPPPPPPPPPPPPPP
Track Number = 00 =  0
Control Nybble = 0
Block Number = 00005 =  5
CRC = 69C9 =  27081
Block Sequential Count = 5
Warnings = None
Time Stamp of End Of Block = Block 5,1.39385475, 0~~~~~~~~~~

Filemark nybble-string found at:   1 characters into HexByteString

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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  5
CRC = 69C9 =  27081
Block Sequential Count = 6
Warnings = None
Time Stamp of End Of Block = Block 6,1.399869375, 0~~~~~~~~~~

Filemark nybble-string found at:   1 characters into HexByteString

```