Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization
- Timestamp:
- Feb 22, 2012, 7:01:53 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Initialization
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r254 r258 43 43 44 44 %ifdef MODULE_SERIAL 45 ;---------------------------------------------------------------------- 45 46 ; 46 47 ; if serial drive detected, do not scan (avoids duplicate drives and isn't needed - we already have a connection) … … 57 58 %endif 58 59 59 .done: 60 .done: 61 %ifdef MODULE_SERIAL_FLOPPY 62 ;---------------------------------------------------------------------- 63 ; 64 ; Add in any emulated serial floppy drives. 65 ; 66 mov al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt] 67 dec al 68 mov cl, al 69 js .NoFloppies ; if no drives are present, we store 0ffh 70 71 call FloppyDrive_GetCountFromBIOS_or_BDA 72 73 push ax 74 75 add al, cl ; Add our drives to existing drive count 76 cmp al, 3 ; For BDA, max out at 4 drives (ours is zero based) 77 jl .MaxBDAFloppiesExceeded 78 mov al, 3 79 .MaxBDAFloppiesExceeded: 80 eROR_IM al, 2 ; move to bits 6-7 81 inc ax ; low order bit, indicating floppy drive exists 82 83 mov ah, [es:BDA.wEquipment] ; Load Equipment WORD low byte 84 and ah, 03eh ; Mask off drive number and drives present bit 85 or al, ah ; Or in new values 86 mov [es:BDA.wEquipment], al ; and store 87 88 mov al, 1eh ; BDA pointer to Floppy DPT 89 mov si, AH8h_FloppyDPT 90 call Interrupts_InstallHandlerToVectorInALFromCSSI 91 92 pop ax 93 94 shr cl, 1 ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2) 95 rcl al, 1 ; starting drive number in upper 7 bits, number of drives in low bit 96 .NoFloppies: 97 mov [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al 98 %endif 99 60 100 ret 61 101 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
r181 r258 120 120 ; Returns number of Floppy Drives in system. 121 121 ; 122 ; FloppyDrive_GetCountToCX 123 ; Parameters: 124 ; Nothing 125 ; Returns: 126 ; CX: Number of Floppy Drives 127 ; Corrupts registers: 128 ; Nothing 129 ;-------------------------------------------------------------------- 130 ALIGN JUMP_ALIGN 131 FloppyDrive_GetCountToCX: 122 ; FloppyDrive_GetCountToAX 123 ; Parameters: 124 ; DS: RAMVARS Segment 125 ; Returns: 126 ; AX: Number of Floppy Drives 127 ;-------------------------------------------------------------------- 128 ALIGN JUMP_ALIGN 129 FloppyDrive_GetCountToAX: 130 %ifdef MODULE_SERIAL_FLOPPY 131 call RamVars_UnpackFlopCntAndFirstToAL 132 adc al,1 ; adds in the drive count bit, and adds 1 for count vs. 0-index, 133 ; but still won't impact SF 134 jns .UseInternalNumber ; need to clear CH on the way out, and add in additional drive numbers 135 136 %endif 137 call FloppyDrive_GetCountFromBIOS_or_BDA 138 139 .UseInternalNumber: 140 mov ah, [cs:ROMVARS.bMinFddCnt] 141 MAX_U al, ah 142 cbw 143 144 ret 145 146 ALIGN JUMP_ALIGN 147 FloppyDrive_GetCountFromBIOS_or_BDA: 132 148 push es 133 %ifdef USE_AT134 call GetCountFromBIOS135 %else136 call GetCountFromBDA137 %endif138 mov ch, [cs:ROMVARS.bMinFddCnt]139 MAX_U cl, ch140 pop es141 xor ch, ch142 ret143 144 149 145 150 ;-------------------------------------------------------------------- … … 160 165 %ifdef USE_AT 161 166 ALIGN JUMP_ALIGN 162 GetCountFromBIOS:167 .GetCountFromBIOS: 163 168 push di 164 169 push dx 165 170 push bx 166 push ax167 171 168 172 mov ah, 08h ; Get Drive Parameters 169 173 cwd ; Floppy Drive 00h 170 174 int BIOS_DISKETTE_INTERRUPT_40h 171 mov cl, dl ; Number of Floppy Drives to CL 172 173 pop ax 175 mov al, dl ; Number of Floppy Drives to AL 176 174 177 pop bx 175 178 pop dx 176 179 pop di 177 ret 178 %endif 179 180 %endif 180 181 181 182 ;-------------------------------------------------------------------- … … 193 194 %ifndef USE_AT 194 195 ALIGN JUMP_ALIGN 195 GetCountFromBDA: 196 LOAD_BDA_SEGMENT_TO es, cx 197 mov cl, [es:BDA.wEquipment] ; Load Equipment WORD low byte 198 mov ch, cl ; Copy it to CH 199 and cx, 0C001h ; Leave bits 15..14 and 0 200 eROL_IM ch, 2 ; EW low byte bits 7..6 to 1..0 201 add cl, ch ; CL = Floppy Drive count 202 ret 203 %endif 196 .GetCountFromBDA: 197 LOAD_BDA_SEGMENT_TO es, ax 198 mov al, [es:BDA.wEquipment] ; Load Equipment WORD low byte 199 mov ah, al ; Copy it to CH 200 and ax, 0C001h ; Leave bits 15..14 and 0 201 eROL_IM ah, 2 ; EW low byte bits 7..6 to 1..0 202 add al, ah ; CL = Floppy Drive count 203 %endif 204 205 pop es 206 ret 207 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r243 r258 29 29 30 30 ; Install INT 19h handler (boot loader) where drives are detected 31 mov bx, BIOS_BOOT_LOADER_INTERRUPT_19h31 mov al, BIOS_BOOT_LOADER_INTERRUPT_19h 32 32 mov si, Int19h_BootLoaderHandler 33 call Interrupts_InstallHandlerToVectorIn BXFromCSSI33 call Interrupts_InstallHandlerToVectorInALFromCSSI 34 34 35 35 .SkipRomInitialization: … … 73 73 mov dl, 80h 74 74 call RamVars_IsDriveHandledByThisBIOS 75 j nc SHORT .FindForDrive81h ; Store nothing if not our drive75 jc SHORT .FindForDrive81h ; Store nothing if not our drive 76 76 call FindDPT_ForDriveNumber ; DPT to DS:DI 77 77 mov [es:HD0_DPT_POINTER_41h*4], di … … 80 80 inc dx 81 81 call RamVars_IsDriveHandledByThisBIOS 82 j nc SHORT .ResetDetectedDrives82 jc SHORT .ResetDetectedDrives 83 83 call FindDPT_ForDriveNumber 84 84 mov [es:HD1_DPT_POINTER_46h*4], di -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
r243 r258 34 34 mov ax, [es:BIOS_DISK_INTERRUPT_13h*4] ; Load old INT 13h offset 35 35 mov [RAMVARS.fpOldI13h], ax ; Store old INT 13h offset 36 37 mov bx, BIOS_DISK_INTERRUPT_13h ; INT 13h interrupt vector offset38 mov si, Int13h_DiskFunctionsHandler ; Interrupt handler offset39 call Interrupts_InstallHandlerToVectorInBXFromCSSI40 36 41 37 ; Only store INT 13h handler to 40h if 40h is not already installed. … … 47 43 mov [es:BIOS_DISKETTE_INTERRUPT_40h*4+2], dx ; Store old INT 13h segment 48 44 .Int40hAlreadyInstalled: 45 46 mov al, BIOS_DISK_INTERRUPT_13h ; INT 13h interrupt vector offset 47 mov si, Int13h_DiskFunctionsHandler ; Interrupt handler offset 48 call Interrupts_InstallHandlerToVectorInALFromCSSI 49 49 ; Fall to .InitializeHardwareIrqHandlers 50 50 … … 56 56 ; Nothing 57 57 ; Corrupts registers: 58 ; BX, CX, DX, SI, DI 58 ; BX, CX, DX, SI, DI, AX 59 59 ;-------------------------------------------------------------------- 60 60 .InitializeHardwareIrqHandlers: … … 62 62 mov di, ROMVARS.ideVars0 ; CS:SI points to first IDEVARS 63 63 .IdeControllerLoop: 64 eMOVZX bx, BYTE [cs:di+IDEVARS.bIRQ]64 mov al, BYTE [cs:di+IDEVARS.bIRQ] 65 65 add di, BYTE IDEVARS_size ; Increment to next controller 66 66 call .InstallLowOrHighIrqHandler … … 72 72 ; .InstallLowOrHighIrqHandler 73 73 ; Parameters: 74 ; BX: IRQ number, 0 if IRQ disabled74 ; AL: IRQ number, 0 if IRQ disabled 75 75 ; ES: BDA and Interrupt Vector segment (zero) 76 76 ; Returns: … … 80 80 ;-------------------------------------------------------------------- 81 81 .InstallLowOrHighIrqHandler: 82 test bl, bl82 test al, al 83 83 jz SHORT .Return ; IRQ not used 84 cmp bl, 884 cmp al, 8 85 85 jb SHORT .InstallLowIrqHandler 86 86 ; Fall to .InstallHighIrqHandler … … 94 94 ; Nothing 95 95 ; Corrupts registers: 96 ; BX, SI96 ; AL, BX, SI 97 97 ;-------------------------------------------------------------------- 98 98 .InstallHighIrqHandler: 99 add bx, BYTE HARDWARE_IRQ_8_INTERRUPT_70h - 8 ; Interrupt vector number99 add al, BYTE HARDWARE_IRQ_8_INTERRUPT_70h - 8 ; Interrupt vector number 100 100 mov si, IdeIrq_InterruptServiceRoutineForIrqs8to15 101 jmp SHORT Interrupts_InstallHandlerToVectorIn BXFromCSSI101 jmp SHORT Interrupts_InstallHandlerToVectorInALFromCSSI 102 102 103 103 ;-------------------------------------------------------------------- 104 104 ; .InstallLowIrqHandler 105 105 ; Parameters: 106 ; BX: IRQ number (0...7)107 ; ES: BDA and Interrupt Vector segment (zero) 108 ; Returns: 109 ; Nothing 110 ; Corrupts registers: 111 ; BX, SI106 ; AL: IRQ number (0...7) 107 ; ES: BDA and Interrupt Vector segment (zero) 108 ; Returns: 109 ; Nothing 110 ; Corrupts registers: 111 ; AL, BX, SI 112 112 ;-------------------------------------------------------------------- 113 113 .InstallLowIrqHandler: 114 add bx, BYTE HARDWARE_IRQ_0_INTERRUPT_08h ; Interrupt vector number114 add al, BYTE HARDWARE_IRQ_0_INTERRUPT_08h ; Interrupt vector number 115 115 mov si, IdeIrq_InterruptServiceRoutineForIrqs2to7 116 ; Fall to Interrupts_InstallHandlerToVectorIn BXFromCSSI117 118 119 ;-------------------------------------------------------------------- 120 ; Interrupts_InstallHandlerToVectorIn BXFromCSSI121 ; Parameters: 122 ; BX: Interrupt vector number (for example 13h)116 ; Fall to Interrupts_InstallHandlerToVectorInALFromCSSI 117 118 119 ;-------------------------------------------------------------------- 120 ; Interrupts_InstallHandlerToVectorInALFromCSSI 121 ; Parameters: 122 ; AL: Interrupt vector number (for example 13h) 123 123 ; ES: BDA and Interrupt Vector segment (zero) 124 124 ; CS:SI: Ptr to interrupt handler … … 126 126 ; Nothing 127 127 ; Corrupts registers: 128 ; BX 129 ;-------------------------------------------------------------------- 130 Interrupts_InstallHandlerToVectorInBXFromCSSI: 131 eSHL_IM bx, 2 ; Shift for DWORD offset 128 ; AX, BX 129 ;-------------------------------------------------------------------- 130 Interrupts_InstallHandlerToVectorInALFromCSSI: 131 mov bl, 4 ; Shift for DWORD offset, MUL smaller than other alternatives 132 mul bl 133 xchg ax, bx 132 134 mov [es:bx], si ; Store offset 133 135 mov [es:bx+2], cs ; Store segment
Note:
See TracChangeset
for help on using the changeset viewer.