The problem is that you've got both the bit order and the byte order reversed. The correct bit order is
CL CH
76543210 | FEDCBA98
00000001 | 00000000
0x01 | 0x00
However, since you wrote it as a single number, rather than two successive bytes, the assembler automagically swaps the bytes to the 'correct' order, so that the high-order byte of the number goes to CH and the low-order byte to CL. Thus,
MOV CX, 0x0001
assembles to
B9 01 00
(B9 is the opcode for "MOV CX, immediate_word").
Actually, you probably would be better off treating the two halves of CX separately, even given the extra two cylinder bits in CL. Given what I've said here, you can see that for a disk with more than 256 cylinders, the split is rather awkward to show as a single word, as the bit wrap not to the low bits of the low word but to the high bits. for example, to read cyl 511, sector 34 of a hard disk, it would be
CL CH
76 543210 | FEDCBA98
01 100100 | 11111111
0x64 | 0xFF
which as a single number comes out to the rather enigmatic 0x0FF64. This obscures the relationship bettween them; it would be better to do something like:
Code: Select all
MOV CH, 0xFF ; 0xFF
MOV CL, 01000000b ; + (0x100 * 1) = 0x01FF
AND CL, 0x22 ; now mask sector value in
In any case, this is never relevant in the case of a floppy disk (no standard floppy has more than 80 cylinders AFAIK), while on a hard drive there are other complications anyway.
CCAW (Comments and Corrections Are Welcome).