HCG-LK

Found on:
"Alien (Argus Press)"
"Cliff Hanger"
"Osprey"
"Pyramid, The (Fantasy Software)"
"Shoot the Rapids)
"Times Book of Computer Puzzles and Games, The"
"Trashman (New Generation Software)
"Valhalla"


Loader files:
ROM Header / Data
ROM Header and Data files will vary from release to releas.

Encoding:
Endianess:MSbF
Threshold:0x03b6/0x060e (lead-in 1), 0x01f4 (lead-in 2), 0x02bc (sync/header/data)
Lead-in 1:127 '1's
Lead-in 2:3050/1400 '1's followed by a single '0'. 2500 for Header file and 1400 for Data file
Sync:0x00 (header) or 0xff (data)

Structure:
Header:17 bytes in a separate file
Checksum:Yes
Header:
00       Flag. 0x03 - Last file. 0x07 more Headers/data to follow
01-0a   Filename, padded with 0x20
0b-0c   Load size
0d-0e   Load start address (low/high)
0f-10   ? (Unused)

Checksum:
EOR of all bytes including sync byte.
Last checksum byte is the inverted value of the calculated checksum so resulting value should always be zero.

Lead-in 1: Loader counts pulses that are >=0x03b6 and <0x060e.
A total of 127 pulses is needed for the lead-in to complete.

After lead-in 1 the loader sets new thresholds, 0x01f4 and 0x02bc.

Lead-in 2: The loader waits for a single '0' bit, any pulse <0x01f4

After the lead-ins the loader starts reading bytes, all bytes loaded are eor:ed to create the checksum that should end up being zero if correct.

When loading bytes the '0' is defined as <0x02bc.

The first byte (sync) should be 0x00 for a header file and 0xff for a data file.

After the header or data the checkum byte follows.

Adding it to the calculated checksum should cause it to become zero.

Note:
The space that will be filled with filename from header always seems to have this value.
'I,HCG;LK',0,0
0x49 0x2C 0x48 0x43 0x47 0x3B 0x4C 0x4B 0x00 0x00

Statistics:
 01
Lead-in 1 1.24-1.29 ms, TAP 0x99-0x9f
Lead-in 20.41-0.44 ms TAP 0x32-0x361.25-1.29 ms, TAP 0x99-0x9f
Data0.49-0.52 ms, TAP 0x3c-0x400.98-1.02 ms TAP 0x79-0x7e