Changeset 173 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
- Timestamp:
- Sep 18, 2011, 11:41:29 AM (14 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r161 r173 59 59 60 60 ;-------------------------------------------------------------------- 61 ; AccessDPT_GetLCHS fromPCHS61 ; AccessDPT_GetLCHS 62 62 ; Parameters: 63 63 ; DS:DI: Ptr to Disk Parameter Table … … 67 67 ; DX: Number of L-CHS heads 68 68 ; Corrupts registers: 69 ; CX 70 ;-------------------------------------------------------------------- 71 AccessDPT_GetLCHS: 72 ; Load CHS from DPT 73 eMOVZX ax, BYTE [di+DPT.bSectors] 74 mov bx, [di+DPT.dwCylinders] 75 cwd 76 mov dl, [di+DPT.bHeads] 77 78 ; Only need to limit sectors for LBA assist 79 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA 80 jnz SHORT .ReturnLbaAssistedLCHS 81 82 ; P-CHS to L-CHS translation when necessary 83 jmp SHORT AccessDPT_ShiftPCHinBXDXtoLCH 84 85 .ReturnLbaAssistedLCHS: 86 cmp WORD [di+DPT.dwCylinders+2], BYTE 0 87 jz SHORT .LimitCylindersTo1024 88 mov bx, MAX_LCHS_CYLINDERS 89 .LimitCylindersTo1024: 90 MIN_U bx, MAX_LCHS_CYLINDERS 91 ret 92 93 94 ;-------------------------------------------------------------------- 95 ; AccessDPT_ShiftPCHinBXDXtoLCH 96 ; Parameters: 97 ; BX: P-CHS cylinders (1...16383) 98 ; DX: P-CHS heads (1...16) 99 ; Returns: 100 ; BX: Number of L-CHS cylinders (1...1024) 101 ; DX: Number of L-CHS heads (1...255) 102 ; CX: Number of bits shifted 103 ; Corrupts registers: 69 104 ; Nothing 70 105 ;-------------------------------------------------------------------- 71 ALIGN JUMP_ALIGN 72 AccessDPT_GetLCHSfromPCHS: 73 mov al, [di+DPT.bFlagsLow] 74 and al, MASKL_DPT_CHS_SHIFT_COUNT ; Load shift count 75 xchg cx, ax 76 mov bx, [di+DPT.wPchsCylinders] ; Load P-CHS cylinders 77 shr bx, cl ; Shift to L-CHS cylinders 78 xchg cx, ax 79 eMOVZX ax, BYTE [di+DPT.bPchsSectors] ; Load Sectors per track 80 cwd 81 mov dl, [di+DPT.bLchsHeads] ; Load L-CHS heads 106 AccessDPT_ShiftPCHinBXDXtoLCH: 107 xor cx, cx 108 .ShiftLoop: 109 cmp bx, MAX_LCHS_CYLINDERS ; Need to shift? 110 jbe SHORT .LimitHeadsTo255 ; If not, return 111 inc cx ; Increment shift count 112 shr bx, 1 ; Halve cylinders 113 shl dx, 1 ; Double heads 114 jmp SHORT .ShiftLoop 115 .LimitHeadsTo255: ; DOS does not support drives with 256 heads 116 sub dl, dh ; BH set only when 256 logical heads 117 xor dh, dh 82 118 ret 83 119
Note:
See TracChangeset
for help on using the changeset viewer.