Changeset 230 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Timestamp:
- Jan 29, 2012, 11:22:19 PM (13 years ago)
- google:author:
- krille_n_@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r227 r230 62 62 jnz SHORT .LimitAXtoMaxLCHScylinders 63 63 cmp ax, MAX_LCHS_CYLINDERS 64 jb eSHORT .returnLCHS64 jb SHORT .returnLCHS 65 65 .LimitAXtoMaxLCHScylinders: 66 66 mov ax, MAX_LCHS_CYLINDERS … … 71 71 mov ax, [di+DPT.wPchsCylinders] 72 72 mov bx, [di+DPT.wPchsHeadsAndSectors] 73 jmp SHORT AccessDPT_ShiftPCHinAXBLtoLCH 73 ; Fall to AccessDPT_ShiftPCHinAXBLtoLCH 74 75 76 ;-------------------------------------------------------------------- 77 ; AccessDPT_ShiftPCHinAXBLtoLCH 78 ; Parameters: 79 ; AX: P-CHS cylinders (1...16383) 80 ; BL: P-CHS heads (1...16) 81 ; Returns: 82 ; AX: Number of L-CHS cylinders (1...1024) 83 ; BL: Number of L-CHS heads (1...255) 84 ; CX: Number of bits shifted (4 at most) 85 ; Corrupts registers: 86 ; Nothing 87 ;-------------------------------------------------------------------- 88 AccessDPT_ShiftPCHinAXBLtoLCH: 89 xor cx, cx 90 .ShiftLoop: 91 cmp ax, MAX_LCHS_CYLINDERS ; Need to shift? 92 jbe SHORT .LimitHeadsTo255 ; If not, return 93 inc cx ; Increment shift count 94 shr ax, 1 ; Halve cylinders 95 shl bl, 1 ; Double heads 96 jnz SHORT .ShiftLoop 97 .LimitHeadsTo255: ; DOS does not support drives with 256 heads 98 cmp bl, cl ; Set CF if BL is zero 99 sbb bl, ch ; If BL=0 then BL=255 100 ret 74 101 75 102 … … 87 114 mov dx, [di+DPT.twLbaSectors+2] 88 115 mov bx, [di+DPT.twLbaSectors+4] 89 ret90 91 92 ;--------------------------------------------------------------------93 ; AccessDPT_ShiftPCHinAXBLtoLCH94 ; Parameters:95 ; AX: P-CHS cylinders (1...16383)96 ; BL: P-CHS heads (1...16)97 ; Returns:98 ; AX: Number of L-CHS cylinders (1...1024)99 ; BL: Number of L-CHS heads (1...255)100 ; CX: Number of bits shifted101 ; Corrupts registers:102 ; Nothing103 ;--------------------------------------------------------------------104 AccessDPT_ShiftPCHinAXBLtoLCH:105 xor cx, cx106 .ShiftLoop:107 cmp ax, MAX_LCHS_CYLINDERS ; Need to shift?108 jbe SHORT .LimitHeadsTo255 ; If not, return109 inc cx ; Increment shift count110 shr ax, 1 ; Halve cylinders111 shl bl, 1 ; Double heads112 jmp SHORT .ShiftLoop113 .LimitHeadsTo255: ; DOS does not support drives with 256 heads114 cmp bl, cl ; Set CF if BL is zero115 sbb bl, ch ; If BL=0 then BL=255116 116 ret 117 117 … … 143 143 ; DS:DI: Ptr to Disk Parameter Table 144 144 ; Returns: 145 ; AL: Addressing Mode (L-CHS, P-CHS, LBA28, LBA48) 145 ; AL: Addressing Mode (L-CHS, P-CHS, LBA28, LBA48) 146 146 ; unshifted (still shifted where it is in bFlagsLow) 147 147 ; ZF: Set based on value in AL … … 149 149 ; AL 150 150 ;-------------------------------------------------------------------- 151 ; 152 ; Converted to a macro since only called in two places, and the call/ret overhead 151 ; 152 ; Converted to a macro since only called in two places, and the call/ret overhead 153 153 ; is not worth it for these two instructions (4 bytes total) 154 154 ;
Note:
See TracChangeset
for help on using the changeset viewer.