如何在汇编中使用28位PIO正确读取磁盘中的多个扇区?

时间:2017-09-12 18:48:04

标签: assembly io x86 kernel

如何在装配中使用28位PIO正确读取磁盘中的多个扇区?

这是我的加载扇区子程序:

load32:
    jmp load32_skipvars:
    load32_source dd 0
    load32_return dd 0
load32_skipvars:
    mov dword [load32_source], esi
    mov dword [load32_return], ebx
    mov ebx, ecx
    mov al, byte [load32_source + 3]
    or al, 0xe0
    mov dx, 0x1f6
    out dx, al
    mov dx, 0x1f1
    mov al, 0x00
    out dx, al
    mov dx, 0x1f2
    mov al, cl
    out dx, al
    mov al, byte [load32_source]
    mov dx, 0x1f3
    out dx, al
    mov al, byte [load32_source + 1]
    mov dx, 0x1f4
    out dx, al
    mov al, byte [load32_source + 2]
    mov dx, 0x1f5
    out dx, al
    mov dx, 0x1f7
    mov al, 0x20
    out dx, al
waitforit:
    in      al, dx
    test    al, 0x08
    jz      waitforit
    mov     ecx, 0x00000100
    mov     edx, 0x000001f0
    rep     insw
    dec     ebx
    cmp     ebx, 0
    jg      waitforit
    jmp     [load32_return]

可以这样称呼:

    mov esi, dword [kernel_cluster_loc]
    mov edi, dword [kernel_put]
    xor ecx, ecx
    mov cl, [bpb_sectors_per_cluster]
    mov ebx, morekernel
    jmp load32
morekernel:

这会加载多个扇区,但是,它们之间有多个“FFFFFFFF”扇区,将它分成几块,因此它不是连续的。

这是加载后内存的样子:

Offset(h) 00       04       08       0C

