According to the original TAP specification, long pulses are encoded like this:
The data byte value of 00 represents overflow, any pulselength of more than 255*8 cycles.
Since this is somewhat underspecified, mtap2 uses the following definition:
The data byte value of 00 represents a long pulse value of 2500 * 8 cycles.
According to TAP spec, in TAP version 1 long pulses are encoded like this:
Data value of 00 is followed by three bytes, representing a 24 bit value of C64
cyles (NOT times 8). The order is as follow: 00 <bit0-7> <bit8-15> <bit16-24>.</bit16-24></bit8-15></bit0-7>
This allows for a more precise representation of long pulses:
This ensures that there no artificial "short" pulses are created.
For TAP version 2 splitting of pulses into half-pulses needs to be considered.
This ensures that there is always an even number of long "half" pulses, and no artificial "short" pulses are created.