source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm@ 174

Last change on this file since 174 was 161, checked in by krille_n_@…, 14 years ago

Changes to XTIDE Universal BIOS:

  • Minor size optimizations.
  • Tried to minimize the time spent with interrupts disabled in IdeIrq.asm and Int13h.asm
File size: 3.6 KB
RevLine 
[150]1; Project name : XTIDE Universal BIOS
2; Description : Command and port direction functions for different device types.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Device_FinalizeDPT
9; Parameters:
10; DS:DI: Ptr to Disk Parameter Table
11; ES:SI: Ptr to 512-byte ATA information read from the drive
[160]12; CS:BP: Ptr to IDEVARS for the controller
[150]13; Returns:
14; Nothing
15; Corrupts registers:
16; AX, BX, CX, DX
17;--------------------------------------------------------------------
18Device_FinalizeDPT:
[158]19 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[150]20 jnz SHORT ReturnSuccessForSerialPort
21 jmp IdeDPT_Finalize
[161]22;.FinalizeDptForSerialPortDevice: ; Dead label
23; jmp SerialDPT_Finalize ; and code
[150]24
25
26;--------------------------------------------------------------------
27; Device_ResetMasterAndSlaveController
28; Parameters:
29; DS:DI: Ptr to DPT (in RAMVARS segment)
30; Returns:
31; AH: INT 13h Error Code
32; CF: Cleared if success, Set if error
33; Corrupts registers:
34; AL, BX, CX, DX
35;--------------------------------------------------------------------
36Device_ResetMasterAndSlaveController:
[158]37 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[150]38 jnz SHORT ReturnSuccessForSerialPort
39 jmp IdeCommand_ResetMasterAndSlaveController
40
41
42;--------------------------------------------------------------------
43; Device_IdentifyToBufferInESSIwithDriveSelectByteInBH
44; Parameters:
45; BH: Drive Select byte for Drive and Head Select Register
46; DS: Segment to RAMVARS
47; ES:SI: Ptr to buffer to receive 512-byte IDE Information
48; CS:BP: Ptr to IDEVARS
49; Returns:
50; AH: INT 13h Error Code
51; CF: Cleared if success, Set if error
52; Corrupts registers:
53; AL, BL, CX, DX, SI, DI, ES
54;--------------------------------------------------------------------
55Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
56 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
57 je SHORT .IdentifyDriveFromSerialPort
58 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
59.IdentifyDriveFromSerialPort:
60 jmp SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
61
62
63;--------------------------------------------------------------------
64; Device_OutputCommandWithParameters
65; Parameters:
66; BH: Default system timer ticks for timeout (can be ignored)
67; BL: IDE Status Register bit to poll after command
68; ES:SI: Ptr to buffer (for data transfer commands)
69; DS:DI: Ptr to DPT (in RAMVARS segment)
70; SS:BP: Ptr to IDEPACK
71; Returns:
72; AH: INT 13h Error Code
73; CF: Cleared if success, Set if error
74; Corrupts registers:
75; AL, BX, CX, DX, (ES:SI for data transfer commands)
76;--------------------------------------------------------------------
77ALIGN JUMP_ALIGN
78Device_OutputCommandWithParameters:
[158]79 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[150]80 jnz SHORT .OutputCommandToSerialPort
81 jmp IdeCommand_OutputWithParameters
82ALIGN JUMP_ALIGN
83.OutputCommandToSerialPort:
84 jmp SerialCommand_OutputWithParameters
85
86
87;--------------------------------------------------------------------
88; Device_SelectDrive
89; Parameters:
90; DS:DI: Ptr to DPT (in RAMVARS segment)
91; SS:BP: Ptr to IDEPACK
92; Returns:
93; AH: INT 13h Error Code
94; CF: Cleared if success, Set if error
95; Corrupts registers:
96; AL, BX, CX, DX
97;--------------------------------------------------------------------
98ALIGN JUMP_ALIGN
99Device_SelectDrive:
[158]100 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[150]101 jnz SHORT ReturnSuccessForSerialPort
102 jmp IdeCommand_SelectDrive
103ReturnSuccessForSerialPort:
104 xor ax, ax
105 ret
Note: See TracBrowser for help on using the repository browser.