1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Functions for loading correct transfer command.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .text
|
---|
6 |
|
---|
7 | ;--------------------------------------------------------------------
|
---|
8 | ; CommandLookup_GetEbiosIndexToBX
|
---|
9 | ; CommandLookup_OrOldInt13hIndexToBL
|
---|
10 | ; Parameters:
|
---|
11 | ; DS:DI: Ptr to DPT
|
---|
12 | ; ES:SI: Ptr to DAP (Disk Address Packet)
|
---|
13 | ; Returns:
|
---|
14 | ; BX: Index to command lookup table
|
---|
15 | ; Corrupts registers:
|
---|
16 | ; AX
|
---|
17 | ;--------------------------------------------------------------------
|
---|
18 | ALIGN JUMP_ALIGN
|
---|
19 | CommandLookup_GetEbiosIndexToBX:
|
---|
20 | ; LBA28 or LBA48 command
|
---|
21 | xor bx, bx
|
---|
22 | mov ax, [es:si+DAP.qwLBA+3] ; Load LBA48 bytes 3 and 4
|
---|
23 | and al, ~0Fh ; Clear LBA28 bits 24...27
|
---|
24 | or al, [es:si+DAP.qwLBA+5]
|
---|
25 | cmp bx, ax ; Set CF if any of bits 28...47 set
|
---|
26 | rcl bx, 1 ; BX = 0 for LBA28, BX = 1 for LBA48
|
---|
27 |
|
---|
28 | ; Block mode or single sector
|
---|
29 | ALIGN JUMP_ALIGN
|
---|
30 | CommandLookup_OrOldInt13hIndexToBL:
|
---|
31 | mov al, FLGH_DPT_BLOCK_MODE_SUPPORTED ; Bit 1
|
---|
32 | and al, [di+DPT.bFlagsHigh]
|
---|
33 | or bl, al ; BX = index to lookup table
|
---|
34 | ret
|
---|
35 |
|
---|
36 |
|
---|
37 | g_rgbReadCommandLookup:
|
---|
38 | db COMMAND_READ_SECTORS ; 00b, CHS or LBA28 single sector
|
---|
39 | db COMMAND_READ_SECTORS_EXT ; 01b, LBA48 single sector
|
---|
40 | db COMMAND_READ_MULTIPLE ; 10b, CHS or LBA28 block mode
|
---|
41 | db COMMAND_READ_MULTIPLE_EXT ; 11b, LBA48 block mode
|
---|
42 |
|
---|
43 | g_rgbWriteCommandLookup:
|
---|
44 | db COMMAND_WRITE_SECTORS
|
---|
45 | db COMMAND_WRITE_SECTORS_EXT
|
---|
46 | db COMMAND_WRITE_MULTIPLE
|
---|
47 | db COMMAND_WRITE_MULTIPLE_EXT
|
---|
48 |
|
---|
49 | g_rgbVerifyCommandLookup:
|
---|
50 | db COMMAND_VERIFY_SECTORS
|
---|
51 | db COMMAND_VERIFY_SECTORS_EXT
|
---|
52 | db COMMAND_VERIFY_SECTORS
|
---|
53 | db COMMAND_VERIFY_SECTORS_EXT
|
---|
54 |
|
---|