00100000  BDFFFFEF 00BCFFFF EF00E852 010000EB  ½ÿÿï.¼ÿÿï.èR...ë
00100010  FE5589E5 905DC355 89E583EC 088B5508  þU‰å.]ÃU‰åƒì.‹U.
00100020  8B450C66 8955FC88 45F80FB7 55FC0FB6  ‹E.f‰UüˆEø.·Uü.¶
00100030  45F8EE90 C9C35589 E583EC10 C745F800  Eøî.ÉÃU‰åƒì.ÇEø.
00100040  000000C7 45FC0000 0000EB08 8345F801  ...ÇEü....ë.ƒEø.
00100050  8345FC01 8B55088B 45FC01D0 0FB60084  ƒEü.‹U.‹Eü.Ð.¶.„
00100060  C075E98B 45F8C9C3 5589E56A 0F68D403  Àué‹EøÉÃU‰åj.hÔ.
00100070  0000E8A0 FFFFFF83 C4088B45 080FB6C0  ..è ÿÿÿƒÄ.‹E..¶À
00100080  5068D503 0000E88C FFFFFF83 C4086A0E  PhÕ...èŒÿÿÿƒÄ.j.
00100090  68D40300 00E87DFF FFFF83C4 088B4508  hÔ...è}ÿÿÿƒÄ.‹E.
001000A0  C1E8080F B6C05068 D5030000 E866FFFF  Áè..¶ÀPhÕ...èfÿÿ
001000B0  FF83C408 90C9C355 89E583EC 10C745FC  ÿƒÄ..ÉÃU‰åƒì.ÇEü
001000C0  00800B00 C745F800 000000EB 1D8B55F8  .€..ÇEø....ë.‹Uø
001000D0  8B45FC01 D0C60020 8B45F88D 50018B45  ‹Eü.ÐÆ. ‹Eø.P.‹E
001000E0  FC01D0C6 00078345 F802817D F89F0F00  ü.ÐÆ..ƒEø..}øŸ..
001000F0  007EDA90 C9C35589 E583EC10 C745FC00  .~Ú.ÉÃU‰åƒì.ÇEü.
00100100  800B00FF 7508E82B FFFFFF83 C404C1E0  €..ÿu.è+ÿÿÿƒÄ.Áà
00100110  0201450C C745F400 000000C7 45F80000  ..E.ÇEô....ÇEø..
00100120  0000EB2B 8B55F48B 45FC01C2 8B4DF88B  ..ë+‹Uô‹Eü.‹Mø‹
00100130  450801C8 0FB60088 028B45F4 8D50018B  E..È.¶.ˆ.‹Eô.P.‹
00100140  45FC01D0 C6000783 45F80183 45F4028B  Eü.ÐÆ..ƒEø.ƒEô.‹
00100150  55F88B45 0801D00F B60084C0 75C690C9  Uø‹E..Ð.¶.„ÀuÆ.É
00100160  C35589E5 83EC1865 A1140000 008945F4  ÃU‰åƒì.e¡....‰Eô
00100170  31C0C745 EC000000 00C745F0 C0011000  1ÀÇEì....ÇEðÀ...
00100180  E832FFFF FF8B45EC 50E8DAFE FFFF83C4  è2ÿÿÿ‹EìPèÚþÿÿƒÄ
00100190  048D45EC 50FF75F0 E859FFFF FF83C408  ..EìPÿuðèYÿÿÿƒÄ.
001001A0  8B45EC50 E8BFFEFF FF83C404 908B45F4  ‹EìPè¿þÿÿƒÄ..‹Eô
001001B0  65330514 00000074 05E853FE FFFFC9C3  e3.....t.èSþÿÿÉÃ
001001C0  54686973 20697320 796F206B 65726E65  This is yo kerne
001001D0  6C206D65 6E672100 14000000 00000000  l meng!.........
001001E0  017A5200 017C0801 1B0C0404 88010000  .zR..|......ˆ...
001001F0  1C000000 1C000000 19FEFFFF 06000000  .........þÿÿ....
00100200  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100210  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100220  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100230  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100240  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100250  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100260  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100270  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100280  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100290  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001002A0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001002B0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001002C0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001002D0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001002E0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001002F0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100300  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100310  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100320  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100330  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100340  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100350  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100360  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100370  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100380  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100390  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001003A0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001003B0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001003C0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001003D0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001003E0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001003F0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100400  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100410  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100420  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100430  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100440  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100450  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100460  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100470  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100480  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100490  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001004A0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001004B0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001004C0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001004D0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001004E0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001004F0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100500  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100510  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100520  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100530  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100540  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100550  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100560  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100570  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100580  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100590  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001005A0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001005B0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001005C0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001005D0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001005E0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001005F0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100600  00410E08 8502420D 0542C50C 04040000  .A..….B..BÅ.....
00100610  1C000000 3C000000 FFFDFFFF 1F000000  ....<...ÿýÿÿ....
00100620  00410E08 8502420D 055BC50C 04040000  .A..….B..[Å.....
00100630  1C000000 5C000000 FEFDFFFF 32000000  ....\...þýÿÿ2...
00100640  00410E08 8502420D 056EC50C 04040000  .A..….B..nÅ.....
00100650  1C000000 7C000000 10FEFFFF 4F000000  ....|....þÿÿO...
00100660  00410E08 8502420D 05024BC5 0C040400  .A..….B...KÅ....
00100670  1C000000 9C000000 3FFEFFFF 3F000000  ....œ...?þÿÿ?...
00100680  00410E08 8502420D 057BC50C 04040000  .A..….B..{Å.....
00100690  1C000000 BC000000 5EFEFFFF 6B000000  ....¼...^þÿÿk...
001006A0  00410E08 8502420D 050267C5 0C040400  .A..….B...gÅ....
001006B0  1C000000 DC000000 A9FEFFFF 5F000000  ....Ü...©þÿÿ_...
001006C0  00410E08 8502420D 05025BC5 0C040400  .A..….B...[Å....
001006D0  00000000 00000000 00000000 00000000  ................
001006E0  00000000 00000000 00000000 00000000  ................
001006F0  00000000 00000000 00000000 00000000  ................
00100700  00000000 00000000 00000000 00000000  ................
00100710  00000000 00000000 00000000 00000000  ................
00100720  00000000 00000000 00000000 00000000  ................
00100730  00000000 00000000 00000000 00000000  ................
00100740  00000000 00000000 00000000 00000000  ................
00100750  00000000 00000000 00000000 00000000  ................
00100760  00000000 00000000 00000000 00000000  ................
00100770  00000000 00000000 00000000 00000000  ................
00100780  00000000 00000000 00000000 00000000  ................
00100790  00000000 00000000 00000000 00000000  ................
001007A0  00000000 00000000 00000000 00000000  ................
001007B0  00000000 00000000 00000000 00000000  ................
001007C0  00000000 00000000 00000000 00000000  ................
001007D0  00000000 00000000 00000000 00000000  ................
001007E0  00000000 00000000 00000000 00000000  ................
001007F0  00000000 00000000 00000000 00000000  ................
00100800  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100810  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100820  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100830  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100840  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100850  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100860  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100870  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100880  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100890  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001008A0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001008B0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001008C0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001008D0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001008E0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001008F0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100900  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100910  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100920  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100930  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100940  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100950  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100960  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100970  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100980  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100990  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001009A0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001009B0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001009C0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001009D0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001009E0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
001009F0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100A00  10000600 0000FC01 10000A00 00005400  ......ü.......T.
00100A10  00000B00 00001000 00001100 0000C003  ..............À.
00100A20  10001200 00003000 00001300 00000800  ......0.........
00100A30  00001600 00000000 0000FAFF FF6F0100  ..........úÿÿo..
00100A40  00000000 00000000 00000000 00000000  ................
00100A50  00000000 00000000 00000000 00000000  ................
00100A60  00000000 00000000 00000000 00000000  ................
00100A70  00000000 00000000 00000000 00000000  ................
00100A80  00000000 00000000 00000000 00000000  ................
00100A90  00000000 00000000 00000000 00000000  ................
00100AA0  00000000 00000000 00000000 00000000  ................
00100AB0  00000000 00000000 00000000 00000000  ................
00100AC0  00000000 00000000 00000000 00000000  ................
00100AD0  00000000 00000000 00000000 00000000  ................
00100AE0  00000000 00000000 00000000 00000000  ................
00100AF0  00000000 00000000 00000000 00000000  ................
00100B00  00000000 00000000 00000000 00000000  ................
00100B10  00000000 00000000 00000000 00000000  ................
00100B20  00000000 00000000 00000000 00000000  ................
00100B30  00000000 00000000 00000000 00000000  ................
00100B40  00000000 00000000 00000000 00000000  ................
00100B50  00000000 00000000 00000000 00000000  ................
00100B60  00000000 00000000 00000000 00000000  ................
00100B70  00000000 00000000 00000000 00000000  ................
00100B80  00000000 00000000 00000000 00000000  ................
00100B90  00000000 00000000 00000000 00000000  ................
00100BA0  00000000 00000000 00000000 00000000  ................
00100BB0  00000000 00000000 00000000 00000000  ................
00100BC0  00000000 00000000 00000000 00000000  ................
00100BD0  00000000 00000000 00000000 00000000  ................
00100BE0  00000000 00000000 00000000 00000000  ................
00100BF0  00000000 00000000 0000FFFF FFFFFFFF  ..........ÿÿÿÿÿÿ
00100C00  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C10  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C20  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C30  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C40  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C50  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C60  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C70  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C80  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100C90  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100CA0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100CB0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100CC0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100CD0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100CE0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100CF0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D00  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D10  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D20  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D30  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D40  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D50  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D60  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D70  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D80  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100D90  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100DA0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100DB0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100DC0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100DD0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100DE0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100DF0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E00  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E10  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E20  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E30  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E40  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E50  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E60  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E70  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E80  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100E90  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100EA0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100EB0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100EC0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100ED0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100EE0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100EF0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F00  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F10  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F20  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F30  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F40  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F50  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F60  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F70  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F80  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100F90  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100FA0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100FB0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100FC0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100FD0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100FE0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
00100FF0  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

不是“FF”的三个部分是整个文件,我只是想弄清楚如何正确加载它。我认为这与扇区之间所需的等待有关,但我会在每个扇区之后回到waitforit我做错了什么?

1 个答案:

答案 0 :(得分:3)

您忘记在循环结束时将dx恢复为1f7h(ATA控制器状态寄存器)。

无法恢复dx将使第3位( DRQ )的测试在数据寄存器上进行。
由于电子遗留问题,因此未经过服务的IO读取会返回一个设置了所有位的数据,测试始终会将您引导至违规读取。

有点好奇的是,只有在读取了整数扇区(512字节)后,控制器才会返回正确的数据 - 可能是由于某些内部计数器/锁存逻辑。

这有点偏离主题,但如果可以的话,让我再给你一个建议。

<强>鲁棒性

  1. 始终检查控制器是否已准备好接受新命令(状态寄存器的第7位, BSY )。
  2. 始终检查上一个命令是否成功(状态寄存器的位0, ERR )以及错误寄存器
  3. 检查所选控制器和通道是否具有连接且就绪设备(状态寄存器的位6, DRDY
  4. 建立一个调用约定,特别是应该保留哪些寄存器,或者遵守现有寄存器(如果你打算使用,例如C)。
  5. <强>可读性

    1. 使用堆栈保存本地变量,而不是全局变量。
    2. 除非您有特殊原因,否则不要跳转使用来电/退货。
    3. 如果您没有数据段,请不要将变量放在执行流程中,将它们放在函数之间。
    4. &#34;编程参考&#34;对于旧的AT控制器或PCI连接的ATA控制器是ATA/ATAPI 6 specification,它基本上是SATA推出之前的最新产品之一。
      它还描述了ATAPI(例如高级磁盘管理,CD-ROM读取器)接口和所有可能定义的命令 阅读起来非常舒服,只是被警告说你不会找到IO端口地址而是偏移(编码为断言/非断言引脚,但这只是端口地址低位的二进制模式)。 / p>