Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers
- Timestamp:
- Feb 22, 2012, 7:01:53 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r249 r258 29 29 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl 30 30 call RamVars_IsFunctionHandledByThisBIOS 31 jnc SHORT Int13h_DirectCallToAnotherBios 31 jc SHORT Int13h_DirectCallToAnotherBios 32 32 33 call FindDPT_ForDriveNumber ; DS:DI now points to DPT 33 34 … … 139 140 ALIGN JUMP_ALIGN 140 141 Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH: 142 %ifdef MODULE_SERIAL_FLOPPY 143 mov al, [bp+IDEPACK.intpack+INTPACK.dl] 144 Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber: 145 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber 146 %else 141 147 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH 148 %endif 142 149 Int13h_ReturnFromHandlerWithoutStoringErrorCode: 143 150 or WORD [bp+IDEPACK.intpack+INTPACK.flags], FLG_FLAGS_IF ; Return with interrupts enabled … … 154 161 ; Returns: 155 162 ; Depends on function 163 ; NOTE: ES:DI needs to be returned from the previous interrupt 164 ; handler, for floppy DPT in function 08h 156 165 ; Corrupts registers: 157 ; BX, DI, ES166 ; None 158 167 ;-------------------------------------------------------------------- 159 168 ALIGN JUMP_ALIGN 160 169 Int13h_CallPreviousInt13hHandler: 161 push di162 170 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 163 171 int BIOS_DISK_INTERRUPT_13h 164 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 165 pop di 166 ret 167 172 ;;; fall-through to ExchangeCurrentInt13hHandlerWithOldInt13hHandler 168 173 169 174 ;-------------------------------------------------------------------- … … 174 179 ; Nothing 175 180 ; Corrupts registers: 176 ; DI 181 ; Nothing 182 ; Note: Flags are preserved 177 183 ;-------------------------------------------------------------------- 178 184 ALIGN JUMP_ALIGN 179 185 ExchangeCurrentInt13hHandlerWithOldInt13hHandler: 180 186 push es 181 LOAD_BDA_SEGMENT_TO es, di 182 mov di, [RAMVARS.fpOldI13h] 187 push si 188 LOAD_BDA_SEGMENT_PRESERVE_FLAGS_TO es, si 189 mov si, [RAMVARS.fpOldI13h] 183 190 cli 184 xchg di, [es:BIOS_DISK_INTERRUPT_13h*4]185 mov [RAMVARS.fpOldI13h], di186 mov di, [RAMVARS.fpOldI13h+2]187 xchg di, [es:BIOS_DISK_INTERRUPT_13h*4+2]191 xchg si, [es:BIOS_DISK_INTERRUPT_13h*4] 192 mov [RAMVARS.fpOldI13h], si 193 mov si, [RAMVARS.fpOldI13h+2] 194 xchg si, [es:BIOS_DISK_INTERRUPT_13h*4+2] 188 195 sti 189 mov [RAMVARS.fpOldI13h+2], di 196 mov [RAMVARS.fpOldI13h+2], si 197 pop si 190 198 pop es 191 199 ret … … 204 212 ;-------------------------------------------------------------------- 205 213 ALIGN JUMP_ALIGN 214 %ifdef MODULE_SERIAL_FLOPPY 215 Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber: 216 ; Store error code to BDA 217 mov bx, BDA.bHDLastSt 218 test al, al 219 js .HardDisk 220 mov bl, BDA.bFDRetST & 0xff 221 .HardDisk: 222 LOAD_BDA_SEGMENT_TO ds, di 223 mov [bx], ah 224 %else 206 225 Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH: 207 226 ; Store error code to BDA 208 LOAD_BDA_SEGMENT_TO ds, di 227 LOAD_BDA_SEGMENT_TO ds, di 209 228 mov [BDA.bHDLastSt], ah 229 %endif 210 230 211 231 ; Store error code to INTPACK -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r152 r258 22 22 eMOVZX bx, dl ; Copy requested drive to BL, zero BH to assume no errors 23 23 call ResetFloppyDrivesWithInt40h 24 test bl, bl25 jns SHORT .SkipHardDiskReset26 24 call ResetForeignHardDisks 27 25 call AH0h_ResetHardDisksHandledByOurBIOS … … 64 62 xor ah, ah ; Disk Controller Reset 65 63 call Int13h_CallPreviousInt13hHandler 66 jmp SHORT BackupErrorCodeFromTheRequestedDriveToBH 67 64 ;;; fall-through to BackupErrorCodeFromTheRequestedDriveToBH 65 66 67 ;-------------------------------------------------------------------- 68 ; BackupErrorCodeFromTheRequestedDriveToBH 69 ; Parameters: 70 ; AH: Error code from the last resetted drive 71 ; DL: Drive last resetted 72 ; BL: Requested drive (DL when entering AH=00h) 73 ; Returns: 74 ; BH: Backuped error code 75 ; Corrupts registers: 76 ; Nothing 77 ;-------------------------------------------------------------------- 78 ALIGN JUMP_ALIGN 79 BackupErrorCodeFromTheRequestedDriveToBH: 80 cmp dl, bl ; Requested drive? 81 eCMOVE bh, ah 82 ret 83 68 84 69 85 ;-------------------------------------------------------------------- … … 82 98 mov dl, bl 83 99 call RamVars_IsDriveHandledByThisBIOS 84 j nc SHORT .Return ; Return what was in BL unmodified100 jc SHORT .Return ; Return what was in BL unmodified 85 101 mov dl, 80h 86 102 .Return: … … 101 117 ALIGN JUMP_ALIGN 102 118 AH0h_ResetHardDisksHandledByOurBIOS: 103 mov d h, [RAMVARS.bDrvCnt] ; Load drive count to DH119 mov dx, [RAMVARS.wDrvCntAndFirst] ; DL = drive number, DH = drive count 104 120 test dh, dh 105 121 jz SHORT .AllDrivesReset ; Return if no drives 106 mov dl, [RAMVARS.bFirstDrv] ; Load number of our first drive107 122 add dh, dl ; DH = one past last drive to reset 108 123 ALIGN JUMP_ALIGN … … 114 129 jb SHORT .DriveResetLoop ; If not, reset next drive 115 130 .AllDrivesReset: 116 ret 117 131 %ifdef MODULE_SERIAL_FLOPPY 132 ; 133 ; "Reset" emulatd serial floppy drives, if any. There is nothing to actually do for this reset, 134 ; but record the proper error return code if one of these floppy drives is the drive requested. 135 ; 136 call RamVars_UnpackFlopCntAndFirstToAL 137 138 cbw ; Clears AH (there are flop drives) or ffh (there are not) 139 ; Either AH has success code (flop drives are present) 140 ; or it doesn't matter because we won't match drive ffh 141 142 cwd ; clears DX (there are flop drives) or ffffh (there are not) 143 144 adc dl, al ; second drive (CF set) if present 145 ; If no drive is present, this will result in ffh which 146 ; won't match a drive 147 call BackupErrorCodeFromTheRequestedDriveToBH 148 mov dl, al ; We may end up doing the first drive twice (if there is 149 jmp BackupErrorCodeFromTheRequestedDriveToBH ; only one drive), but doing it again is not harmful. 150 %else 151 ret 152 %endif 153 118 154 ;-------------------------------------------------------------------- 119 155 ; .BackupErrorCodeFromMasterOrSlaveToBH … … 144 180 ret 145 181 182 146 183 ;-------------------------------------------------------------------- 147 184 ; GetBasePortToCX … … 167 204 168 205 169 ;--------------------------------------------------------------------170 ; BackupErrorCodeFromTheRequestedDriveToBH171 ; Parameters:172 ; AH: Error code from the last resetted drive173 ; DL: Drive last resetted174 ; BL: Requested drive (DL when entering AH=00h)175 ; Returns:176 ; BH: Backuped error code177 ; Corrupts registers:178 ; Nothing179 ;--------------------------------------------------------------------180 ALIGN JUMP_ALIGN181 BackupErrorCodeFromTheRequestedDriveToBH:182 cmp dl, bl ; Requested drive?183 eCMOVE bh, ah184 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm
r257 r258 15 15 ; Returns with INTPACK: 16 16 ; If succesfull: 17 ; AH: 3 (Hard disk accessible) 17 ; AH: Hard Disk: 3 (Hard disk accessible) 18 ; Floppy: 1 (Floppy disk, without change detection) 18 19 ; CX:DX: Total number of sectors 19 20 ; CF: 0 … … 25 26 ALIGN JUMP_ALIGN 26 27 AH15h_HandlerForReadDiskDriveSize: 28 %ifdef MODULE_SERIAL_FLOPPY 29 mov cl, 1 ; 1 = floppy disk, no change detection 30 31 test dl,dl ; DO NOT store the sector count if this is a 32 jns .FloppyDrive ; floppy disk, some OS's depend on this not 33 ; happening for floppies in order to boot. 34 %endif 35 27 36 call AH15h_GetSectorCountToBXDXAX 28 mov [bp+IDEPACK.intpack+INTPACK.cx], dx ; HIWORD to CX29 mov [bp+IDEPACK.intpack+INTPACK.dx], ax ; LOWORD to DX37 mov [bp+IDEPACK.intpack+INTPACK.cx], dx ; HIWORD to CX 38 xchg [bp+IDEPACK.intpack+INTPACK.dx], ax ; LOWORD to DX, AL gets drive number 30 39 31 xor ah, ah 32 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH ; Store success to BDA and CF 33 mov BYTE [bp+IDEPACK.intpack+INTPACK.ah], 3 ; Type code = Hard disk 40 xor ah, ah 41 %ifdef MODULE_SERIAL_FLOPPY 42 mov cl, 3 ; 3 = Hard Disk Accessible 43 .FloppyDrive: 44 45 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber ; Store success to BDA and CF 46 mov BYTE [bp+IDEPACK.intpack+INTPACK.ah], cl 47 %else 48 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH ; Store success to BDA and CF 49 mov BYTE [bp+IDEPACK.intpack+INTPACK.ah], 3 50 %endif 51 34 52 jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode 35 53 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm
r150 r258 20 20 AH1h_HandlerForReadDiskStatus: 21 21 LOAD_BDA_SEGMENT_TO ds, ax, ! 22 23 %ifdef MODULE_SERIAL_FLOPPY 24 test dl, dl 25 jns .HardDisk 26 mov ah, [BDA.bFDRetST] ; Unlike for hard disks below, floppy version does not clear the status 27 jmp .done 28 .HardDisk: 29 %endif 30 22 31 xchg ah, [BDA.bHDLastSt] ; Load and clear last error 32 ; Note that AH is cleared with the LOAD_BDA_SEGMENT above 33 34 .done: 23 35 call Int13h_SetErrorCodeToIntpackInSSBPfromAH 24 36 jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
r249 r258 40 40 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL 41 41 %endif 42 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
r227 r258 14 14 ; SS:BP: Ptr to IDEPACK 15 15 ; Returns with INTPACK: 16 ; BL: Drive Type (for floppies only) 16 17 ; CH: Maximum cylinder number, bits 7...0 17 18 ; CL: Bits 7...6: Cylinder number bits 9...8 … … 19 20 ; DH: Maximum head number (0...255) 20 21 ; DL: Number of drives 22 ; ES:DI: Floppy DPT (for floppies only) 21 23 ; AH: Int 13h/40h floppy return status 22 24 ; CF: 0 if successfull, 1 if error 23 25 ;-------------------------------------------------------------------- 24 26 AH8h_HandlerForReadDiskDriveParameters: 27 25 28 call RamVars_IsDriveHandledByThisBIOS 26 jnc SHORT .GetDriveParametersForForeignHardDiskInDL 29 jnc SHORT .OurDrive 30 31 call Int13h_CallPreviousInt13hHandler 32 jnc SHORT .MidGame 33 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 34 35 .OurDrive: 27 36 call AH8h_GetDriveParameters 28 jmp SHORT .ReturnAfterStoringValuesToIntpack29 37 30 .GetDriveParametersForForeignHardDiskInDL: 31 call Int13h_CallPreviousInt13hHandler 32 jc SHORT .ReturnErrorFromPreviousInt13hHandler 33 call RamVars_GetCountOfKnownDrivesToDL 34 .ReturnAfterStoringValuesToIntpack: 38 %ifdef MODULE_SERIAL_FLOPPY 39 push cs ; setup registers if we are a floppy drive, in all cases 40 pop es ; if it is not a floppy drive, these values will not be put in INTPACK 41 mov di, AH8h_FloppyDPT 42 %endif 43 ;; fall-through 44 45 .MidGame: 46 call RamVars_GetCountOfKnownDrivesToAX ; assume hard disk for now, will discard if for floppies 47 48 test byte [bp+IDEPACK.intpack+INTPACK.dl], 080h 49 jnz .Done 50 51 mov [bp+IDEPACK.intpack+INTPACK.bl], bl 52 53 mov [bp+IDEPACK.intpack+INTPACK.es], es 54 mov [bp+IDEPACK.intpack+INTPACK.di], di 55 56 call FloppyDrive_GetCountToAX 57 58 .Done: 59 mov ah, dh 60 35 61 mov [bp+IDEPACK.intpack+INTPACK.cx], cx 36 mov [bp+IDEPACK.intpack+INTPACK.dx], dx 62 xchg [bp+IDEPACK.intpack+INTPACK.dx], ax ; recover DL for BDA last status byte determination 63 37 64 xor ah, ah 38 .ReturnErrorFromPreviousInt13hHandler: 65 %ifdef MODULE_SERIAL_FLOPPY 66 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber 67 %else 39 68 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 69 %endif 40 70 41 71 … … 51 81 ; Bits 5...0: Maximum sector number (1...63) 52 82 ; DH: Maximum head number (0...255) 53 ; DL: Number of drives54 83 ; Corrupts registers: 55 84 ; AX, BX … … 73 102 ; Bits 5...0: Maximum sector number (1...63) 74 103 ; DH: Maximum head number (0...255) 75 ; DL: Number of drives76 104 ; Corrupts registers: 77 105 ; AX, BX … … 85 113 or cl, bh ; CL bits 0...5 = Sectors per track 86 114 mov dh, bl ; DH = Maximum head number 87 jmp RamVars_GetCountOfKnownDrivesToDL 115 116 %ifdef MODULE_SERIAL_FLOPPY 117 mov bl,[di+DPT.bFlagsHigh] 118 eSHR_IM bl,FLGH_DPT_SERIAL_FLOPPY_TYPE_FIELD_POSITION 119 %endif 120 ret 121 122 %ifdef MODULE_SERIAL_FLOPPY 123 ; 124 ; Floppy Disk Parameter Table. There is no way to specify more than one of these 125 ; for any given system, so no way to make this drive or media specific. 126 ; So we return fixed values out of the ROM for callers might be expecting this information. 127 ; 128 ; On AT systems, we return the information for a 1.44 MB disk, 129 ; and on XT systems, we return the information for a 360 KB disk. 130 ; 131 AH8h_FloppyDPT: 132 %ifdef USE_AT 133 db 0ah << 4 | 0fh ; Offset 0: Drive timings, 1.44MB values 134 %else 135 db 0dh << 4 | 0fh ; Offset 0: Drive timings, 360KB values 136 %endif 137 138 db 1h << 1 | 0 ; Offset 1: Typical values of 1 for head load time 139 ; DMA used (although it actually is not, but is more restrctive) 140 db 25h ; Offset 2: Inactiviy motor turn-off delay, 141 ; Typical value of 25h for 2 second delay 142 db 02h ; Offset 3: Sector size, always 512 143 144 %ifdef USE_AT 145 db 12h ; Offset 4: Sectors per track, 1.44MB value 146 db 1bh ; Offset 5: Sector gap, 1.44MB value 147 %else 148 db 09h ; Offset 4: Sectors per track, 360KB value 149 db 2ah ; Offset 5: Sector gap, 360KB value 150 %endif 151 152 db 0ffh ; Offset 6: Data length 153 154 %ifdef USE_AT 155 db 6ch ; Offset 7: Format gap length, 1.44MB value 156 %else 157 db 50h ; Offset 7: Format gap length, 360KB value 158 %endif 159 160 db 0f6h ; Offset 8: Fill byte for format 161 db 0fh ; Offset 9: Head setting time 162 db 08h ; Offset A: Wait for motor startpu time 163 164 %ifdef USE_AT 165 db 79 ; Offset B: Maximum track number, 1.44MB value 166 db 0 ; Offset C: Data transfer rate, 1.44MB value 167 db 4 ; Offset D: Diskette CMOS drive type, 1.44MB value 168 %else 169 db 39 ; Offset B: Maximum track number, 360KB value 170 db 80h ; Offset C: Data transfer rate, 360KB value 171 db 1 ; Offset D: Diskette CMOS drive type, 360KB value 172 %endif 173 %endif -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r227 r258 43 43 push cx 44 44 45 %ifdef MODULE_SERIAL 46 ; 47 ; no need to do this for serial deveices, and we use the DPT_RESET flag bits 48 ; to store the drive type for serial floppy drives (MODULE_SERIAL_FLOPPY) 49 ; 50 xor ah, ah 51 test byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE ; Clears CF 52 jnz .ReturnNotSuccessfull 53 %endif 54 45 55 ; Try to select drive and wait until ready 46 56 or BYTE [di+DPT.bFlagsHigh], MASKH_DPT_RESET ; Everything uninitialized -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
r250 r258 31 31 ; Install INT 19h handler for proper reboot 32 32 LOAD_BDA_SEGMENT_TO es, ax 33 mov bx, BIOS_BOOT_LOADER_INTERRUPT_19h ; INT 19h interrupt vector offset33 mov al, BIOS_BOOT_LOADER_INTERRUPT_19h ; INT 19h interrupt vector offset 34 34 mov si, Int19h_ResetHandler ; INT 19h handler to reboot the system 35 call Interrupts_InstallHandlerToVectorIn BXFromCSSI35 call Interrupts_InstallHandlerToVectorInALFromCSSI 36 36 call Initialize_AndDetectDrives ; Installs new boot menu loader 37 37 ; Fall to .PrepareStackAndSelectDriveFromBootMenu
Note:
See TracChangeset
for help on using the changeset viewer.