Changeset 99 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization
- Timestamp:
- Jan 31, 2011, 11:27:17 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Initialization
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm
r3 r99 1 ; File name : AtaID.asm 2 ; Project name : IDE BIOS 3 ; Created date : 6.4.2010 4 ; Last update : 9.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for accessing ATA information read with 7 3 ; IDENTIFY DEVICE command. … … 11 7 12 8 ;-------------------------------------------------------------------- 13 ; Returns P-CHS values from ATA information.14 ;15 9 ; AtaID_GetPCHS 16 10 ; Parameters: … … 18 12 ; Returns: 19 13 ; AX: Number of user specified P-CHS cylinders 20 ; B L: Number of user specified P-CHS sectors per track21 ; B H: Number of user specified P-CHS heads14 ; BH: Number of user specified P-CHS sectors per track 15 ; BL: Number of user specified P-CHS heads 22 16 ; Corrupts registers: 23 17 ; Nothing 24 18 ;-------------------------------------------------------------------- 25 ALIGN JUMP_ALIGN26 19 AtaID_GetPCHS: 27 20 mov ax, [es:si+ATA1.wCylCnt] ; Cylinders (1...16383) 28 mov b h, [es:si+ATA1.wHeadCnt] ; Heads (1...16)29 mov b l, [es:si+ATA1.wSPT] ; Sectors per Track (1...63)21 mov bl, [es:si+ATA1.wHeadCnt] ; Heads (1...16) 22 mov bh, [es:si+ATA1.wSPT] ; Sectors per Track (1...63) 30 23 ret 31 24 32 25 33 26 ;-------------------------------------------------------------------- 34 ; Returns total number of available sectors from ATA information.35 ;36 27 ; AtaID_GetTotalSectorCount 37 28 ; Parameters: … … 42 33 ; Nothing 43 34 ;-------------------------------------------------------------------- 44 ALIGN JUMP_ALIGN45 35 AtaID_GetTotalSectorCount: 36 push ds 37 38 push es 39 pop ds 46 40 xor bx, bx 47 test WORD [ es:si+ATA1.wCaps], A1_wCaps_LBA48 jz SHORT AtaID_GetChsSectorCount49 ; Fall to AtaID_GetLbaSectorCount41 test WORD [si+ATA1.wCaps], A1_wCaps_LBA 42 jz SHORT .GetChsSectorCount 43 ; Fall to .GetLbaSectorCount 50 44 51 45 ;-------------------------------------------------------------------- 52 ; Returns total number of available sectors for LBA addressing. 53 ; 54 ; AtaID_GetLbaSectorCount 46 ; .GetLbaSectorCount 55 47 ; Parameters: 56 48 ; BX: Zero 57 ; ES:SI: Ptr to 512-byte ATA information read from the drive49 ; DS:SI: Ptr to 512-byte ATA information read from the drive 58 50 ; Returns: 59 51 ; BX:DX:AX: 48-bit sector count … … 61 53 ; Nothing 62 54 ;-------------------------------------------------------------------- 63 ;ALIGN JUMP_ALIGN 64 AtaID_GetLbaSectorCount: 65 test WORD [es:si+ATA6.wSetSup83], A6_wSetSup83_LBA48 55 .GetLbaSectorCount: 56 test WORD [si+ATA6.wSetSup83], A6_wSetSup83_LBA48 66 57 jz SHORT .GetLba28SectorCount 67 mov ax, [es:si+ATA6.qwLBACnt] 68 mov dx, [es:si+ATA6.qwLBACnt+2] 69 mov bx, [es:si+ATA6.qwLBACnt+4] 58 mov ax, [si+ATA6.qwLBACnt] 59 mov dx, [si+ATA6.qwLBACnt+2] 60 mov bx, [si+ATA6.qwLBACnt+4] 61 pop ds 70 62 ret 71 ALIGN JUMP_ALIGN72 63 .GetLba28SectorCount: 73 mov ax, [es:si+ATA1.dwLBACnt] 74 mov dx, [es:si+ATA1.dwLBACnt+2] 64 mov ax, [si+ATA1.dwLBACnt] 65 mov dx, [si+ATA1.dwLBACnt+2] 66 pop ds 75 67 ret 76 68 77 69 ;-------------------------------------------------------------------- 78 ; Returns total number of available sectors for P-CHS addressing. 79 ; 80 ; AtaID_GetChsSectorCount 70 ; .GetChsSectorCount 81 71 ; Parameters: 82 ; ES:SI: Ptr to 512-byte ATA information read from the drive72 ; DS:SI: Ptr to 512-byte ATA information read from the drive 83 73 ; Returns: 84 74 ; DX:AX: 24-bit sector count … … 86 76 ; Nothing 87 77 ;-------------------------------------------------------------------- 88 ALIGN JUMP_ALIGN 89 AtaID_GetChsSectorCount: 90 m ov al, [es:si+ATA1.wSPT] ; AL=Sectors per track91 mul BYTE [es:si+ATA1.wHeadCnt] ; AX=Sectors per track * number of heads92 mul WORD [es:si+ATA1.wCylCnt] ; DX:AX=Sectors per track * number of heads * number of cylinders78 .GetChsSectorCount: 79 mov al, [si+ATA1.wSPT] ; AL=Sectors per track 80 mul BYTE [si+ATA1.wHeadCnt] ; AX=Sectors per track * number of heads 81 mul WORD [si+ATA1.wCylCnt] ; DX:AX=Sectors per track * number of heads * number of cylinders 82 pop ds 93 83 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm
r35 r99 1 ; File name : DriveXlate.asm 2 ; Project name : IDE BIOS 3 ; Created date : 15.3.2010 4 ; Last update : 24.8.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for swapping drive letters. 7 3 … … 100 96 DriveXlate_SwapFloppyDriveOrHardDisk: 101 97 test dl, 80h ; Hard disk? 102 jnz SHORT DriveXlate_SwapHardDisk ; If so, jump to swap 103 ; Fall to DriveXlate_SwapFloppyDrive 104 105 ;-------------------------------------------------------------------- 106 ; Swaps Floppy Drive number. 107 ; 108 ; DriveXlate_SwapFloppyDrive 109 ; Parameters: 110 ; DL: Drive number to be possibly swapped 111 ; DS: RAMVARS segment 112 ; Returns: 113 ; DL: Translated drive number 114 ; Corrupts registers: 115 ; AX 116 ;-------------------------------------------------------------------- 117 ;ALIGN JUMP_ALIGN 118 DriveXlate_SwapFloppyDrive: 98 jnz SHORT .SwapHardDisk ; If so, jump to swap 99 ; Fall to .SwapFloppyDrive 100 101 ;-------------------------------------------------------------------- 102 ; .SwapFloppyDrive 103 ; Parameters: 104 ; DL: Drive number to be possibly swapped 105 ; DS: RAMVARS segment 106 ; Returns: 107 ; DL: Translated drive number 108 ; Corrupts registers: 109 ; AX 110 ;-------------------------------------------------------------------- 111 .SwapFloppyDrive: 119 112 eMOVZX ax, BYTE [RAMVARS.xlateVars+XLATEVARS.bFDSwap] 120 jmp SHORT DriveXlate_SwapDrive 121 122 ;-------------------------------------------------------------------- 123 ; Swaps Hard Disk number. 124 ; 125 ; DriveXlate_SwapHardDisk 126 ; Parameters: 127 ; DL: Drive number to be possibly swapped 128 ; DS: RAMVARS segment 129 ; Returns: 130 ; DL: Translated drive number 131 ; Corrupts registers: 132 ; AX 133 ;-------------------------------------------------------------------- 134 ALIGN JUMP_ALIGN 135 DriveXlate_SwapHardDisk: 113 jmp SHORT SwapDrive 114 115 ;-------------------------------------------------------------------- 116 ; .SwapHardDisk 117 ; Parameters: 118 ; DL: Drive number to be possibly swapped 119 ; DS: RAMVARS segment 120 ; Returns: 121 ; DL: Translated drive number 122 ; Corrupts registers: 123 ; AX 124 ;-------------------------------------------------------------------- 125 ALIGN JUMP_ALIGN 126 .SwapHardDisk: 136 127 mov ah, 80h 137 128 mov al, BYTE [RAMVARS.xlateVars+XLATEVARS.bHDSwap] 138 ; Fall to DriveXlate_SwapDrive 139 140 ;-------------------------------------------------------------------- 141 ; Swaps Hard Disk or Floppy Drive number. 142 ; 143 ; DriveXlate_SwapDrive 129 ; Fall to SwapDrive 130 131 ;-------------------------------------------------------------------- 132 ; SwapDrive 144 133 ; Parameters: 145 134 ; AL: Drive number to swap to 00h/80h … … 151 140 ; Nothing 152 141 ;-------------------------------------------------------------------- 153 ;ALIGN JUMP_ALIGN 154 DriveXlate_SwapDrive: 142 SwapDrive: 155 143 cmp ah, dl ; Swap DL from 00h/80h to xxh? 156 144 je SHORT .SwapToXXhInAL … … 201 189 DriveXlate_SetDriveToSwap: 202 190 test dl, 80h ; Floppy drive? 203 jnz SHORT DriveXlate_SetHardDiskToSwap 204 ; Fall to DriveXlate_SetFloppyDriveToSwap 205 206 ;-------------------------------------------------------------------- 207 ; Stores floppy drive to be swapped. 208 ; 209 ; DriveXlate_SetFloppyDriveToSwap 210 ; Parameters: 211 ; DL: Drive to swap to 00h 212 ; DS: RAMVARS segment 213 ; Returns: 214 ; Nothing 215 ; Corrupts registers: 216 ; Nothing 217 ;-------------------------------------------------------------------- 218 ALIGN JUMP_ALIGN 219 DriveXlate_SetFloppyDriveToSwap: 191 jnz SHORT .SetHardDiskToSwap 192 .SetFloppyDriveToSwap: 220 193 mov [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl 221 194 ret 222 223 ;-------------------------------------------------------------------- 224 ; Stores hard disk to be swapped. 225 ; 226 ; DriveXlate_SetHardDiskToSwap 227 ; Parameters: 228 ; DL: Drive to swap to 80h 229 ; DS: RAMVARS segment 230 ; Returns: 231 ; Nothing 232 ; Corrupts registers: 233 ; Nothing 234 ;-------------------------------------------------------------------- 235 ALIGN JUMP_ALIGN 236 DriveXlate_SetHardDiskToSwap: 195 ALIGN JUMP_ALIGN 196 .SetHardDiskToSwap: 237 197 mov [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl 238 198 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
r86 r99 18 18 ; BX, CX, DI 19 19 ;-------------------------------------------------------------------- 20 ;ALIGN JUMP_ALIGN21 20 FloppyDrive_IsInt40hInstalled: 22 21 cmp WORD [es:INTV_FLOPPY_FUNC*4+2], 0C000h ; Any ROM segment? 23 22 jb SHORT .Int40hHandlerIsNotInstalled 23 %ifdef USE_AT 24 24 call .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h 25 %else 26 clc ; INT 40h installed. No need to verify on XT systems. 27 %endif 25 28 .Int40hHandlerIsNotInstalled: 26 29 cmc … … 37 40 ; BX, CX, DI 38 41 ;-------------------------------------------------------------------- 39 ;ALIGN JUMP_ALIGN 42 %ifdef USE_AT 40 43 .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h: 41 44 push es … … 45 48 call .LoadInt40hVerifyParameters 46 49 int INTV_DISK_FUNC 47 jc SHORT . AH08hNotSupported ; AH=08h not supported on XTs but that doesn't48 push es ; matter since INT 40h does not need to be verified49 push di ; on XTs50 jc SHORT .Int40hIsInstalled ; Maybe there are not any floppy drives at all 51 push es 52 push di 50 53 51 54 call .LoadInt40hVerifyParameters … … 58 61 mov dx, es 59 62 cmp cx, dx ; Difference in segments? 60 jne SHORT .Int40hNotInstalled 61 .AH08hNotSupported: 62 clc 63 jmp SHORT .Int40hIsInstalled 63 je SHORT .Int40hIsInstalled 64 64 .Int40hNotInstalled: 65 65 stc … … 81 81 ; DH 82 82 ;-------------------------------------------------------------------- 83 ;ALIGN JUMP_ALIGN84 83 .LoadInt40hVerifyParameters: 85 84 mov ah, 08h ; Get Drive Parameters … … 88 87 mov es, dx ; ES:DI = 0000:0000h to guard against BIOS bugs 89 88 ret 89 %endif 90 90 91 91 … … 133 133 FloppyDrive_GetCount: 134 134 push es 135 %ifdef USE_AT 135 136 call FloppyDrive_GetCountFromBIOS 136 jnc SHORT .CompareToUserMinimum 137 %else 137 138 call FloppyDrive_GetCountFromBDA 138 ALIGN JUMP_ALIGN 139 .CompareToUserMinimum: 139 %endif 140 140 MAX_U cl, [cs:ROMVARS.bMinFddCnt] 141 141 xor ch, ch … … 159 159 ; CH, ES 160 160 ;-------------------------------------------------------------------- 161 %ifdef USE_AT 161 162 ALIGN JUMP_ALIGN 162 163 FloppyDrive_GetCountFromBIOS: … … 176 177 pop di 177 178 ret 179 %endif 178 180 179 181 … … 190 192 ; CH, ES 191 193 ;-------------------------------------------------------------------- 194 %ifndef USE_AT 192 195 ALIGN JUMP_ALIGN 193 196 FloppyDrive_GetCountFromBDA: … … 199 202 add cl, ch ; CL = Floppy Drive count 200 203 ret 204 %endif
Note:
See TracChangeset
for help on using the changeset viewer.