📄 ri61ffd.asm
字号:
;---------------------------------------;
; InitBufferPrfFailSafe ;
;---------------------------------------;-------------------------------------;
; This routine can be used to update _common_cmos_buffer in peripheral setup ;
; screen when user loads fail safe values. This routine is called from ;
; CMOS_SETUP. ;
; ;
; Input: Pointer to _common_cmos_buffer ?................. ;
; DS = ES = Segment of _common_cmos_buffer ;
; Stack available ;
; ;
; Output: Nothing ;
; ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------------;
InitBufferPrfFailSafe proc near private
ret
InitBufferPrfFailSafe endp
;---------------------------------------;
; GetHardwareConfig ;
;---------------------------------------;-------------------------------------;
; This routine determines the current configuration of the peripheral device ;
; by reading directly from its registers. The value returned is an entry ;
; number in the DeviceConfigTable. ;
; ;
; Value Read Entry # in Config ;
; From CR30 DeviceConfigTable Setting ;
; ------------ ----------------- -------- ;
; 0 0 Disabled ;
; 1 1 Enabled ;
; ;
; Input: Nothing ;
; Stack available ;
; ;
; Output: AL = Entry number in DeviceConfigTable that represents the current ;
; configuration of the peripheral device. ;
; ;
; Destroys: AL ;
;-----------------------------------------------------------------------------;
GetHardwareConfig proc near private
push bx
mov al, 30h ;Read register CR30
mov bl, 00h ;Select Logical Device 0 (FDC)
call IT8661FReadIO ;AL = Register value
pop bx
ret
GetHardwareConfig endp
;---------------------------------------;
; SetHardwareConfig ;
;---------------------------------------;-------------------------------------;
; This routine sets the current configuration of the peripheral device by ;
; writing directly to its registers. ;
; ;
; Entry # in Value Written Config ;
; DeviceConfigTable To CR30 Setting ;
; ----------------- ------------ -------- ;
; 0 0 Disabled ;
; 1 1 Enabled ;
; ;
; Input: AL = Entry number in DeviceConfigTable ;
; Stack available ;
; ;
; Output: Nothing ;
; ;
; Destroys: AX ;
;-----------------------------------------------------------------------------;
SetHardwareConfig proc near private
push bx
mov ah, al
mov al, 30h ;AH = value to write, AL = CR30
mov bl, 00h ;Select Logical Device 0 (FDC)
call IT8661FWriteIO ;Set H/W configuration
pop bx
ret
SetHardwareConfig endp
;---------------------------------------;
; ConfigNumberToNodeData ;
;---------------------------------------;-------------------------------------;
; This routine copies data from the given ConfigTableEntry into the proper ;
; fields in the node's resource descriptors. ;
; ;
; Input: AL = Entry number in DeviceConfigTable ;
; DS:SI = Pointer to buffer containing node structure ;
; Stack available ;
; ;
; Output: Nothing ;
; ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------------;
ConfigNumberToNodeData proc near private
push ax
push bx
mov bl, size ConfigTableEntry
mul bl ;AX = <entry # (AL)> * <entry size>
mov bx, offset DeviceConfigTable
add bx, ax ;BX = proper ConfigTableEntry
; Copy fields from the given ConfigTableEntry into the device node
; before it is returned to the caller.
mov ax, (ConfigTableEntry ptr cs:[bx]).PortAddress
mov (DevNodeDataBlock ptr [si]).FloppyPort.pdes_min_base, ax
mov (DevNodeDataBlock ptr [si]).FloppyPort.pdes_max_base, ax
mov al, (ConfigTableEntry ptr cs:[bx]).PortSize
mov (DevNodeDataBlock ptr [si]).FloppyPort.pdes_length, al
mov ax, (ConfigTableEntry ptr cs:[bx]).IrqMask
mov (DevNodeDataBlock ptr [si]).FloppyIrq.ides_irq_mask, ax
mov al, (ConfigTableEntry ptr cs:[bx]).DmaMask
mov (DevNodeDataBlock ptr [si]).FloppyDma.ddes_dma_mask, al
pop bx
pop ax
ret
ConfigNumberToNodeData endp
;---------------------------------------;
; NodeDataToConfigNumber ;
;---------------------------------------;-------------------------------------;
; This routine examines the node data and determines which ConfigTableEntry ;
; corresponds to the current configuration of the node. ;
; ;
; Input: AL = Node number ;
; DS:SI = Pointer to the node data ;
; Stack available ;
; ;
; Output: CF = Clear if a ConfigTableEntry matching the node data was found ;
; Set if no ConfigTableEntry matches the node data (node data ;
; contains an invalid configuration) ;
; AL = Entry number in DeviceConfigTable ;
; ;
; Destroys: BX, CX, DX ;
;-----------------------------------------------------------------------------;
NodeDataToConfigNumber proc near private
xor al, al ;Assume entry 0 in DeviceConfigTable
cmp (DevNodeDataBlock ptr [si]).FloppyPort.pdes_min_base, 0
je ConfigNumberFound ;Br if device is disabled in node data
inc al ;Node data says enabled, so entry 1
ConfigNumberFound:
ret
NodeDataToConfigNumber endp
;---------------------------------------;
; FloppySetDensity ;
;---------------------------------------;-------------------------------------;
; This routine sets the floppy controller DENSEL pin to either high (for ;
; normal drive) or low (for 3mode drive). ;
; ;
; Input: DH = 0 Set DENSEL to high (normal mode) ;
; = 1 Set DENSEL to low (3mode) ;
; DL = 00 for drive A ;
; = 01 for drive B ;
; Stack available ;
; ;
; Output: None ;
; ;
; Destroys: None ;
;-----------------------------------------------------------------------------;
extrn fixed_delay:near
FloppySetDensity proc near private
push ax
push bx
mov al, 0F0h ;Read register CRF0
xor bl, bl ;Select Logical Device 0 (FDC)
call IT8661FReadIO ;AL = Register value
or dh, dh ;DH = 0/1 for setting DENSEL pin
; Normal(High)/Low
jnz SetDensityLow
;Normal density
test al, 00000010b ;AL.1 = 0/1 for Normal/3-Mode
jz SetDensityExit ;Exit if DENSEL already in normal state
and al, 11111101b
jmp short SetDensity
SetDensityLow:
test al, 00000010b ;AL.1 = 0/1 for Normal/3-Mode
jnz SetDensityExit ;Exit if DENSEL already in 3-Mode state
or al, 00000010b
SetDensity:
mov ah, al
mov al,0F0h
xor bl, bl
call IT8661FWriteIO ;Set H/W configuration
; mov cx, 33334 ;500mS delay time
mov cx, 13333 ;200mS delay time
call fixed_delay ;15uS each count
SetDensityExit:
pop bx
pop ax
ret
FloppySetDensity endp
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1998, American Megatrends, Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F Northbelt Pkwy, Norcross, GA 30071 **;
;** **;
;** Phone (770)-246-8600 **;
;** **;
;*****************************************************************;
;*****************************************************************;
_text ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -