source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/CommandLookup.asm @ 176

Last change on this file since 176 was 176, checked in by gregli@…, 12 years ago

Made a module around the EBIOS code, so that it can be turned off to make room for serial code, still enabled by default in the Makefile

File size: 2.0 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Functions for loading correct transfer command.
3
4; Section containing code
5SECTION .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;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
19CommandLookup_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;--------------------------------------------------------------------
41ALIGN JUMP_ALIGN
42CommandLookup_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
49g_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
55g_rgbWriteCommandLookup:
56    db      COMMAND_WRITE_SECTORS
57    db      COMMAND_WRITE_SECTORS_EXT
58    db      COMMAND_WRITE_MULTIPLE
59    db      COMMAND_WRITE_MULTIPLE_EXT
60
61g_rgbVerifyCommandLookup:
62    db      COMMAND_VERIFY_SECTORS
63    db      COMMAND_VERIFY_SECTORS_EXT
64    db      COMMAND_VERIFY_SECTORS
65    db      COMMAND_VERIFY_SECTORS_EXT     
Note: See TracBrowser for help on using the repository browser.