Changeset 227 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
- Timestamp:
- Jan 29, 2012, 1:33:44 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r200 r227 40 40 ret 41 41 42 42 43 43 ;-------------------------------------------------------------------- 44 ; AccessDPT_GetLCHS 44 ; AccessDPT_GetLCHStoAXBLBH 45 45 ; Parameters: 46 46 ; DS:DI: Ptr to Disk Parameter Table 47 47 ; Returns: 48 ; AX: Number of L-CHS sectors per track49 ; B X: Number of L-CHS cylinders50 ; DX: Number of L-CHS heads48 ; AX: Number of L-CHS cylinders 49 ; BL: Number of L-CHS heads 50 ; BH: Number of L-CHS sectors per track 51 51 ; Corrupts registers: 52 ; CX 52 ; CX, DX 53 53 ;-------------------------------------------------------------------- 54 AccessDPT_GetLCHS: 55 ; Load CHS from DPT 56 eMOVZX ax, BYTE [di+DPT.bSectors] 57 mov bx, [di+DPT.dwCylinders] 58 cwd 59 mov dl, [di+DPT.bHeads] 54 AccessDPT_GetLCHStoAXBLBH: 55 ; Return LBA-assisted CHS if LBA addressing used 56 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA 57 jz SHORT .ConvertPchsToLchs 60 58 61 ; Only need to limit sectors for LBA assist 62 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA 63 jz SHORT AccessDPT_ShiftPCHinBXDXtoLCH 59 call AccessDPT_GetLbaSectorCountToBXDXAX 60 call AtaID_GetLbaAssistedCHStoDXAXBLBH 61 test dx, dx 62 jnz SHORT .LimitAXtoMaxLCHScylinders 63 cmp ax, MAX_LCHS_CYLINDERS 64 jbe SHORT .returnLCHS 65 .LimitAXtoMaxLCHScylinders: 66 mov ax, MAX_LCHS_CYLINDERS 67 .returnLCHS: 68 ret 64 69 65 cmp WORD [di+DPT.dwCylinders+2], BYTE 0 66 jnz SHORT .Return_MAX_LCHS_CYLINDERS 70 .ConvertPchsToLchs: 71 mov ax, [di+DPT.wPchsCylinders] 72 mov bx, [di+DPT.wPchsHeadsAndSectors] 73 jmp SHORT AccessDPT_ShiftPCHinAXBLtoLCH 67 74 68 ; Limit cylinders to 1024 69 cmp bx, MAX_LCHS_CYLINDERS 70 jb SHORT .Return 71 ALIGN JUMP_ALIGN 72 .Return_MAX_LCHS_CYLINDERS: 73 mov bx, MAX_LCHS_CYLINDERS 74 ALIGN JUMP_ALIGN, ret 75 .Return: 75 76 ;-------------------------------------------------------------------- 77 ; AccessDPT_GetLbaSectorCountToBXDXAX 78 ; Parameters: 79 ; DS:DI: Ptr to Disk Parameter Table 80 ; Returns: 81 ; BX:DX:AX: 48-bit sector count 82 ; Corrupts registers: 83 ; Nothing 84 ;-------------------------------------------------------------------- 85 AccessDPT_GetLbaSectorCountToBXDXAX: 86 mov ax, [di+DPT.twLbaSectors] 87 mov dx, [di+DPT.twLbaSectors+2] 88 mov bx, [di+DPT.twLbaSectors+4] 76 89 ret 77 90 78 91 79 92 ;-------------------------------------------------------------------- 80 ; AccessDPT_ShiftPCHin BXDXtoLCH93 ; AccessDPT_ShiftPCHinAXBLtoLCH 81 94 ; Parameters: 82 ; BX: P-CHS cylinders (1...16383)83 ; DX: P-CHS heads (1...16)95 ; AX: P-CHS cylinders (1...16383) 96 ; BL: P-CHS heads (1...16) 84 97 ; Returns: 85 ; BX: Number of L-CHS cylinders (1...1024)86 ; DX: Number of L-CHS heads (1...255)98 ; AX: Number of L-CHS cylinders (1...1024) 99 ; BL: Number of L-CHS heads (1...255) 87 100 ; CX: Number of bits shifted 88 101 ; Corrupts registers: 89 102 ; Nothing 90 103 ;-------------------------------------------------------------------- 91 AccessDPT_ShiftPCHin BXDXtoLCH:104 AccessDPT_ShiftPCHinAXBLtoLCH: 92 105 xor cx, cx 93 106 .ShiftLoop: 94 cmp bx, MAX_LCHS_CYLINDERS ; Need to shift?107 cmp ax, MAX_LCHS_CYLINDERS ; Need to shift? 95 108 jbe SHORT .LimitHeadsTo255 ; If not, return 96 109 inc cx ; Increment shift count 97 shr bx, 1 ; Halve cylinders98 shl dx, 1 ; Double heads110 shr ax, 1 ; Halve cylinders 111 shl bl, 1 ; Double heads 99 112 jmp SHORT .ShiftLoop 100 113 .LimitHeadsTo255: ; DOS does not support drives with 256 heads 101 sub dl, dh ; DH set only when 256 logical heads102 xor dh, dh114 cmp bl, cl ; Set CF if BL is zero 115 sbb bl, ch ; If BL=0 then BL=255 103 116 ret 104 117 105 118 106 119 ;-------------------------------------------------------------------- 107 120 ; Returns pointer to DRVPARAMS for master or slave drive. … … 144 157 and al, MASKL_DPT_ADDRESSING_MODE 145 158 %endmacro 146 147
Note:
See TracChangeset
for help on using the changeset viewer.