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

📄 sst020.nvm

📁 award bios 源代码,喜欢汇编程序及想研究主板BIOS程序的人可以参考哦.我是费了老大的劲才找到的哦.
💻 NVM
字号:
;	[]===========================================================[]
;
;	NOTICE: THIS PROGRAM BELONGS TO AWARD SOFTWARE INTERNATIONAL(R)
;	        INC. IT IS CONSIDERED A TRADE SECRET AND IS NOT TO BE
;	        DIVULGED OR USED BY PARTIES WHO HAVE NOT RECEIVED
;	        WRITTEN AUTHORIZATION FROM THE OWNER.
;
; 	[]===========================================================[]
;

;----------------------------------------------------------------------------
;Rev	Date	 Name	Description
;----------------------------------------------------------------------------
;R05	07/02/97 MIL	Fixed Cyrix Gx86 can't Update ESCD successful.
;R04	04/29/97 AVN	Added More Wait For Cyrix Gx86 Updating ESCD Succes.
;R03	01/10/97 AVN	Fixed Garbage Codes.
;R02	12/05/96 AVN	Suppost Both With/out Define ESCD_M2 and Save Code.
;R01	11/14/96 AVN	Fixed Pass for AMIDIAG.EXE PnP BIOS test.
;R00	08/19/96 AVN	Initial Revision.

ifdef	Flash_16K_8K_8K_Unit

;****************************************************************
;*								*
;*	SUBROUTINES TO SUPPORT SST FLASH ROM			*
;*								*
;****************************************************************

WAIT_COUNT	EQU	10

;[]========================================================================[]
; SST020_Flash_Erase :
;
;	Erase Flash ROM at address FA000h - FBFFFh
;
;Saves : None
;Input : None
;
;Output: CF = 0 , Successful
;	 CF = 1 , Error Erase
;
;[]========================================================================[]
SST020_Flash_Erase	Proc	Near
		clc
		ret
SST020_Flash_Erase	Endp

;[]====================================================================[]
; SST020_Flash_Write :
;
;	Program Flash ROM at address FA000h - FBFFFh
;
;Saves :
;Input : Source	= DS : SI
;	 Target	= ES : DI (Range = FA000h-FBFFFh)
;	 Length	= CX
;
;Output: CF = 0 Successful
;	 CF = 1	Error Program
;
;[]====================================================================[]
SST020_Flash_Write	Proc	Near

		push	ax
		push	cx
		push	si
		push	di

;R03		mov	al, 1
;R03		call	Software_Data_Protection

		mov	al, 0
		call	Software_Data_Protection

		mov	ax, cx
		mov	cl, 128
		div	cl

		push	ax

		xor	cx, cx
		mov	cl, al
		jcxz	short Write_Remainder
Block_Loop:
		push	cx
		push	si
		push	di
		mov	cx, 128
@@:
		lodsb
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02
		inc	di
		loop	short @b
		pop	di
		pop	si

		call    SST_Check_Toggle_Ready	;wait for toggle bit to be ready

		pop	cx

		pusha
		mov	cx, 128
@@:
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Get_Flash
;R02 else;	ESCD_M2
;R02 		mov	al,es:[di]
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Get_Flash		; R02
		call	dx				; R02
		cmp	al, ds:[si]
		jne	short @f
		inc	si
		inc	di
		loop	short @b
		cmp	al, al
@@:
		popa
		jne	short Ct_Flash_Write_Fail1

		add	si, 128
		add	di, 128
		loop	short Block_Loop
Write_Remainder:
		pop	ax
		xor	cx, cx
		mov	cl, ah
		jcxz	short Ct_Flash_Write_Exit

		push	cx
		push	si
		push	di
@@:
		lodsb
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02
		inc	di
		loop	short @b
		pop	di
		pop	si

		call    SST_Check_Toggle_Ready	;wait for toggle bit to be ready
		pop	cx

		pusha
@@:
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Get_Flash
;R02 else;	ESCD_M2
;R02 		mov	al,es:[di]
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Get_Flash		; R02
		call	dx				; R02
		cmp	al, ds:[si]
		jne	short @f
		inc	si
		inc	di
		loop	short @b
		cmp	al, al
@@:
		popa
		jne	short Ct_Flash_Write_Fail

Ct_Flash_Write_Exit:
		mov	al, 1
		call	Software_Data_Protection

		pop	di
		pop	si
		pop	cx
		pop	ax
		clc
		ret

Ct_Flash_Write_Fail1:
		pop	ax
Ct_Flash_Write_Fail:
		mov	al, 1
		call	Software_Data_Protection

		pop	di
		pop	si
		pop	cx
		pop	ax
		stc
		ret

SST020_Flash_Write	Endp

;[]====================================================================[]
; Routine Name: Software_Data_Protection                                ;
;									;
; Purpose:      This subroutine will either ENABLE or DISABLE the data  ;
;               protection feature on the SST's 28EE011/28EE010 EEPROM. ;
;               See the specification for more information.             ;
;									;
; inputs:                                                               ;
;	ES:	ESCD segment/selector
;       AL:     1 means ENABLE data protection                          ;
;       AL:     0 means DISABLE data protection                         ;
;									;
; outputs:                                                              ;
;       None                                                            ;
;									;
; IMPORTANT NOTICE:  This version of the software will work with both   ;
; ================   the OLD and NEW versions of the 28EE011/010 chips  ;
;									;
;                    The "NEW" version of the chip will use the         ;
;                    following address to perform the programming:      ;
;                          "5555h" and "2AAAh"                          ;
;									;
;                    The "OLD" version of the chip will use the         ;
;                    following address to perform the programming:      ;
;                          "15555h" and "AAAAh"                         ;
;									;
;                    Since the "15555h" and "AAAAh" addresses will work ;
;                    for both versions of the chip, we have decided to  ;
;                    use it in the program.                             ;
;									;
;[]====================================================================[]

Software_Data_Protection        proc    near

		push    ax
		push    si
		push    di
		push	es

ifndef	VSA_VGA					;R05
ifdef	ESCD_M2					;R01
		push	gs			;R01
		pop	es			;R01
endif;	ESCD_M2					;R01
endif	;VSA_VGA				;R05

		push	ax

		mov     si, 02AAAh		; ds:si = 0AAAA
		mov     di, 5555h               ; es:di = 15555

		mov     al, 0AAh                ; 1st byte [15555] = AAh
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02

		mov     al, 055h                ; 2nd byte [0AAAA] = 55h
		xchg	si, di
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02
		xchg	si, di

		pop	ax

		cmp     al, 0                   ; Disable or Enable data protection?
		je      SDP_Reset               ; if ZERO, means disable

;
; We will trying to ENABLE the data protection on the 28EE011/28EE010 chip
;

		mov     al, 0A0h                ; 3rd byte [15555] = A0h
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02
		jmp     SDP_Done

SDP_Reset:

;
; We will trying to DISABLE the data protection on the 28EE011/28EE010 chip
;

		mov     al, 80h                 ; 3rd byte [15555] = 80h
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02

		mov     al, 0AAh                ; 4th byte [15555] = AAh
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02

		mov     al, 055h                ; 5th byte [0AAAA] = 55h
		xchg	si, di
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02
		xchg	si, di

		mov     al, 20h                 ; 6th byte [15555] = 20h
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Set_Flash
;R02 else;	ESCD_M2
;R02 		mov	es:[di],al
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Set_Flash		; R02
		call	dx				; R02

SDP_Done:
		call    SST_Check_Toggle_Ready	; wait for toggle bit to be ready

		pop     es
		pop     di
		pop     si
		pop     ax
		ret

Software_Data_Protection        endp

;[]====================================================================[]
;[]====================================================================[]

SST_Check_Toggle_Ready	proc    near

		push    ax
		push	bx
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Get_Flash
;R02 else;	ESCD_M2
;R02 		mov	al,es:[di]
;R02 endif;	ESCD_M2
		mov	dx,offset Ct_Get_Flash		; R02
		call	dx				; R02
		and     al, 40h
		mov	bx, WAIT_COUNT
SST_CTR_Tog2:
		mov	ah, al
;R02 		call	SST_PH29EE020_Wait_10ms
;R02 ifndef	ESCD_M2
;R02 		call	Ct_Get_Flash
;R02 else;	ESCD_M2
;R02 		mov	al,es:[di]
;R02 endif;	ESCD_M2
		mov	dx,offset EEPROM_Wait_10ms	; R02
		call	dx				; R02
ifdef	More_Flash_Wait_Time				; R04
		mov	dx,offset EEPROM_Wait_10ms	; R04
		call	dx				; R04
		mov	dx,offset EEPROM_Wait_10ms	; R04
		call	dx				; R04
endif;	More_Flash_Wait_Time				; R04
		mov	dx,offset Ct_Get_Flash		; R02
		call	dx				; R02
		and     al, 40h
		cmp     al, ah
		clc
		je      SST_CTR_Tog3
		dec	bx
		jnz	short SST_CTR_Tog2
		stc
SST_CTR_Tog3:
		pop	bx
		pop     ax
		ret

SST_Check_Toggle_Ready	endp

;R02 SST_PH29EE020_Wait_10ms	proc	near
;R02 		push	bx
;R02 		push	cx
;R02 		xor	bx, bx
;R02 		mov	cx, 350
;R02
;R02 		PUSH	AX			; save ax.
;R02
;R02 		ALIGN	4
;R02 SST_WR_OUTER_LP:
;R02 SST_WR_INNER_LP:
;R02 SST_WR_STATE_0:	IN	AL,SYS1
;R02 		TEST	AL,010H
;R02 		JZ	SHORT SST_WR_STATE_0
;R02
;R02 		ALIGN	4
;R02 SST_WR_STATE_1:	IN	AL,SYS1
;R02 		TEST	AL,010H
;R02 		JNZ	SHORT SST_WR_STATE_1
;R02 		LOOP	SHORT SST_WR_INNER_LP
;R02
;R02 		OR	BX,BX
;R02 		JZ	SHORT SST_WR_EXIT
;R02 		DEC	BX
;R02 		JMP	SHORT SST_WR_OUTER_LP
;R02
;R02 SST_WR_EXIT:	POP	AX			; restore ax
;R02
;R02 		pop	cx
;R02 		pop	bx
;R02 		ret
;R02 SST_PH29EE020_Wait_10ms	endp

endif	;Flash_16K_8K_8K_Unit

⌨️ 快捷键说明

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