A method for generating error detection code is disclosed. Firstly, a
first error detection code PEDC is derived by using 12-byte unknown
sector data information including ID, IED, RSV and the 2048-byte main
data while the main data is delivered from a host. Secondly, a second
error detection code MEDC is obtained by using known 12-byte sector data
information including ID, IED, RSV and the 2048-byte main data.
Thereafter, the real error detection code EDC is obtained by applying an
exclusive-OR operation to both the PEDC and MEDC.