📄 usbi13.asm
字号:
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13Func04 PROC NEAR SYSCALL
; Check the error code returned by set misc info in stack routine
or ax, ax
jnz u1f4_Exit
push cx
push dx
mov dl, USB_MASSAPI_VERIFY_DEVICE
mov cx, OFFSET UI13FormURP
call USBINT13CommonRWVHandler
pop dx
pop cx
u1f4_Exit:
ret
UI13Func04 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13FDDFunc05
;
; Description: This function is the floppy drive format call
;
; Input: SI Pointer to stack frame where all the register values
; are saved:
; AL Number of sectors to be created on this trk
; CH Low 8bits of 10bit cylinder number (0 based)
; CL Bit 7-6 : High 2 bits of 10bit cylinder num
; CL Bit 5-0 : Starting sector number (1 based)
; DH Head number (0 based)
; ES:BX Pointer to 4-byte address field
; AX Return code returned from USBI13SetMiscInfoInStack routine
;
; Output: AX 0 on success
; <> 0 on error
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13FDDFunc05 PROC NEAR SYSCALL
LOCAL sURP:URP_STRUC
; Check the error code returned by set misc info in stack routine
or ax, ax
jnz u1f5_Exit
push bx
push es
push ss
pop es
lea bx, sURP
; ES:BX far URP_STRUC pointer
call UI13FormURP
Comment ~
push bx
push di
mov di, word ptr [bp+ModStackPosEBX]; ES:BX = ptr to buffer
; current media information are set in stack
; (#of heads, #of sectors/track, #of bytes/sector, #of cylinders)
mov bl, byte ptr [bp+ModStackPosEDX+1]; BL = Head #
mov bh, byte ptr [bp+ModStackPosECX+1]; BH = cylinder # (0-based)
; BH = cylinder#
; BL = head #
call FormatUsbDevice
pop di
pop bx
EndComment ~
pop es
pop bx
u1f5_Exit:
ret
UI13FDDFunc05 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13FDDFunc08
;
; Description: This function is the get drive parameter INT13h API call
;
; Input: SI Pointer to stack frame
; AX Return code returned from USBI13SetMiscInfoInStack routine
;
; Output: AH 0 on success
; <> 0 on error
; DL Number of FDD devices
; DH Max. Head number (0 based)
; CL Max. Sector number (Bits 5-0) (1 based)
; CH Max. Cylinder number
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
FDDParam1440Table DB 0AFH, 002H, 025H, 002H, 012H, 01BH
DB 0FFH, 06CH, 0F6H, 00FH, 008H, 04FH, 000h
FDDParam720Table DB 0DFH, 002H, 025H, 002H, 009H, 02AH
DB 0FFH, 050H, 0F6H, 00FH, 008H, 04FH, 080H
UI13FDDFunc08 PROC NEAR SYSCALL PUBLIC
; Check the error code returned by set misc info in stack routine
or ax, ax
jnz u1f8_Exit
push bx
push dx
; Get number of heads
mov dh, (USBLocalStore PTR SS:[si]).bNumHeads
mov bh, dh ; BH = Num. of heads
dec dh ; Max. num of heads (0 based)
push dx ; DH - Max. head number
; Get number of cylinders
mov ax, (USBLocalStore PTR SS:[si]).wNumCyls
dec ax ; Max. num of cylinder (0 based)
mov dx, ax ; DX - Max. num of cylinders
xchg al, ah ; AH - bit 7-0 of 10 bit max. cyl. no
shl al, 6 ; AL(7-6) = Bits 9-8 of 10 bit cyl no
mov bl, (USBLocalStore PTR SS:[si]).bNumSecs
; BL - Max sector number
or al, bl ; AL(5-0) = Max sector number
push ax ; Max cylinder & sector numbers
; DX = #of cylinders of the current media
; BH, BL = #of heads, #of sectors/track of the current media
pop bx
pop dx
; DH = maxm head# (0-based)
; BH,BL = maxm cyl# (0-based), maxm sector#
push ds
push BDA_DSEG
pop ds
mov dl, BYTE PTR DS:[010h] ; Machine config. byte
pop ds
shr dl, 06h ; DL = #of INT40 devices (0-based)
inc dl ; DL = #of INT40 devices (1-based)
mov WORD PTR (USBLocalStore PTR SS:[si]).dRegECX, bx ; Return CX
mov WORD PTR (USBLocalStore PTR SS:[si]).dRegEDX, dx ; Return DX
; Return the parameter table
mov ax, OFFSET CS:FDDParam1440Table
;; mov ax, OFFSET CS:FDDParam720Table
mov WORD PTR (USBLocalStore PTR SS:[si]).dRegEDI, ax ; Return ES:DI = Ptr to the
; floppy param table
push cs
pop ax
; Parameter table for current media
mov (USBLocalStore PTR SS:[si]).wRegES, ax
;; mov BYTE PTR (USBLocalStore PTR SS:[si]).dRegEBX, 004h
mov BYTE PTR (USBLocalStore PTR SS:[si]).dRegEBX, 010h ; Indicate removable
pop dx
pop bx
xor ah, ah ; Return as successful complete
u1f8_Exit:
ret
UI13FDDFunc08 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13HDDFunc08
;
; Description: This function is the get drive parameter INT13h API call
;
; Input: SI Pointer to stack frame
;
; Output: AH 0 on success
; <> 0 on error
; DL Number of FDD devices
; DH Max. Head number (0 based)
; CL Max. Sector number (Bits 5-0) (1 based)
; CH Max. Cylinder number
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13HDDFunc08 PROC NEAR SYSCALL
; Check the error code returned by set misc info in stack routine
or ax, ax
jnz u1h8_Exit
push bx
push dx
; Get number of heads
mov dh, (USBLocalStore PTR SS:[si]).bNumHeads
mov bh, dh ; BH = Num. of heads
dec dh ; Max. num of heads (0 based)
push dx ; DH - Max. head number
; Get number of cylinders
mov ax, (USBLocalStore PTR SS:[si]).wNumCyls
dec ax ; Max. num of cylinder (0 based)
; The following code was added for IBM compatibility. It may not be needed
; anymore
;; sub ax, 2 ; I DON'T KNOW WHY ????
mov dx, ax ; DX - Max. num of cylinders
xchg al, ah ; AH - bit 7-0 of 10 bit max. cyl. no
shl al, 6 ; AL(7-6) = Bits 9-8 of 10 bit cyl no
mov bl, (USBLocalStore PTR SS:[si]).bNumSecs
; BL - Max sector number
or al, bl ; AL(5-0) = Max sector number
push ax ; Max cylinder & sector numbers
; DX = #of cylinders of the current media
; BH, BL = #of heads, #of sectors/track of the current media
pop bx
pop dx
; DH = maxm head# (0-based)
; BH,BL = maxm cyl# (0-based), maxm sector#
push ds
push BDA_DSEG
pop ds
mov dl, BYTE PTR DS:[75h] ; # of hard disks
pop ds
mov WORD PTR (USBLocalStore PTR SS:[si]).dRegECX, bx ; Return CX
mov WORD PTR (USBLocalStore PTR SS:[si]).dRegEDX, dx ; Return DX
xor ah, ah ; Always successful
pop dx
pop bx
u1h8_Exit:
ret
UI13HDDFunc08 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13FDDFunc15
;
; Description: This function returns the drive status
;
; Input: SI Pointer to stack frame
; DL Drive number
;
; Output: AL 0 On success
; AH = 0 No drive present
; = 1 No change line support
; = 2 Supports change line
; AL <> 0 on error
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13FDDFunc15 PROC NEAR SYSCALL
; Drive present. Return 1.44MB floppy information
; Return media type
mov BYTE PTR (USBLocalStore PTR SS:[si+1]).dRegEBX, 04h ; 1.44MB Floppy
;; mov BYTE PTR (USBLocalStore PTR SS:[si+1]).dRegEBX, 03h ; 720KB Floppy
; Check the return code returned by the Set misc info call
cmp ah, 80h ; Drive not present
je u1f15_SetDriveNotPresent
;; mov ah, 01h ; No change line support
mov ah, 02h ; Drive supports change line
jmp SHORT ulf15_Done
u1f15_SetDriveNotPresent:
xor ah, ah
ulf15_Done:
mov BYTE PTR (USBLocalStore PTR SS:[si+1]).dRegEAX, ah
xor al, al
ret
UI13FDDFunc15 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13FDDFunc16
;
; Description: This function returns the drive status and media presence
; status
;
; Input: SI Pointer to stack frame
; DL Drive number
;
; Output: AL 0 on success
; AH = 00h No disk change
; = 01h Invalid disk parameter
; = 06h Disk changed
; = 80h Disk not ready
; AL <> 0 on error
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13FDDFunc16 PROC NEAR SYSCALL
; Return media type
mov BYTE PTR (USBLocalStore PTR SS:[si+1]).dRegEBX, 04h ; 1.44MB Floppy
;; mov BYTE PTR (USBLocalStore PTR SS:[si+1]).dRegEBX, 03h ; 720KB Floppy
xor ah, ah ; No media change
;; cmp (USBLocalStore PTR SS:[si]).bMediaChange, 0FFh
;; jne UIFF16_NoChange
;; mov ah, 6
;;UIFF16_NoChange:
mov BYTE PTR (USBLocalStore PTR SS:[si+1]).dRegEAX, ah
xor al, al
ret
UI13FDDFunc16 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13FDDFunc17
;
; Description: This function sets the DASD type for the format command
;
; Input: SI Pointer to stack frame
; AL Disk type
;
; Output: AX 0 on success
; <> 0 on error
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13FDDFunc17 PROC NEAR SYSCALL
%Out Check the output from USB Int13h Func 17h
xor ah, ah ; Return always successful
ret
UI13FDDFunc17 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13FDDFunc18
;
; Description: This function does ??????
;
; Input: SI Pointer to stack frame
; CH Lower 8bits of number of tracks
; CL(5,0) Sectors per track
; CL(7,6) Top two bits of number of tracks
;
; Output: AH 0 on success
; ES:DI Disk parameter table on success
; <> 0 on error
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13FDDFunc18 PROC NEAR SYSCALL
push cs
pop ax
; Return parameter table for current media
mov (USBLocalStore PTR SS:[si]).wRegES, ax
mov ax, OFFSET CS:FDDParam1440Table
;; mov ax, OFFSET CS:FDDParam720Table
mov WORD PTR (USBLocalStore PTR SS:[si]).dRegEDI, ax
xor ah, ah
ret
UI13FDDFunc18 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13FDDFunc20
;
; Description: This function returns the current media format
;
; Input: SI Pointer to stack frame
; DL Drive number
; CL(5,0) Sectors per track
; CL(7,6) Top two bits of number of tracks
;
; Output: AH 00 Media present and unknown media
; 31h Media not present
; 32h Media present and known media, see AL
; AL Media type
; 03h 720KB Floppy
; 04h 1.44MB Floppy
; 06h 2.88MB Floppy
; 0Ch 360KB Floppy
; 0Dh 1.2MB Floppy
; 0Eh Toshiba 3-Mode Floppy
; 0Fh NEC 3-Mode Floppy
; 10h ATAPI Removable Media Device
;
; Modified: AX
;
; Referrals: USBLocalStore, URP_STRUC
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
UI13FDDFunc20 PROC NEAR SYSCALL
push bx
mov bx, 3210h ; For disk on key
; Check the code returned by the set misc info routine
cmp ah, 80h ; Media not present
jne u1f20_Done ; Media present!
; Return as media not present
mov bx, 3104h
u1f20_Done:
mov ax, bx
pop bx
ret
UI13FDDFunc20 ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
; Procedure: UI13Func41
;
; Description: This function is used to check for the presence of INT 13h
; extensions for a particular drive.
;
; Input: SI Pointer to stack frame
; DL Drive number
; BX Signature 55AAh
;
; Output: AX 0 if not supported
; AH Major version number of API extension
; AL Minor version number of API extension supported
; BX 0AA55h
; CX API subset support flags
; bit-0 = 0/1 - Extended disk access subset not/yes
; supported
; bit-1 = 0/1 - Removable drive control subset not/yes
; supported
; bit-2 = 0/1 - EDD specification supported
; bit15-3 - RESERVED (must be set to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -