⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vsa1back.asm

📁 X86 GX1 BOOTLOAD代码 ,支持WINCE操作系统!
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;**************************************************************************
;*
;*  VSA1BACK.ASM
;*
;*  Copyright (c) 1998-1999 National Semiconductor Corporation.
;*  All Rights Reserved.
;*
;*  Function:
;*    VSA1 INT15h callback mechanism.  See the VSA BIOS Porting Guide.
;*
;*  $Revision:: 1   $
;*
;**************************************************************************

;.MODEL TINY
.486P

	INCLUDE MACROS.INC
	INCLUDE DEF.INC
	INCLUDE 5530.INC
	INCLUDE OPTIONS.INC
	INCLUDE BDA.INC
_TEXT SEGMENT PUBLIC use16 'CODE'

;       EXTERN  geodeI2cDdc:NEAR
;       EXTERN  Geode_Video_Interface:NEAR
	EXTERN	cy55x0RegWrite8:NEAR
	EXTERN	cy55x0RegRead8:NEAR

;**************************************************************************
;*
;*      Geode Extended INT 15 Functions
;*
;**************************************************************************
geodeInt15Table LABEL WORD
        DW      geodeMiscConfig         ; CH = 0, Read/Write Misc SMI Config Bits
        DW      geodeVideoConfig        ; R/W Video SMI Config Bits
        DW      geodeAudioConfig        ; R/W Audio SMI Config Bits
        DW      geodePmConfig           ; R/W PM SMI Config Bits
        DW      geodePmSuspendTimeout   ; R/W Suspend Timeout
        DW      geodePmStandbyTimeout   ; R/W Standby Timeout
        DW      geodePmHDTimeout        ; R/W Hard Drive Timeout
        DW      geodePmFDTimeout        ; R/W Floppy Timeout
        DW      geodePmPSTimeout        ; R/W Parallel/Serial Timout
        DW      geodePmAlarmTime        ; R/W RTC Alarm Time
        DW      geodePmWakeupMask       ; R/O Wakeup Interrupt Mask
        DW      geodePmIdleTimeout      ; R/W Idle Timeout
        DW      geodePmS2d              ; R/W Save/Restore Flag
        DW      geodePmBehavior         ; Read Standby/Suspend Behavior
        DW      geodePmExtDflt          ; TEMP until DDC added
;       DW      geodeI2cDdc             ; R/W I2C & DDC Pins
        DW      geodePmExt
geodeInt15TableLength EQU ($ - geodeInt15Table)/2

;**************************************************************************
;*
;*	extendedInt15Handler
;*
;*      Geode-specific INT 15 interface.
;*
;*	Called from xtBiosInt15Interface(). Directs to corresponding INT 15
;*      handler for the Geode-specific VSA function calls.
;*
;*	Entry:
;*	  AX = BF00
;*        BX = 4358 (Geode Identifier)
;*	  CH = Function Number
;*	  CL = Read/Write
;*
;*	Exit:
;*	  CARRY Clear = Success
;*	  CARRY Set = Fail
;*
;*	Destroys:
;*	  None
;*
;**************************************************************************
GeodeInt15Handler PROC NEAR PUBLIC

        cmp     bx, 'CX'                ; Geode Identifier
	jne	SHORT badPmParam

        cmp     ax, 0BF00h              ; Geode VSA routines?
	je	processVsaRoutines

	mov	dx, 1
	jmp	returnDX
	ret

        cmp     ax, 0BF01h              ; Geode Video
	jne	SHORT badPmParam
	

        ;call   Geode_Video_Interface
	jmp	returnDX
	ret

processVsaRoutines::
        cmp     ch, LOW OFFSET geodeInt15TableLength ; Test if within range
	jae	SHORT badPmParam
;
; Parse function number and make the call.
;
	mov	di, cx
	shr	di, 7			; Move function number to place with WORD adjustment
	and	di, 00FEh		; Mask Most Significant Byte for safty
        call    geodeInt15Table[di]     ; Call the corresponding function
	ret

badPmParam::
	stc				; Signify the failure
	ret
GeodeInt15Handler ENDP

;**************************************************************************
;*
;*      geodeMiscConfig
;*
;*	Read Miscellaneous SMI configurations.
;*
;*	Read the miscellaneous configuration bits.
;*	The value of CL=1 is invalid.
;*
;*	Entry:
;*	  CH = 0 (Function 0)
;*
;*	Exit:
;*	  DX[0] = Virtual A20 Enable
;*	    0 - Disabled
;*	    1 - Enabled
;*	  DX[2:1] = L1 Scratchpad Size
;*	    0 - No Scratchpad memory is allocated
;*	    1 - 2KB
;*	    2 - 3KB
;*	    3 - 4KB
;*	  DX[15:3] = Reserved
;*
;*	Destroys:
;*
;**************************************************************************
geodeMiscConfig PROC NEAR
	cmp	cl, 1			; Read or Write operation?
	ja	badPmParam

	mov	dl, 3			; Return 3 KB

scratchSizeFound:
	xor	dh, dh
	shl	dx, 1
	or	dx, 1			; Enable Virtual A20

returnDX::
	mov	[bp].pushall.pushallDx, dx
	mov	[bp].pushall.pushallAx, ax
	clc
	ret
geodeMiscConfig ENDP

;**************************************************************************
;*
;*      geodeVideoConfig
;*
;*	Read Video SMI configurations
;*
;*	Entry:
;*	  CH = 1 (Function 1)
;*
;*	Exit:
;*	  DX[0] = SoftVGA Function Status
;*	    0 - External ISA/PCI video card in use
;*	    1 - On-board VSA video in use
;*	  DX[6:1] = Size of video in 128K units
;*
;*	Destroys:
;*
;**************************************************************************
geodeVideoConfig PROC NEAR

	mov	ax, VID_MEM		; how much video memory
	mov	dx, ax
	shl	dx, 1

	push	ds			; save ds
	push	BDA_SEG
	pop	ds			; set ds to BDA
	mov	al, ds:[BDA_VIDEO_BOARDS_B]
	test	al, 06h			; see if external video card
	jnz	haveextvideo		; yes 
	and	al, 1			; have softvga?
	jz	havenovideo		; no soft either 
	or	dl, 1			; xpressVideo enabled and no ext
haveextvideo:
havenovideo:
	pop	ds			; restore ds

	jmp	returnDX
geodeVideoConfig ENDP

;**************************************************************************
;*
;*      geodeAudioConfig
;*
;*	Read Audio Configurations.
;*
;*	Entry:
;*	  CH = 2 (Function 2)
;*	  CL = 0 - Read
;*	     1 - Write
;*	     2 - Read COMB Data
;*
;*	Exit:
;*	DX - Audio Configurations
;*	  DX[1:0] Audio Device Enable
;*	    0 - Virtual Audio disabled
;*	    3 - SoundBlaster 16			11
;*	  DX[3:2] Audio I/O Base Address
;*	    0 - 220h
;*	    1 - 240h
;*	    2 - 260h				00
;*	    3 - 280h
;*	  DX[5:4] MPU
;*	    0 - Virtual MPU Disabled
;*	    1 - 300h
;*	    2 - 330h				10
;*	    3 - Reserved
;*	  DX[8:6] Audio IRQ
;*	    0 - None
;*	    1 - IRQ9
;*	    2 - IRQ3		; This is not supported under SoundBlaster16
;*	    3 - IRQ5				100
;*	    4 - IRQ7
;*	    5 - IRQ10
;*	    6, 7 - Reserved
;*	  DX[10:9] 8-Bit DMA
;*	    0 - Disabled
;*	    1 - Channel 0			10
;*	    2 - Channel 1
;*	    3 - Channel 3
;*	  DX[12:11] 16-Bit DMA
;*	    0 - Disabled
;*	    1 - Channel 5
;*	    2 - Channel 6
;*	    3 - Channel 7
;*	  DX[15:13] MPU IRQ
;*	    0 - disabled
;*	    1 - IRQ2
;*	    2 - IRQ5
;*	    3 - IRQ7
;*	    4 - IRQ9
;*	    5 - IRQ10
;*	    6, 7 - Reserved
;*
;*	Destroys:
;*
;**************************************************************************
geodeAudioConfig PROC NEAR
	mov	dx, XPAUDIO	; Enabled, Irq 5, Dma 1, Dma 5
	jmp	returnDX

