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