1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Functions for loading correct transfer command.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .text
|
---|
6 |
|
---|
7 | %ifdef MODULE_EBIOS
|
---|
8 | ;--------------------------------------------------------------------
|
---|
9 | ; CommandLookup_GetEbiosIndexToBX
|
---|
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, DX
|
---|
17 | ;--------------------------------------------------------------------
|
---|
18 | ALIGN JUMP_ALIGN
|
---|
19 | CommandLookup_GetEbiosIndexToBX:
|
---|
20 | ; LBA28 or LBA48 command
|
---|
21 | xor dx, dx
|
---|
22 | mov al, [es:si+DAP.qwLBA+3] ; Load LBA48 byte 3 (bits 24...31)
|
---|
23 | and ax, 00F0h ; Clear LBA28 bits 24...27
|
---|
24 | or ax, [es:si+DAP.qwLBA+4] ; Set bits from LBA bytes 4 and 5
|
---|
25 | cmp dx, ax ; Set CF if any of bits 28...47 set
|
---|
26 | rcl dx, 1 ; DX = 0 for LBA28, DX = 1 for LBA48
|
---|
27 | call CommandLookup_GetOldInt13hIndexToBX
|
---|
28 | or bx, dx ; Set block mode / single sector bit
|
---|
29 | ret
|
---|
30 | %endif
|
---|
31 |
|
---|
32 | ;--------------------------------------------------------------------
|
---|
33 | ; CommandLookup_GetOldInt13hIndexToBX
|
---|
34 | ; Parameters:
|
---|
35 | ; DS:DI: Ptr to DPT
|
---|
36 | ; Returns:
|
---|
37 | ; BX: Index to command lookup table
|
---|
38 | ; Corrupts registers:
|
---|
39 | ; Nothing
|
---|
40 | ;--------------------------------------------------------------------
|
---|
41 | ALIGN JUMP_ALIGN
|
---|
42 | CommandLookup_GetOldInt13hIndexToBX:
|
---|
43 | ; Block mode or single sector
|
---|
44 | mov bl, [di+DPT.bFlagsHigh]
|
---|
45 | and bx, BYTE FLGH_DPT_BLOCK_MODE_SUPPORTED ; Bit 1
|
---|
46 | ret
|
---|
47 |
|
---|
48 |
|
---|
49 | g_rgbReadCommandLookup:
|
---|
50 | db COMMAND_READ_SECTORS ; 00b, CHS or LBA28 single sector
|
---|
51 | db COMMAND_READ_SECTORS_EXT ; 01b, LBA48 single sector
|
---|
52 | db COMMAND_READ_MULTIPLE ; 10b, CHS or LBA28 block mode
|
---|
53 | db COMMAND_READ_MULTIPLE_EXT ; 11b, LBA48 block mode
|
---|
54 |
|
---|
55 | g_rgbWriteCommandLookup:
|
---|
56 | db COMMAND_WRITE_SECTORS
|
---|
57 | db COMMAND_WRITE_SECTORS_EXT
|
---|
58 | db COMMAND_WRITE_MULTIPLE
|
---|
59 | db COMMAND_WRITE_MULTIPLE_EXT
|
---|
60 |
|
---|
61 | g_rgbVerifyCommandLookup:
|
---|
62 | db COMMAND_VERIFY_SECTORS
|
---|
63 | db COMMAND_VERIFY_SECTORS_EXT
|
---|
64 | db COMMAND_VERIFY_SECTORS
|
---|
65 | db COMMAND_VERIFY_SECTORS_EXT
|
---|