updateCMOSchecksum::
	clc
	ret
geodeAudioConfig ENDP

;**************************************************************************
;*
;*      geodePmConfig
;*
;*	Read/Write PM SMI config bits.
;*
;*	Entry:
;*	  CH = 3 (Function 3)
;*	  CL:  0 = Read PM Configuration
;*	       1 = Write PM Configuration
;*
;*	Exit:
;*	  DX[2:0] = PM State
;*	    0 - Disabled
;*	    1 - Customised Setting
;*	    2 - low
;*	    3 - medium
;*	    4 - high
;*	  DX[3] - external video controller present
;*	  DX[4] - primary hard drive master installed
;*	  DX[5] - primary hard drive slave installed
;*	  DX[6] - secondary hard drive master installed
;*	  DX[7] - secondary hard drive slave installed
;*	  DX[8] - COM1 present
;*	  DX[9] - COM2 present
;*	  DX[10] - COM3 present
;*	  DX[11] - COM4 present
;*	  DX[12] - LPT1 present
;*	  DX[13] - LPT2 present
;*	  DX[14] - reserved
;*	  DX[15] - Save to Disk enabled
;*
;*	Destroys:
;*
;**************************************************************************
PM_OFF			EQU		0
PM_CUSTOM		EQU		1
PM_LOW			EQU		2
PM_MEDIUM		EQU		3
PM_HIGH 		EQU		4
PM_MAX			EQU		PM_HIGH
PM_MODE 		EQU		0000000000000111b
EXT_VIDEO		EQU		0000000000001000b
PRIMARY_HDD_MASTER	EQU		0000000000010000b
PRIMARY_HDD_SLAVE	EQU		0000000000100000b
SECONDARY_HDD_MASTER	EQU		0000000001000000b
SECONDARY_HDD_SLAVE	EQU		0000000010000000b
COM1_PRESENT		EQU		0000000100000000b
COM2_PRESENT		EQU		0000001000000000b
COM3_PRESENT		EQU		0000010000000000b
COM4_PRESENT		EQU		0000100000000000b
LPT1_PRESENT		EQU		0001000000000000b
LPT2_PRESENT		EQU		0010000000000000b
SAVE_TO_DISK		EQU		1000000000000000b

geodePmConfig PROC NEAR
	cmp	cl, 1
	ja	badPmParam
	mov	dx, 00h
	or 	dx, PM_CUSTOM
	or	dx, PRIMARY_HDD_MASTER
pmConfigExit:
	jmp	returnDX

geodePmConfig ENDP

;**************************************************************************
;*
;*      geodePmSuspendTimeout
;*
;*	Read/Write PM supend timeout
;*
;*	Entry:
;*	  CH = 4 (Function 4)
;*	  CL = 0 for Read
;*	       1 for Write
;*
;*	Exit:
;*	  DX = Timeout in minutes, 0 for infinite timeout
;*
;*	Destroys:
;*
;**************************************************************************
geodePmSuspendTimeout PROC NEAR
	cmp	cl, 1
	ja	badPmParam

	mov	dx, SUSPENDSEC
	jmp	returnDX
geodePmSuspendTimeout ENDP

;**************************************************************************
;*
;*      geodePmStandbyTimeout
;*
;*	Read/Write PM Standby timeout
;*
;*	Entry:
;*	  CH = 5 (Function 5)
;*
;*	Exit:
;*	  DX - Timeout 1 second time base
;*	       0 = Infinite Timeout
;*
;*	Destroys:
;*
;**************************************************************************
geodePmStandbyTimeout PROC NEAR
	cmp	cl, 1
	ja	badPmParam

	mov	dx, STANDBYSEC
	jmp	returnDX
geodePmStandbyTimeout ENDP

;**************************************************************************
;*
;*      geodePmHDTimeout
;*
;*	Read/Write PM hard drive timeout
;*
;*	Entry:
;*	  CH = 6 (Function 6)
;*
;*	Exit:
;*	  DX = Timeout in 1 second time base
;*	       0 = infinite timeout
;*
;*	Destroys:
;*
;**************************************************************************
geodePmHDTimeout PROC NEAR
	mov	dx, HDSEC
	jmp	returnDx
geodePmHDTimeout ENDP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -