;	[]===========================================================[]
;
;	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
;----------------------------------------------------------------------------
;R06	04/09/99 RIC	Add "VIA686HM_CPUFAN1_SHOW"
;			    "VIA686HM_CPUFAN2_SHOW" definition.
;R05	03/31/99 RIC	Add "NO_VIA686HM_VIN1"
;			    "NO_VIA686HM_VIN2"
;			    "NO_VIA686HM_VIN3"
;			    "NO_VIA686HM_VIN4" definition.
;R04	03/18/99 RIC	Add "CPU_Use_Tempsens EQU 1"	  definition.
;			    "CPU_Use_Tempsens EQU 2"
;			    "CPU_Use_Tempsens EQU 3"
;			    "Syetem_Use_Tempsens EQU 1"
;			    "Syetem_Use_Tempsens EQU 2"
;			    "Syetem_Use_Tempsens EQU 3"
;			Default : CPU use Tempsens 1
;				  System use Tempsens 2
;R03	02/24/99 RIC	Fix that CPU Voltage show error in BIOS SETUP
;			when it over 3.0V
;R02	01/02/99 PHI	Move sensor code to XGROUP.  
;			Please use define SENSOR_IN_XGROUP.
;R01	01/22/99 RIC	Enable Hareware Monitor Interrupt.
;R00	11/06/98 RIC	Initialization.



;[]==============================================================[]
;CPU_Use_Tempsens	EQU	1	; mease system use tempsens 1
;CPU_Use_Tempsens	EQU	2	; mease system use tempsens 2
;CPU_Use_Tempsens	EQU	3	; mease system use tempsens 3
;Syetem_Use_Tempsens	EQU	1	; mease system use tempsens 1
;Syetem_Use_Tempsens	EQU	2	; mease system use tempsens 2
;Syetem_Use_Tempsens	EQU	1	; mease system use tempsens 3
;Default : CPU use Tempsens 1
;	  System use Tempsens 2
;[]==============================================================[]


ifdef	COMPILE_FOR_SENSOR_ASM
IF	COMPILE_FOR_SENSOR_ASM EQ 2
ifndef	SENSOR_IN_XGROUP			;R02

;[]==============================================================[]
;Input	: CL - register index
;Output : AL - Value read
;[]==============================================================[]
		public	Get_VIA686HM
Get_VIA686HM	Proc	Near

		pushf
		push	dx

		mov	dx,VIA686HM_Port
		add	dl, cl
		in	al,dx
		newiodelay
		newiodelay

		pop	dx
		popf
		ret
Get_VIA686HM	Endp

;[]==============================================================[]
;Input : CL - register index
;	 AL - Value to write
;Output: none
;[]==============================================================[]
		public	Set_VIA686HM
Set_VIA686HM	Proc	Near

		pushf
		push	dx

		mov	dx,VIA686HM_Port
		add	dl, cl
		out	dx,al
		newiodelay
		newiodelay

		pop	dx
		popf
		ret
Set_VIA686HM	Endp


;***************************************************************************
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;***************************************************************************

;[]==============================================================[]
;[]==============================================================[]

Prg_VIA686HM_Chip	Proc	Near

		mov	cx,10
	Clear_VIA686HM:
		push	cx
		mov	cl,41h
		call	Get_VIA686HM

		mov	cl,42h
		call	Get_VIA686HM
		pop	cx
		loop	short Clear_VIA686HM

 		mov	si,offset EGROUP:Prg_VIA686HM_Tbl
 	Init_Start:
 		mov	cl,cs:[si]
 		mov	al,cs:[si+1]
 		call	Set_VIA686HM
 		add	si,2
 
 		cmp	si,offset EGROUP:Prg_VIA686HM_Tbl_End
 		jne	short Init_Start

Prg_VIA686HM_Chip_End:

ifdef	Case_open_WARNING
		extrn	Get_Cmos:near
		extrn	Set_Cmos:near

		and	OEM_Error_CMOS1[bp], not OEM_Error_CMOS_Bits1

		mov	al,OEM_Error_CMOS1 NMI_OFF
		F000_CALL DGROUP:Get_Cmos
		and	al,NOT OEM_Error_CMOS_Bits1
		mov	ah,al			;set cpu changed flag
		mov	al,OEM_Error_CMOS1 NMI_OFF
		F000_CALL DGROUP:Set_Cmos

		mov	cl,42h
		call	Get_VIA686HM
		out	90h, al
		newiodelay
		newiodelay
		newiodelay
		newiodelay
		newiodelay
		newiodelay
		test	al, 10h
		jz	short	@f
		or	OEM_Error_CMOS1[bp],OEM_Error_CMOS_Bits1
@@:
endif;	Case_open_WARNING
		ret

Prg_VIA686HM_Chip	Endp


ifdef	Case_open_WARNING
ifdef	OEM_Error_Special_Show1
		public	OEM_Error_Special_String1
OEM_Error_Special_String1	db	V_HILITE,'Warning!! Your Computer'
				db	' Case has been opening.'
				db	V_NORMAL,0
endif;	OEM_Error_Special_Show1
endif;	Case_open_WARNING

		assume	ds:EGROUP

		ALIGN	4
		;---------------------
		;      index  	Value
		;---------------------
Prg_VIA686HM_Tbl:
;R01 - starts
		db	43h,	0FFh		; Disable HM INT Monitor
		db	44h,	0FFh		; Disable HM INT Monitor
		db	4Bh,	00Ah		; Set Temp INT is Compare Mode
;R01 - ends
		db	40h,	001h
Prg_VIA686HM_Tbl_End:

endif	;SENSOR_IN_XGROUP			;R02
ENDIF	;COMPILE_FOR_SENSOR_ASM EQ 2
endif	;COMPILE_FOR_SENSOR_ASM



ifdef	COMPILE_FOR_SENSOR_MNU 
;***************************************************************************
;***** Special_Show Special_Show Special_Show Special_Show Special_Show ****
;***** Special_Show Special_Show Special_Show Special_Show Special_Show ****
;***** Special_Show Special_Show Special_Show Special_Show Special_Show ****
;***************************************************************************
IF	COMPILE_FOR_SENSOR_MNU EQ 2
ifdef	CPU_Temp_Selectable						
		dw	offset VIA686HM_Temp_Item, offset Show_Scale	
endif;	CPU_Temp_Selectable			     			
		dw	offset Current_CPU_Temp_Item, offset Show_Current_CPU_Temp
		dw	offset Current_System_Temp_Item, offset Show_Current_System_Temp
ifdef	SHOW_VIA686HM_CPUFAN1
		dw	offset Current_CPUFAN1_Item, offset Show_Current_CPUFAN1
endif;	SHOW_VIA686HM_CPUFAN1
ifdef	SHOW_VIA686HM_CPUFAN2
		dw	offset Current_CPUFAN2_Item, offset Show_Current_CPUFAN2
endif;	SHOW_VIA686HM_CPUFAN2
ifndef	NO_SHOW_Voltage_FOR_VIA686HM					 
ifndef	No_Show_VIA686HM_IN0				
		dw	offset Current_IN0_Item, offset Show_Current_IN0 
endif;	No_Show_VIA686HM_IN0				
ifndef	NO_VIA686HM_VIN1					;R05
		dw	offset Current_IN1_Item, offset Show_Current_IN1 
endif;	NO_VIA686HM_VIN1					;R05
ifndef	NO_VIA686HM_VIN2					;R05
		dw	offset Current_IN2_Item, offset Show_Current_IN2 
endif;	NO_VIA686HM_VIN2					;R05
ifndef	NO_VIA686HM_VIN3					;R05
		dw	offset Current_IN3_Item, offset Show_Current_IN3 
endif;	NO_VIA686HM_VIN3					;R05
ifndef	NO_VIA686HM_VIN4					;R05
		dw	offset Current_IN4_Item, offset Show_Current_IN4 
endif;	NO_VIA686HM_VIN4					;R05
ifndef	NO_VIA686HM_VIN5					
		dw	offset Current_IN5_Item, offset Show_Current_IN5 
endif;	NO_VIA686HM_VIN5					

ifndef	NO_VIA686HM_VIN6					
		dw	offset Current_IN6_Item, offset Show_Current_IN6 
endif;	NO_VIA686HM_VIN6					
endif;	NO_SHOW_Voltage_FOR_VIA686HM					 
ENDIF	;COMPILE_FOR_SENSOR_MNU 

;***************************************************************************
;**** SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU ****
;**** SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU ****
;**** SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU ****
;**** SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU SENSOR.MNU ****
;***************************************************************************
IF	COMPILE_FOR_SENSOR_MNU EQ 1

;ifdef	CPU_Temp_Selectable
;DEFINE_ITEM	VIA686HM_Temp_Item
;DEFINE_MENUITEM	, GROUP_HEALTH, 0, 10
;	menuitem <NOMODBIN+SHOWNUM+DIGIT3,\
;		  offset VIA686HM_Temp_Str,NOCT,00000000b,VIA686HM_CMOS,01111111b,\
;		  offset Nullstr,30,120,Xaxis,Yaxis,120,30,offset Nullstr>
;else;	CPU_Temp_Selectable
;
;  IFNDEF	VIA686HM_SCALE_40_TO_90
;DEFINE_ITEM     VIA686HM_TEMP_ITEM
;DEFINE_MENUITEM	, GROUP_HEALTH, 0, 10
;        menuitem <PMITEM,\
;                  offset VIA686HM_TEMP_Str,NOCT,VIA686HM_CMOS_Bits,VIA686HM_CMOS,VIA686HM_CMOS_Bits,\
;                  offset VIA686HM_TEMP_Val,0,7,Xaxis,Yaxis ,   00000000b, 00000000b,offset Std_Help_Str>
;  ELSE;		VIA686HM_SCALE_40_TO_90
;DEFINE_ITEM     VIA686HM_TEMP_ITEM
;DEFINE_MENUITEM	, GROUP_HEALTH, 0, 10				
;        menuitem <PMITEM,\
;                  offset VIA686HM_TEMP_Str,NOCT,VIA686HM_CMOS_Bits,VIA686HM_CMOS,VIA686HM_CMOS_Bits,\
;                  offset VIA686HM_TEMP_Val,0,11,Xaxis,Yaxis ,   00000000b, 00000000b,offset Std_Help_Str>
;  ENDIF;	VIA686HM_SCALE_40_TO_90
;endif;	CPU_Temp_Selectable

DEFINE_ITEM	Current_CPU_Temp_Item
        menuitem <SHOWONLY,\
                  offset Current_CPU_Temp_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
DEFINE_ITEM	Current_System_Temp_Item
        menuitem <SHOWONLY,\
                  offset Current_System_Temp_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
ifdef	SHOW_VIA686HM_CPUFAN1
DEFINE_ITEM	Current_CPUFAN1_Item
        menuitem <SHOWONLY,\
                  offset Current_CPUFAN1_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
endif;	SHOW_VIA686HM_CPUFAN1
ifdef	SHOW_VIA686HM_CPUFAN2
DEFINE_ITEM	Current_CPUFAN2_Item
        menuitem <SHOWONLY,\
                  offset Current_CPUFAN2_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
endif;	SHOW_VIA686HM_CPUFAN2
ifdef	Show_Chasis_Fan_String
DEFINE_ITEM
        menuitem <SHOWONLY,\
                  offset Chasis_FAN_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>

DEFINE_ITEM
        menuitem <SHOWONLY,\
                  offset Power_FAN_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
endif;	Show_Chasis_Fan_String

ifndef	NO_SHOW_Voltage_FOR_VIA686HM			
ifdef	No_Show_VIA686HM_IN0				
Yaxis	=	Yaxis + 1				
else;	No_Show_VIA686HM_IN0				
DEFINE_ITEM	Current_IN0_Item
        menuitem <SHOWONLY,\
                  offset Current_IN0_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
endif;	No_Show_VIA686HM_IN0				


ifndef	NO_VIA686HM_VIN1					;R05
		public	Current_IN1_Item
Current_IN1_Item label	near
Xaxis = Xaxis + 19						
        menuitem <SHOWONLY,\
                  offset Current_IN1_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
Xaxis = Xaxis - 19						
endif;	NO_VIA686HM_VIN1					;R05

ifndef	NO_VIA686HM_VIN2					;R05
DEFINE_ITEM	Current_IN2_Item
        menuitem <SHOWONLY,\
                  offset Current_IN2_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
endif;	NO_VIA686HM_VIN2					;R05

ifndef	NO_VIA686HM_VIN3					;R05
		public	Current_IN3_Item
Current_IN3_Item label	near
Xaxis = Xaxis + 19						
        menuitem <SHOWONLY,\
                  offset Current_IN3_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
Xaxis = Xaxis - 19						
endif;	NO_VIA686HM_VIN3					;R05

ifndef	NO_VIA686HM_VIN4					;R05
DEFINE_ITEM	Current_IN4_Item
        menuitem <SHOWONLY,\
                  offset Current_IN4_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
endif;	NO_VIA686HM_VIN4					;R05

ifndef NO_VIA686HM_VIN5					
		public	Current_IN5_Item
Current_IN5_Item label	near
Xaxis = Xaxis + 18						
        menuitem <SHOWONLY,\
                  offset Current_IN5_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
Xaxis = Xaxis - 18						
endif	;NO_VIA686HM_VIN5					

ifndef	NO_VIA686HM_VIN6					
DEFINE_ITEM	Current_IN6_Item
        menuitem <SHOWONLY,\
                  offset Current_IN6_Str,NOCT,0,KERNAL_CONTROL,00000001b,\
                  offset NullStr,0,0,Xaxis,Yaxis,0,0,offset Std_Help_Str>
endif;	NO_VIA686HM_VIN6					
endif;	NO_SHOW_Voltage_FOR_VIA686HM			
ENDIF	;COMPILE_FOR_SENSOR_MNU 

;***************************************************************************
;**** SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR ****
;**** SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR ****
;**** SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR ****
;**** SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR SENSOR.STR ****
;***************************************************************************
IF	COMPILE_FOR_SENSOR_MNU EQ 0

;VIA686HM_TEMP_Str           db      'CPU Warning Temperature'
;			db	(COLLON_LOC - ($-(offset VIA686HM_TEMP_Str))) dup (" ")
;ifdef	CPU_Temp_Selectable
;		db	':',0				
;else;	CPU_Temp_Selectable				
;		db	': ',0				
;endif;	CPU_Temp_Selectable				
;
;ifndef	CPU_Temp_Selectable				
;
;  IFNDEF	VIA686HM_SCALE_40_TO_90		 		
;
;    ifndef	VIA686HM_SCALE_60_TO_90
;	IFNDEF	VIA686HM_SCALE_40_TO_70			
;VIA686HM_TEMP_Val           db      'Disabled  ',0
;			db      '50øC/122øF',0
;			db      '53øC/127øF',0
;			db      '56øC/133øF',0
;			db      '60øC/140øF',0
;			db      '63øC/145øF',0
;			db      '66øC/151øF',0
;			db      '70øC/158øF',0
;	ELSE;	VIA686HM_SCALE_40_TO_70			
;VIA686HM_TEMP_Val           db      'Disabled  ',0		
;			db      '40øC/104øF',0		
;			db      '45øC/113øF',0		
;			db      '50øC/122øF',0		
;			db      '55øC/131øF',0		
;			db      '60øC/140øF',0		
;			db      '65øC/149øF',0		
;			db      '70øC/158øF',0		
;	ENDIF;	VIA686HM_SCALE_40_TO_70			
;    else;	VIA686HM_SCALE_60_TO_90					
;VIA686HM_TEMP_Val           db      'Disabled  ',0
;			db      '60øC/140øF',0
;			db      '65øC/149øF',0
;			db      '70øC/158øF',0
;			db      '75øC/167øF',0
;			db      '80øC/176øF',0
;			db      '85øC/185øF',0
;			db      '90øC/194øF',0
;    endif;	VIA686HM_SCALE_60_TO_90
;  ELSE;	VIA686HM_SCALE_40_TO_90		 	      
;VIA686HM_TEMP_Val           db      'Disabled  ',0		
;			db      '40øC/104øF',0		
;			db      '45øC/113øF',0		
;			db      '50øC/122øF',0		
;			db      '55øC/131øF',0		
;			db      '60øC/140øF',0		
;			db      '65øC/149øF',0		
;			db      '70øC/158øF',0		
;			db      '75øC/167øF',0
;			db      '80øC/176øF',0
;			db      '85øC/185øF',0
;			db      '90øC/194øF',0
;  ENDIF;	VIA686HM_SCALE_40_TO_90		 	      
;endif;	CPU_Temp_Selectable				

Current_CPU_Temp_Str	db	'Current CPU Temp.'
			db	(COLLON_LOC - ($-(offset Current_CPU_Temp_Str))) dup (" ")
			db	':',0		
Current_System_Temp_Str	db	'Current System Temp.'
			db	(COLLON_LOC - ($-(offset Current_System_Temp_Str))) dup (" ")
			db	':',0		

ifdef	SHOW_VIA686HM_CPUFAN1
  IFDEF	VIA686HM_CPUFAN1_SHOW				;R06 - starts
Current_CPUFAN1_Str	db	VIA686HM_CPUFAN1_SHOW
			db	(COLLON_LOC - ($-(offset Current_CPUFAN1_Str))) dup (" ")
			db	': ',0
  ELSE;	VIA686HM_CPUFAN1_SHOW				;R06 - ends
Current_CPUFAN1_Str	db	'Current CPUFAN1 Speed'
			db	(COLLON_LOC - ($-(offset Current_CPUFAN1_Str))) dup (" ")
			db	': ',0
  ENDIF;VIA686HM_CPUFAN1_SHOW				;R06
endif;	SHOW_VIA686HM_CPUFAN1
ifdef	SHOW_VIA686HM_CPUFAN2
  IFDEF	VIA686HM_CPUFAN2_SHOW				;R06 - starts
Current_CPUFAN2_Str	db	VIA686HM_CPUFAN2_SHOW
			db	(COLLON_LOC - ($-(offset Current_CPUFAN2_Str))) dup (" ")
			db	': ',0
  ELSE;	VIA686HM_CPUFAN2_SHOW				;R06 - ends
Current_CPUFAN2_Str	db	'Current CPUFAN2 Speed'
			db	(COLLON_LOC - ($-(offset Current_CPUFAN2_Str))) dup (" ")
			db	': ',0
  ENDIF;VIA686HM_CPUFAN2_SHOW				;R06
endif;	SHOW_VIA686HM_CPUFAN2
ifndef	NO_SHOW_Voltage_FOR_VIA686HM			
ifndef	No_Show_VIA686HM_IN0				

Current_IN0_Str		db	'Vcore : ',0		

endif;	No_Show_VIA686HM_IN0				

ifndef	NO_VIA686HM_VIN1			;R05
Current_IN1_Str		db	' 2.5V : ',0		
endif;	NO_VIA686HM_VIN1			;R05
ifndef	NO_VIA686HM_VIN2			;R05
Current_IN2_Str		db	' 3.3V : ',0
endif;	NO_VIA686HM_VIN2			;R05
ifndef	NO_VIA686HM_VIN3			;R05
Current_IN3_Str		db	'   5V : ',0
endif;	NO_VIA686HM_VIN3			;R05
ifndef	NO_VIA686HM_VIN4			;R05
Current_IN4_Str		db	'  12V : ',0
endif;	NO_VIA686HM_VIN4			;R05

ifndef NO_VIA686HM_VIN5
Current_IN5_Str		db	' -12V :-',0
endif	;NO_VIA686HM_VIN5


 ifndef	NO_VIA686HM_VIN6					
Current_IN6_Str		db	'  -5V :-',0		
 endif;	NO_VIA686HM_VIN6					
endif;	NO_SHOW_Voltage_FOR_VIA686HM
;=====================

;ifdef	CPU_Temp_Selectable
;Show_Scale	Proc	Near
;
;		cmp	byte ptr CALLTYPE[bp],POST_CALL
;		jne	short @F
;		Post_Func_Call E000_Show_Scale
;	@@:
;		ret
;Show_Scale	Endp
;endif;	CPU_Temp_Selectable

Show_Current_CPU_Temp	Proc	Near

		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F	
ifdef	CPU_Use_Tempsens				;R04
  IF	CPU_Use_Tempsens	EQ	1		;R04
		mov	cl, 20h				;R04
  ENDIF;CPU_Use_Tempsens	EQ	1		;R04
  IF	CPU_Use_Tempsens	EQ	2		;R04
		mov	cl, 21h				;R04
  ENDIF;CPU_Use_Tempsens	EQ	2		;R04
  IF	CPU_Use_Tempsens	EQ	3		;R04
		mov	cl, 1fh				;R04
  ENDIF;CPU_Use_Tempsens	EQ	3		;R04
else;	CPU_Use_Tempsens				;R04
		mov	cl, 20h			
endif;	CPU_Use_Tempsens				;R04
ifndef	SENSOR_IN_XGROUP					;R02
		Post_Func_Call E000_Show_Current_System_Temp
else	;SENSOR_IN_XGROUP					;R02
		Xcall X_Show_Current_System_Temp		;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_CPU_Temp	Endp

Show_Current_System_Temp	Proc	Near

		cmp	byte ptr CALLTYPE[bp],POST_CALL
		jne	short @F
ifdef	System_Use_Tempsens				;R04
  IF	System_Use_Tempsens	EQ	1		;R04
		mov	cl, 20h				;R04
  ENDIF;System_Use_Tempsens	EQ	1		;R04
  IF	System_Use_Tempsens	EQ	2		;R04
		mov	cl, 21h				;R04
  ENDIF;System_Use_Tempsens	EQ	2		;R04
  IF	System_Use_Tempsens	EQ	3		;R04
		mov	cl, 1fh				;R04
  ENDIF;System_Use_Tempsens	EQ	3		;R04
else;	System_Use_Tempsens				;R04
		mov	cl, 21h
endif;	System_Use_Tempsens				;R04
ifndef	SENSOR_IN_XGROUP					;R02
		Post_Func_Call E000_Show_Current_System_Temp
else	;SENSOR_IN_XGROUP					;R02
		Xcall X_Show_Current_System_Temp		;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:
		ret
Show_Current_System_Temp	Endp

ifdef	SHOW_VIA686HM_CPUFAN1
Show_Current_CPUFAN1	Proc	Near

		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		Post_Func_Call E000_Show_Current_CPUFAN1
else	;SENSOR_IN_XGROUP					;R02
		Xcall X_Show_Current_CPUFAN1			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		
		ret
Show_Current_CPUFAN1	Endp
endif;	SHOW_VIA686HM_CPUFAN1

ifdef	SHOW_VIA686HM_CPUFAN2
Show_Current_CPUFAN2	Proc	Near

		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		Post_Func_Call E000_Show_Current_CPUFAN2
else	;SENSOR_IN_XGROUP					;R02
		Xcall X_Show_Current_CPUFAN2			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		
		ret
Show_Current_CPUFAN2	Endp
endif;	SHOW_VIA686HM_CPUFAN2

ifndef	NO_SHOW_Voltage_FOR_VIA686HM
ifndef	No_Show_VIA686HM_IN0				
Show_Current_IN0	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		post_func_call	E000_Show_Current_IN0	
else	;SENSOR_IN_XGROUP					;R02
		Xcall	X_Show_Current_IN0			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_IN0	Endp
endif;	No_Show_VIA686HM_IN0				

ifndef	NO_VIA686HM_VIN1					;R05
Show_Current_IN1	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		post_func_call	E000_Show_Current_IN1	
else	;SENSOR_IN_XGROUP					;R02
		Xcall	X_Show_Current_IN1			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_IN1	Endp
endif;	NO_VIA686HM_VIN1					;R05

ifndef	NO_VIA686HM_VIN2					;R05
Show_Current_IN2	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		post_func_call	E000_Show_Current_IN2	
else	;SENSOR_IN_XGROUP					;R02
		Xcall	X_Show_Current_IN2			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_IN2	Endp
endif;	NO_VIA686HM_VIN2					;R05

ifndef	NO_VIA686HM_VIN3					;R05
Show_Current_IN3	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		post_func_call	E000_Show_Current_IN3	
else	;SENSOR_IN_XGROUP					;R02
		Xcall	X_Show_Current_IN3			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_IN3	Endp
endif;	NO_VIA686HM_VIN3					;R05

ifndef	NO_VIA686HM_VIN4					;R05
Show_Current_IN4	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		post_func_call	E000_Show_Current_IN4	
else	;SENSOR_IN_XGROUP					;R02
		Xcall	X_Show_Current_IN4			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_IN4	Endp
endif;	NO_VIA686HM_VIN4					;R05

ifndef NO_VIA686HM_VIN5					
Show_Current_IN5	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		post_func_call	E000_Show_Current_IN5	
else	;SENSOR_IN_XGROUP					;R02
	        Xcall	X_Show_Current_IN5			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_IN5	Endp
endif	;NO_VIA686HM_VIN5					

 ifndef	NO_VIA686HM_VIN6					
Show_Current_IN6	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL		
		jne	short @F				
ifndef	SENSOR_IN_XGROUP					;R02
		post_func_call	E000_Show_Current_IN6
else	;SENSOR_IN_XGROUP					;R02
		Xcall	X_Show_Current_IN6			;R02
endif	;SENSOR_IN_XGROUP					;R02
	@@:							
		ret
Show_Current_IN6	Endp
 endif;	NO_VIA686HM_VIN6					
endif;	NO_SHOW_Voltage_FOR_VIA686HM
ENDIF	;COMPILE_FOR_SENSOR_MNU

;***************************************************************************
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;***************************************************************************
IF	COMPILE_FOR_SENSOR_MNU EQ 3
IFNDEF	SENSOR_IN_XGROUP			;R02
ifndef		Vin0_R1
Vin0_R1		equ	0
endif;		Vin0_R1
ifndef		Vin0_R2
Vin0_R2		equ	0
endif;		Vin0_R2

ifndef		Vin1_R1
Vin1_R1		equ	0
endif;		Vin1_R1
ifndef		Vin1_R2
Vin1_R2		equ	0
endif;		Vin1_R2

ifndef		Vin2_R1
Vin2_R1		equ	0
endif;		Vin2_R1
ifndef		Vin2_R2
Vin2_R2		equ	0
endif;		Vin2_R2

ifndef		Vin3_R1
Vin3_R1		equ	68
endif;		Vin3_R1
ifndef		Vin3_R2
Vin3_R2		equ	100
endif;		Vin3_R2

ifndef		Vin4_R1
Vin4_R1		equ	28
endif;		Vin4_R1
ifndef		Vin4_R2
Vin4_R2		equ	10
endif;		Vin4_R2

ifndef		Vin5_R1
Vin5_R1		equ	210
endif;		Vin5_R1
ifndef		Vin5_R2
Vin5_R2		equ	60
endif;		Vin5_R2

ifndef		Vin6_R1
Vin6_R1		equ	91
endif;		Vin6_R1
ifndef		Vin6_R2
Vin6_R2		equ	60
endif;		Vin6_R2
Vin5_Use_Negative_Input	equ	1
Vin6_Use_Negative_Input	equ	1

;ifdef	CPU_Temp_Selectable
;E000_Show_Scale	Proc	Near
;	     	extrn	E_GetItem_Value:near
;		mov	si,offset DGROUP:VIA686HM_TEMP_ITEM
;		Post_func_Call	E_GetItem_Value
;
;		mov	bl, al
;		F000_call	DISP_WORD_INT3		
;		mov	al, 'ø'
;		F000_call	Display_Char		
;		mov	al, 'C'
;		F000_call	Display_Char		
;		mov	al, '/'
;		F000_call	Display_Char		
;
;;øC transed to øF --> C = 5/9*(F-32)
;		mov	al, bl
;		mov	bl,9
;		mul	bl
;		mov	bl,5
;		div	bl
;		add	al,32
;		xor	ah,ah
;		F000_call	DISP_WORD_INT3		
;		mov	al, 'ø'
;		F000_call	Display_Char		
;		mov	al, 'F'
;		F000_call	Display_Char		
;  		sub 	al, -1			;set overflow flag for display error
;		ret
;E000_Show_Scale	Endp
;endif;	CPU_Temp_Selectable

E000_Show_Current_System_Temp	Proc	Near

GREATEST_VALUE		EQU	240
LEAST_VALUE		EQU	12		; 12øC
ZERO_DEGREE_VALUE	EQU	180
GREATEST_DEGREE		EQU	110		; 110øC
							   
		cmp	al, Special_Before
		je	short @F
		call	E000_Get_VIA686HM

		not	al
		cmp	al, GREATEST_VALUE	
		ja	short No_78Temp
		cmp	al, LEAST_VALUE		
		jae	short OK_78Temp
No_78Temp:
		mov	al, ZERO_DEGREE_VALUE
OK_78Temp:

;Translate VIA value of Hardware Monitor to value of VIA686HM
		sub	al, LEAST_VALUE		
		mov	si, offset Temp_Tbl
		xor	ah, ah
		add	si, ax
		mov	bl, cs:[si]

;Translate Negative degree of Temperature
		push	bx
		mov	al, ' '
		cmp	bl, GREATEST_DEGREE
		jbe	Positive_Deg
		mov	al, '-'
		neg	bl
Positive_Deg:
		call	E000_Display_Char

		mov	al, bl
		pop	bx

		call	E000_DISP_Byte_INT2
		mov	al, 'ø'
		call	E000_Display_Char
		mov	al, 'C'
		call	E000_Display_Char
		mov	al, '/'
		call	E000_Display_Char

;øC transed to øF --> C = 5/9*(F-32)
		movsx	ax, bl
		mov	bx, 9
		imul	bx
		mov	bx, 5
		idiv	bx
		add	ax, 32

		mov	bx, ax
		cmp	bx, 8000h		;Compare MSB
		jb	Positive_Deg3
		mov	al, '-'
		call	E000_Display_Char
Positive_Deg3:

		mov	ax, bx
		cmp	ax, 8000h		;Compare MSB
		jb	Positive_Deg4
		neg	ax
Positive_Deg4:
		
		call	E000_DISP_WORD_INT3
		mov	al, 'ø'
		call	E000_Display_Char
		mov	al, 'F'
		call	E000_Display_Char
	@@:
		ret


;This table mapping VIA temperature values of Hardware Monitor to temperature
;of VIA686HM.
		ALIGN   4

Temp_Tbl:
	db	110,109,107,105,103,101, 99, 97, 96	;Map to VIA's  12~ 20
	db	 94, 92, 91, 89, 88, 86, 85, 84, 83, 81	;Map to VIA's  21~ 30
	db	 80, 79, 78, 77, 76, 75, 74, 73, 72, 71	;Map to VIA's  31~ 40
	db	 70, 69, 68, 67, 66, 66, 65, 64, 63, 62	;Map to VIA's  41~ 50
	db	 62, 61, 60, 59, 59, 58, 57, 57, 56, 55	;Map to VIA's  51~ 60
	db	 55, 54, 53, 53, 52, 52, 51, 51, 50, 49	;Map to VIA's  61~ 70
	db	 49, 48, 48, 47, 46, 46, 45, 45, 44, 44	;Map to VIA's  71~ 80
	db	 43, 43, 42, 42, 41, 41, 40, 40, 39, 39	;Map to VIA's  81~ 90
	db	 38, 38, 37, 37, 36, 36, 35, 35, 35, 34	;Map to VIA's  91~100
	db	 34, 33, 33, 32, 32, 31, 31, 30, 30, 30	;Map to VIA's 101~110
	db	 29, 29, 28, 28, 27, 27, 27, 26, 26, 26	;Map to VIA's 111~120
	db	 25, 25, 24, 24, 23, 23, 22, 22, 22, 21	;Map to VIA's 121~130
	db	 21, 21, 20, 20, 19, 19, 18, 18, 17, 17	;Map to VIA's 131~140
	db	 16, 16, 16, 15, 15, 14, 14, 13, 13, 13	;Map to VIA's 141~150
	db	 12, 12, 12, 11, 11, 10, 10,  9,  9,  9	;Map to VIA's 151~160
	db	  8,  8,  7,  7,  6,  6,  5,  5,  5,  4	;Map to VIA's 161~170
	db	  4,  4,  3,  3,  3,  1,  1,  1,  0,  0	;Map to VIA's 171~180
	db	 -1, -1, -2, -2, -3, -3, -4, -4, -5, -5	;Map to VIA's 181~190
	db	 -6, -6, -7, -7, -8, -8, -9, -9,-10,-11	;Map to VIA's 191~200
	db	-11,-12,-12,-13,-14,-14,-15,-15,-16,-17	;Map to VIA's 201~210
	db	-17,-18,-19,-20,-20,-21,-22,-23,-24,-24	;Map to VIA's 211~220
	db	-25,-26,-27,-28,-29,-30,-31,-32,-33,-34	;Map to VIA's 221~230
	db	-35,-37,-38,-39,-41,-43,-45,-47,-49,-50	;Map to VIA's 231~240

E000_Show_Current_System_Temp	Endp

ifdef	SHOW_VIA686HM_CPUFAN1
E000_Show_Current_CPUFAN1	Proc	Near
;------------------------------------------------------
;	       		clock
;	Count  = --------------------
;	       	 (RPM * Divisor) / 60
;
;	= (clock * 60) / (RPM * Divisor)
;
;	RPM = (clock * 60) / Divisor / Count
;
;	Clock = 32768 * 2 / 3
;	(32768 * 2 / 3) * 60 = 1310720
;-------------------------------------------------------

		cmp	al, Special_Before
		je	short @F
		mov	cl,29h			
		call	E000_Get_VIA686HM
		cmp	al,0ffh
		jne	short CPUFAN_WORKING1
		xor	ax,ax
		jmp	short SHOW_FAN1
	CPUFAN_WORKING1:

		cmp	al, 0
		je	short SHOW_FAN1

		xor	bh,bh
		mov	bl,al
ifndef	FAN_Divisor				
     		mov	ax,0000h		; 0a4cb8h=(1310720/2)
		mov	dx,0ah			; Count=(1310720/(RPM*2))


else;
	if	FAN_Divisor 	eq	4
     		mov	ax,0000h		; 0a4cb8h=(1310720/4)
		mov	dx,05h			; Count=(1310720/(RPM*4))

	endif;	FAN_Divisor 	eq	4
	if	FAN_Divisor 	eq	8
     		mov	ax,8000h		; 0a4cb8h=(1310720/8)
		mov	dx,02h			; Count=(1310720/(RPM*8))

	endif;	FAN_Divisor 	eq	8
endif;	FAN_Divisor
		div	bx
   	SHOW_FAN1:
		call	E000_DISP_WORD_INT4
		mov	al, ' '
		call	E000_Display_Char
		mov	al, 'R'
		call	E000_Display_Char
		mov	al, 'P'
		call	E000_Display_Char
		mov	al, 'M'
		call	E000_Display_Char
	@@:
		ret
E000_Show_Current_CPUFAN1	endp

endif;	SHOW_VIA686HM_CPUFAN1
ifdef	SHOW_VIA686HM_CPUFAN2

E000_Show_Current_CPUFAN2	Proc	Near
;------------------------------------------------------
;	       		clock
;	Count  = --------------------
;	       	 (RPM * Divisor) / 60
;
;	= (clock * 60) / (RPM * Divisor)
;
;	RPM = (clock * 60) / Divisor / Count
;
;	Clock = 32768 * 2 / 3
;	(32768 * 2 / 3) * 60 = 1310720
;-------------------------------------------------------

		cmp	al, Special_Before
		je	short @F
		mov	cl,2ah				
		call	E000_Get_VIA686HM
		cmp	al,0ffh
		jne	short CPUFAN_WORKING2
		xor	ax,ax
		jmp	short SHOW_FAN2
	CPUFAN_WORKING2:
		cmp	al, 0
		je	short SHOW_FAN2

		xor	bh,bh
		mov	bl,al
ifndef	FAN_Divisor				
     		mov	ax,0000h		; 0a4cb8h=(1310720/2)
		mov	dx,0ah			; Count=(1310720/(RPM*2))

else;
	if	FAN_Divisor 	eq	4
     		mov	ax,0000h		; 0a4cb8h=(1310720/4)
		mov	dx,05h			; Count=(1310720/(RPM*4))
	endif;	FAN_Divisor 	eq	4

	if	FAN_Divisor 	eq	8
     		mov	ax,8000h		; 0a4cb8h=(1310720/8)
		mov	dx,02h			; Count=(1310720/(RPM*8))
	endif;	FAN_Divisor 	eq	8

endif;	FAN_Divisor
		div	bx
   	SHOW_FAN2:
		call	E000_DISP_WORD_INT4
		mov	al, ' '
		call	E000_Display_Char
		mov	al, 'R'
		call	E000_Display_Char
		mov	al, 'P'
		call	E000_Display_Char
		mov	al, 'M'
		call	E000_Display_Char
	@@:
		ret
 
E000_Show_Current_CPUFAN2	endp

endif;	SHOW_VIA686HM_CPUFAN2

ifndef	NO_SHOW_Voltage_FOR_VIA686HM
Display_Vin	Proc	Near
;=========================================
;Entry : AL = Reading Value
;	 BX = R2
;	 DX = R1 + R2
;EXIT : NONE
;=========================================
;------------------------------------------------------------
;	Value = [Voltage * R2 / (R1+R2)] * 105.12 - 5.32
;	Voltage = [(Value + 5.32) * (R1+R2) / R2] / 105.12
;		= [(Value*25 + 133) * (R1+R2) / R2] / 2628
;------------------------------------------------------------

		cmp	al,0ffh			
		jne	short Vin_WORKING	
		xor	ax,ax			
	Vin_WORKING:				


		push	bx
		push	dx
		xor	ah,ah

;R03		mov	bl, 25			;Value * 25
;R03		mul	bl			;ax = al * bl
;R03 - starts
                cmp     al, 40h
                ja      Under_Range
                mov     ah, 1
Under_Range:
                mov     bx, 25                  ;Value * 25
                mul     bx                      ;ax = ax * bx
;R03 - ends
		add	ax, 133			;Value * 25 + 133 
		pop	bx			;(R1+R2)
		mul	bx			;(Value*25+133) * (R1+R2)
		pop	bx			;R2
		div	bx			;[(Value*25+133) * (R1+R2) / R2]
		xor	dx, dx
		mov	bx, 2628
		div	bx			;[(Value*25+133) * (R1+R2) / R2] / 2628


		push	dx			;push remainder to stack


		call	E000_DISP_Byte_INT2

		mov	al, '.'
		call	E000_Display_Char

		pop	ax			;pop remainder

		mov	bx, 100
		mul	bx
		mov	bx, 2628
		div	bx		

		cmp	al,9
		jbe	short Below_9B
		call	E000_DISP_Byte_INT2
		jmp	short Above_9B
	Below_9B:
		call	E000_DISP_Byte_HEX2
	Above_9B:

		mov	al, ' '
		call	E000_Display_Char
		mov	al, 'V'
		call	E000_Display_Char

		ret	

Display_Vin	endp

ifndef	No_Show_VIA686HM_IN0				
E000_Show_Current_IN0	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,22h			
		call	E000_Get_VIA686HM

ifdef	Vin0_Use_Negative_Input
		mov	dx,Vin0_R1
else;	Vin0_Use_Negative_Input
		mov	dx,(Vin0_R1+Vin0_R2)
endif;	Vin0_Use_Negative_Input
		mov	bx,Vin0_R2

		call	Display_Vin
	@@:
		ret

E000_Show_Current_IN0	endp
endif;	No_Show_VIA686HM_IN0				


ifndef	NO_VIA686HM_VIN1					;R05
E000_Show_Current_IN1	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,23h			; IN1
		call	E000_Get_VIA686HM

ifdef	Vin1_Use_Negative_Input
		mov	dx,Vin1_R1
else;	Vin1_Use_Negative_Input
		mov	dx,(Vin1_R1+Vin1_R2)
endif;	Vin1_Use_Negative_Input
		mov	bx,Vin1_R2

		call	Display_Vin
	@@:
		ret

E000_Show_Current_IN1	endp
endif;	NO_VIA686HM_VIN1					;R05

ifndef	NO_VIA686HM_VIN2					;R05
E000_Show_Current_IN2	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,24h			; IN2
		call	E000_Get_VIA686HM

ifdef	Vin2_Use_Negative_Input
		mov	dx,Vin2_R1
else;	Vin2_Use_Negative_Input
		mov	dx,(Vin2_R1+Vin2_R2)
endif;	Vin2_Use_Negative_Input
		mov	bx,Vin2_R2

		call	Display_Vin
	@@:
		ret

E000_Show_Current_IN2	endp
endif;	NO_VIA686HM_VIN2					;R05

ifndef	NO_VIA686HM_VIN3					;R05
E000_Show_Current_IN3	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,25h			; IN3
		call	E000_Get_VIA686HM

ifdef	Vin3_Use_Negative_Input
		mov	dx,Vin3_R1
else;	Vin3_Use_Negative_Input
		mov	dx,(Vin3_R1+Vin3_R2)
endif;	Vin3_Use_Negative_Input
		mov	bx,Vin3_R2

		call	Display_Vin
	@@:
		ret

E000_Show_Current_IN3	endp
endif;	NO_VIA686HM_VIN3					;R05

ifndef	NO_VIA686HM_VIN4					;R05
E000_Show_Current_IN4	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,26h			; IN4
		call	E000_Get_VIA686HM

ifdef	Vin4_Use_Negative_Input
		mov	dx,Vin4_R1
else;	Vin4_Use_Negative_Input
		mov	dx,(Vin4_R1+Vin4_R2)
endif;	Vin4_Use_Negative_Input
		mov	bx,Vin4_R2

		call	Display_Vin
	@@:
		ret

E000_Show_Current_IN4	endp
endif;	NO_VIA686HM_VIN4					;R05

ifndef NO_VIA686HM_VIN5					
E000_Show_Current_IN5	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,27h			; IN5
		call	E000_Get_VIA686HM

ifdef	Vin5_Use_Negative_Input
		mov	dx,Vin5_R1
else;	Vin5_Use_Negative_Input
		mov	dx,(Vin5_R1+Vin5_R2)
endif;	Vin5_Use_Negative_Input
		mov	bx,Vin5_R2

		call	Display_Vin
	@@:
		ret

E000_Show_Current_IN5	endp
endif	;NO_VIA686HM_VIN5					

 ifndef	NO_VIA686HM_VIN6					
E000_Show_Current_IN6	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,28h			; IN6
		call	E000_Get_VIA686HM

ifdef	Vin6_Use_Negative_Input
		mov	dx,Vin6_R1
else;	Vin6_Use_Negative_Input
		mov	dx,(Vin6_R1+Vin6_R2)
endif;	Vin6_Use_Negative_Input
		mov	bx,Vin6_R2

		call	Display_Vin
	@@:
		ret

E000_Show_Current_IN6	endp
 endif;	NO_VIA686HM_VIN6					
endif;	NO_SHOW_Voltage_FOR_VIA686HM

E000_DISP_WORD_INT4	proc	near
		F000_call	DISP_WORD_INT4
		ret
E000_DISP_WORD_INT4	endp

E000_DISP_WORD_INT3	proc	near
		F000_call	DISP_WORD_INT3
		ret
E000_DISP_WORD_INT3	endp

E000_DISP_BYTE_INT2	proc	near
		F000_call	DISP_BYTE_INT2
		ret
E000_DISP_BYTE_INT2	endp

E000_DISP_BYTE_HEX2	proc	near
		F000_call	DISP_BYTE_HEX2
		ret
E000_DISP_BYTE_HEX2	endp

E000_Get_VIA686HM	proc	near
		call	Get_VIA686HM
		ret
E000_Get_VIA686HM	endp

E000_Display_Char	proc	near
		F000_call	Display_Char
		ret
E000_Display_Char	endp

ifndef	BIOS60							
		Public	Update_VIA686HM_Screen
Update_VIA686HM_Screen	Proc	near

		pusha

ifdef	Update_Sensor_in_CPUFEAT				
		cmp	byte ptr CUR_PAGE[bp], PAGE_CPU
else;	Update_Sensor_in_CPUFEAT
ifdef	Update_Sensor_in_IOFEAT					
		cmp	byte ptr CUR_PAGE[bp], PAGE_IO		
else;	Update_Sensor_in_IOFEAT					
		cmp	byte ptr CUR_PAGE[bp], PAGE_CFEATURE
endif;	Update_Sensor_in_IOFEAT					
endif;	Update_Sensor_in_CPUFEAT				
		jne	short Update_VIA686HM_end

	;----------------------------------------
		mov	si, offset VIA686HM_Item_List

	Update_VIA686HM_Start:

		mov	bx, cs:[si]
		cmp	bx, -1
		je	short Update_VIA686HM_end
		push	si
		F000_call	Display_Whole_Item
		pop	si
		inc	si
		inc	si
		jmp	short Update_VIA686HM_Start
	;----------------------------------------

	Update_VIA686HM_end:

		popa
		ret

Update_VIA686HM_Screen	Endp
endif	;BIOS60							

ifdef	BIOS60							
	db	'$SpeRT'					
endif	;BIOS60							

VIA686HM_Item_List	Label	Word

ifdef	BIOS60							
	dw	VIA686HM_Runtime_No				
endif	;BIOS60							

	dw	offset Current_CPU_Temp_Item			
	dw	offset Current_System_Temp_Item
ifdef	SHOW_VIA686HM_CPUFAN1
	dw	offset Current_CPUFAN1_Item
endif;	SHOW_VIA686HM_CPUFAN1
ifdef	SHOW_VIA686HM_CPUFAN2
	dw	offset Current_CPUFAN2_Item
endif;	SHOW_VIA686HM_CPUFAN2
ifndef	NO_SHOW_Voltage_FOR_VIA686HM
ifndef	No_Show_VIA686HM_IN0				
	dw	offset Current_IN0_Item
endif;	No_Show_VIA686HM_IN0				
ifndef	NO_VIA686HM_VIN1					;R05
	dw	offset Current_IN1_Item
endif;	NO_VIA686HM_VIN1					;R05
ifndef	NO_VIA686HM_VIN2					;R05
	dw	offset Current_IN2_Item
endif;	NO_VIA686HM_VIN2					;R05
ifndef	NO_VIA686HM_VIN3					;R05
	dw	offset Current_IN3_Item
endif;	NO_VIA686HM_VIN3					;R05
ifndef	NO_VIA686HM_VIN4					;R05
	dw	offset Current_IN4_Item
endif;	NO_VIA686HM_VIN4					;R05
ifndef NO_VIA686HM_VIN5					
	dw	offset Current_IN5_Item
endif	;NO_VIA686HM_VIN5					

 ifndef	NO_VIA686HM_VIN6					
	dw	offset Current_IN6_Item
 endif;	NO_VIA686HM_VIN6					
endif	;NO_SHOW_Voltage_FOR_VIA686HM

VIA686HM_Runtime_No	EQU	(($ - offset VIA686HM_Item_List)-2)/2

	dw	-1

endif	;SENSOR_IN_XGROUP			;R02
ENDIF	;COMPILE_FOR_SENSOR_MNU
endif	;COMPILE_FOR_SENSOR_MNU 


;R02 - start
;==================================================================
;======================== SENSOR IN XGROUP ========================
;======================== SENSOR IN XGROUP ========================
;======================== SENSOR IN XGROUP ========================
;======================== SENSOR IN XGROUP ========================
;==================================================================

ifdef	COMPILE_FOR_SENSOR_ASM
IF	COMPILE_FOR_SENSOR_ASM EQ 2
ifdef	SENSOR_IN_XGROUP			

;[]==============================================================[]
;Input	: CL - register index
;Output : AL - Value read
;[]==============================================================[]
		public	X_Get_VIA686HM
X_Get_VIA686HM	Proc	Near

		pushf
		push	dx

		mov	dx,VIA686HM_Port
		add	dl, cl
		in	al,dx
		newiodelay
		newiodelay

		pop	dx
		popf
		ret
X_Get_VIA686HM	Endp

;[]==============================================================[]
;Input : CL - register index
;	 AL - Value to write
;Output: none
;[]==============================================================[]
		public	X_Set_VIA686HM
X_Set_VIA686HM	Proc	Near

		pushf
		push	dx

		mov	dx,VIA686HM_Port
		add	dl, cl
		out	dx,al
		newiodelay
		newiodelay

		pop	dx
		popf
		ret
X_Set_VIA686HM	Endp


;***************************************************************************
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;**** SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM SENSOR.ASM ****
;***************************************************************************

;[]==============================================================[]
;[]==============================================================[]

X_Prg_VIA686HM_Chip	Proc	far

		mov	cx,10
	Clear_VIA686HM:
		push	cx
		mov	cl,41h
		call	X_Get_VIA686HM

		mov	cl,42h
		call	X_Get_VIA686HM
		pop	cx
		loop	short Clear_VIA686HM

 		mov	si,offset XGROUP:Prg_VIA686HM_Tbl
 	Init_Start:
 		mov	cl,cs:[si]
 		mov	al,cs:[si+1]
 		call	X_Set_VIA686HM
 		add	si,2
 
 		cmp	si,offset XGROUP:Prg_VIA686HM_Tbl_End
 		jne	short Init_Start

Prg_VIA686HM_Chip_End:

ifdef	Case_open_WARNING
		extrn	fproc_Get_Cmos:far
		extrn	fproc_Set_Cmos:far

		and	OEM_Error_CMOS1[bp], not OEM_Error_CMOS_Bits1

		mov	al,OEM_Error_CMOS1 NMI_OFF
		call far ptr DGROUP:fproc_Get_Cmos
		and	al,NOT OEM_Error_CMOS_Bits1
		mov	ah,al			;set cpu changed flag
		mov	al,OEM_Error_CMOS1 NMI_OFF
		call far ptr DGROUP:fproc_Set_Cmos

		mov	cl,42h
		call	X_Get_VIA686HM
		out	90h, al
		newiodelay
		newiodelay
		newiodelay
		newiodelay
		newiodelay
		newiodelay
		test	al, 10h
		jz	short	@f
		or	OEM_Error_CMOS1[bp],OEM_Error_CMOS_Bits1
@@:
endif;	Case_open_WARNING
		retf

X_Prg_VIA686HM_Chip	Endp


ifdef	Case_open_WARNING
ifdef	OEM_Error_Special_Show1
		public	OEM_Error_Special_String1
OEM_Error_Special_String1	db	V_HILITE,'Warning!! Your Computer'
				db	' Case has been opening.'
				db	V_NORMAL,0
endif;	OEM_Error_Special_Show1
endif;	Case_open_WARNING

		assume	ds:XGROUP

		ALIGN	4
		;---------------------
		;      index  	Value
		;---------------------
Prg_VIA686HM_Tbl:
		db	43h,	0FFh		; Disable HM INT Monitor
		db	44h,	0FFh		; Disable HM INT Monitor
		db	4Bh,	00Ah		; Set Temp INT is Compare Mode
		db	40h,	001h
Prg_VIA686HM_Tbl_End:

endif	;SENSOR_IN_XGROUP			
ENDIF	;COMPILE_FOR_SENSOR_ASM EQ 2
endif	;COMPILE_FOR_SENSOR_ASM

;***************************************************************************
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;**** SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  SENSOR.E8  ****
;***************************************************************************
IFDEF	COMPILE_FOR_SENSOR_MNU 
IF	COMPILE_FOR_SENSOR_MNU EQ 3
ifdef	SENSOR_IN_XGROUP			

ifndef		Vin0_R1
Vin0_R1		equ	0
endif;		Vin0_R1
ifndef		Vin0_R2
Vin0_R2		equ	0
endif;		Vin0_R2

ifndef		Vin1_R1
Vin1_R1		equ	0
endif;		Vin1_R1
ifndef		Vin1_R2
Vin1_R2		equ	0
endif;		Vin1_R2

ifndef		Vin2_R1
Vin2_R1		equ	0
endif;		Vin2_R1
ifndef		Vin2_R2
Vin2_R2		equ	0
endif;		Vin2_R2

ifndef		Vin3_R1
Vin3_R1		equ	68
endif;		Vin3_R1
ifndef		Vin3_R2
Vin3_R2		equ	100
endif;		Vin3_R2

ifndef		Vin4_R1
Vin4_R1		equ	28
endif;		Vin4_R1
ifndef		Vin4_R2
Vin4_R2		equ	10
endif;		Vin4_R2

ifndef		Vin5_R1
Vin5_R1		equ	210
endif;		Vin5_R1
ifndef		Vin5_R2
Vin5_R2		equ	60
endif;		Vin5_R2

ifndef		Vin6_R1
Vin6_R1		equ	91
endif;		Vin6_R1
ifndef		Vin6_R2
Vin6_R2		equ	60
endif;		Vin6_R2
Vin5_Use_Negative_Input	equ	1
Vin6_Use_Negative_Input	equ	1


X_Show_Current_System_Temp	Proc	Near

GREATEST_VALUE		EQU	240
LEAST_VALUE		EQU	12		; 12øC
ZERO_DEGREE_VALUE	EQU	180
GREATEST_DEGREE		EQU	110		; 110øC
							   
		cmp	al, Special_Before
		je	short @F
		call	X_Get_VIA686HM

		not	al
		cmp	al, GREATEST_VALUE	
		ja	short No_78Temp
		cmp	al, LEAST_VALUE		
		jae	short OK_78Temp
No_78Temp:
		mov	al, ZERO_DEGREE_VALUE
OK_78Temp:

;Translate VIA value of Hardware Monitor to value of VIA686HM
		sub	al, LEAST_VALUE		
		mov	si, offset Temp_Tbl
		xor	ah, ah
		add	si, ax
		mov	bl, cs:[si]

;Translate Negative degree of Temperature
		push	bx
		mov	al, ' '
		cmp	bl, GREATEST_DEGREE
		jbe	Positive_Deg
		mov	al, '-'
		neg	bl
Positive_Deg:
		call	X_Display_Char

		mov	al, bl
		pop	bx
		call far ptr	DGROUP:fproc_DISP_Byte_INT2
		mov	al, 'ø'
		call	X_Display_Char
		mov	al, 'C'
		call	X_Display_Char
		mov	al, '/'
		call	X_Display_Char

;øC transed to øF --> C = 5/9*(F-32)
		movsx	ax, bl
		mov	bx, 9
		imul	bx
		mov	bx, 5
		idiv	bx
		add	ax, 32

		mov	bx, ax
		cmp	bx, 8000h		;Compare MSB
		jb	Positive_Deg3
		mov	al, '-'
		call	X_Display_Char
Positive_Deg3:

		mov	ax, bx
		cmp	ax, 8000h		;Compare MSB
		jb	Positive_Deg4
		neg	ax
Positive_Deg4:
		
		call far ptr	DGROUP:fproc_DISP_WORD_INT3
		mov	al, 'ø'
		call	X_Display_Char	
		mov	al, 'F'
		call	X_Display_Char	
	@@:
		ret


;This table mapping VIA temperature values of Hardware Monitor to temperature
;of VIA686HM.
		ALIGN   4

Temp_Tbl:
	db	110,109,107,105,103,101, 99, 97, 96	;Map to VIA's  12~ 20
	db	 94, 92, 91, 89, 88, 86, 85, 84, 83, 81	;Map to VIA's  21~ 30
	db	 80, 79, 78, 77, 76, 75, 74, 73, 72, 71	;Map to VIA's  31~ 40
	db	 70, 69, 68, 67, 66, 66, 65, 64, 63, 62	;Map to VIA's  41~ 50
	db	 62, 61, 60, 59, 59, 58, 57, 57, 56, 55	;Map to VIA's  51~ 60
	db	 55, 54, 53, 53, 52, 52, 51, 51, 50, 49	;Map to VIA's  61~ 70
	db	 49, 48, 48, 47, 46, 46, 45, 45, 44, 44	;Map to VIA's  71~ 80
	db	 43, 43, 42, 42, 41, 41, 40, 40, 39, 39	;Map to VIA's  81~ 90
	db	 38, 38, 37, 37, 36, 36, 35, 35, 35, 34	;Map to VIA's  91~100
	db	 34, 33, 33, 32, 32, 31, 31, 30, 30, 30	;Map to VIA's 101~110
	db	 29, 29, 28, 28, 27, 27, 27, 26, 26, 26	;Map to VIA's 111~120
	db	 25, 25, 24, 24, 23, 23, 22, 22, 22, 21	;Map to VIA's 121~130
	db	 21, 21, 20, 20, 19, 19, 18, 18, 17, 17	;Map to VIA's 131~140
	db	 16, 16, 16, 15, 15, 14, 14, 13, 13, 13	;Map to VIA's 141~150
	db	 12, 12, 12, 11, 11, 10, 10,  9,  9,  9	;Map to VIA's 151~160
	db	  8,  8,  7,  7,  6,  6,  5,  5,  5,  4	;Map to VIA's 161~170
	db	  4,  4,  3,  3,  3,  1,  1,  1,  0,  0	;Map to VIA's 171~180
	db	 -1, -1, -2, -2, -3, -3, -4, -4, -5, -5	;Map to VIA's 181~190
	db	 -6, -6, -7, -7, -8, -8, -9, -9,-10,-11	;Map to VIA's 191~200
	db	-11,-12,-12,-13,-14,-14,-15,-15,-16,-17	;Map to VIA's 201~210
	db	-17,-18,-19,-20,-20,-21,-22,-23,-24,-24	;Map to VIA's 211~220
	db	-25,-26,-27,-28,-29,-30,-31,-32,-33,-34	;Map to VIA's 221~230
	db	-35,-37,-38,-39,-41,-43,-45,-47,-49,-50	;Map to VIA's 231~240

X_Show_Current_System_Temp	Endp

ifdef	SHOW_VIA686HM_CPUFAN1
X_Show_Current_CPUFAN1	Proc	Near
;------------------------------------------------------
;	       		clock
;	Count  = --------------------
;	       	 (RPM * Divisor) / 60
;
;	= (clock * 60) / (RPM * Divisor)
;
;	RPM = (clock * 60) / Divisor / Count
;
;	Clock = 32768 * 2 / 3
;	(32768 * 2 / 3) * 60 = 1310720
;-------------------------------------------------------

		cmp	al, Special_Before
		je	short @F
		mov	cl,29h			
		call	X_Get_VIA686HM
		cmp	al,0ffh
		jne	short CPUFAN_WORKING1
		xor	ax,ax
		jmp	short SHOW_FAN1
	CPUFAN_WORKING1:

		cmp	al, 0
		je	short SHOW_FAN1

		xor	bh,bh
		mov	bl,al
ifndef	FAN_Divisor				
     		mov	ax,0000h		; 0a4cb8h=(1310720/2)
		mov	dx,0ah			; Count=(1310720/(RPM*2))


else;
	if	FAN_Divisor 	eq	4
     		mov	ax,0000h		; 0a4cb8h=(1310720/4)
		mov	dx,05h			; Count=(1310720/(RPM*4))

	endif;	FAN_Divisor 	eq	4
	if	FAN_Divisor 	eq	8
     		mov	ax,8000h		; 0a4cb8h=(1310720/8)
		mov	dx,02h			; Count=(1310720/(RPM*8))

	endif;	FAN_Divisor 	eq	8
endif;	FAN_Divisor
		div	bx
   	SHOW_FAN1:
		call far ptr	DGROUP:fproc_DISP_WORD_INT4
		mov	al, ' '
		call	X_Display_Char
		mov	al, 'R'
		call	X_Display_Char
		mov	al, 'P'
		call	X_Display_Char
		mov	al, 'M'
		call	X_Display_Char
	@@:
		ret
X_Show_Current_CPUFAN1	endp

endif;	SHOW_VIA686HM_CPUFAN1
ifdef	SHOW_VIA686HM_CPUFAN2

X_Show_Current_CPUFAN2	Proc	Near
;------------------------------------------------------
;	       		clock
;	Count  = --------------------
;	       	 (RPM * Divisor) / 60
;
;	= (clock * 60) / (RPM * Divisor)
;
;	RPM = (clock * 60) / Divisor / Count
;
;	Clock = 32768 * 2 / 3
;	(32768 * 2 / 3) * 60 = 1310720
;-------------------------------------------------------

		cmp	al, Special_Before
		je	short @F
		mov	cl,2ah				
		call	X_Get_VIA686HM
		cmp	al,0ffh
		jne	short CPUFAN_WORKING2
		xor	ax,ax
		jmp	short SHOW_FAN2
	CPUFAN_WORKING2:
		cmp	al, 0
		je	short SHOW_FAN2

		xor	bh,bh
		mov	bl,al
ifndef	FAN_Divisor				
     		mov	ax,0000h		; 0a4cb8h=(1310720/2)
		mov	dx,0ah			; Count=(1310720/(RPM*2))

else;
	if	FAN_Divisor 	eq	4
     		mov	ax,0000h		; 0a4cb8h=(1310720/4)
		mov	dx,05h			; Count=(1310720/(RPM*4))
	endif;	FAN_Divisor 	eq	4

	if	FAN_Divisor 	eq	8
     		mov	ax,8000h		; 0a4cb8h=(1310720/8)
		mov	dx,02h			; Count=(1310720/(RPM*8))
	endif;	FAN_Divisor 	eq	8

endif;	FAN_Divisor
		div	bx
   	SHOW_FAN2:
		call far ptr	DGROUP:fproc_DISP_WORD_INT4
		mov	al, ' '
		call	X_Display_Char
		mov	al, 'R'
		call	X_Display_Char
		mov	al, 'P'
		call	X_Display_Char
		mov	al, 'M'
		call	X_Display_Char
	@@:
		ret
 
X_Show_Current_CPUFAN2	endp

endif;	SHOW_VIA686HM_CPUFAN2

ifndef	NO_SHOW_Voltage_FOR_VIA686HM
X_Display_Vin	Proc	Near
;=========================================
;Entry : AL = Reading Value
;	 BX = R2
;	 DX = R1 + R2
;EXIT : NONE
;=========================================
;------------------------------------------------------------
;	Value = [Voltage * R2 / (R1+R2)] * 105.12 - 5.32
;	Voltage = [(Value + 5.32) * (R1+R2) / R2] / 105.12
;		= [(Value*25 + 133) * (R1+R2) / R2] / 2628
;------------------------------------------------------------

		cmp	al,0ffh			
		jne	short Vin_WORKING	
		xor	ax,ax			
	Vin_WORKING:				


		push	bx
		push	dx
		xor	ah,ah
		mov	bl, 25			;Value * 25
		mul	bl			;ax = al * bl
		add	ax, 133			;Value * 25 + 133 
		pop	bx			;(R1+R2)
		mul	bx			;(Value*25+133) * (R1+R2)
		pop	bx			;R2
		div	bx			;[(Value*25+133) * (R1+R2) / R2]
		xor	dx, dx
		mov	bx, 2628
		div	bx			;[(Value*25+133) * (R1+R2) / R2] / 2628


		push	dx			;push remainder to stack


		call far ptr	DGROUP:fproc_DISP_Byte_INT2

		mov	al, '.'
		call	X_Display_Char

		pop	ax			;pop remainder

		mov	bx, 100
		mul	bx
		mov	bx, 2628
		div	bx		

		cmp	al,9
		jbe	short Below_9B
		call far ptr	DGROUP:fproc_DISP_Byte_INT2
		jmp	short Above_9B
	Below_9B:
		call far ptr	DGROUP:fproc_DISP_Byte_HEX2
	Above_9B:

		mov	al, ' '
		call	X_Display_Char
		mov	al, 'V'
		call	X_Display_Char

		ret	

X_Display_Vin	endp

ifndef	No_Show_VIA686HM_IN0				
X_Show_Current_IN0	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,22h			
		call	X_Get_VIA686HM

ifdef	Vin0_Use_Negative_Input
		mov	dx,Vin0_R1
else;	Vin0_Use_Negative_Input
		mov	dx,(Vin0_R1+Vin0_R2)
endif;	Vin0_Use_Negative_Input
		mov	bx,Vin0_R2

		call	X_Display_Vin
	@@:
		ret

X_Show_Current_IN0	endp
endif;	No_Show_VIA686HM_IN0				


ifndef	NO_VIA686HM_VIN1					;R05
X_Show_Current_IN1	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,23h			; IN1
		call	X_Get_VIA686HM

ifdef	Vin1_Use_Negative_Input
		mov	dx,Vin1_R1
else;	Vin1_Use_Negative_Input
		mov	dx,(Vin1_R1+Vin1_R2)
endif;	Vin1_Use_Negative_Input
		mov	bx,Vin1_R2

		call	X_Display_Vin
	@@:
		ret

X_Show_Current_IN1	endp
endif;	NO_VIA686HM_VIN1					;R05

ifndef	NO_VIA686HM_VIN2					;R05
X_Show_Current_IN2	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,24h			; IN2
		call	X_Get_VIA686HM

ifdef	Vin2_Use_Negative_Input
		mov	dx,Vin2_R1
else;	Vin2_Use_Negative_Input
		mov	dx,(Vin2_R1+Vin2_R2)
endif;	Vin2_Use_Negative_Input
		mov	bx,Vin2_R2

		call	X_Display_Vin
	@@:
		ret

X_Show_Current_IN2	endp
endif;	NO_VIA686HM_VIN2					;R05

ifndef	NO_VIA686HM_VIN3					;R05
X_Show_Current_IN3	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,25h			; IN3
		call	X_Get_VIA686HM

ifdef	Vin3_Use_Negative_Input
		mov	dx,Vin3_R1
else;	Vin3_Use_Negative_Input
		mov	dx,(Vin3_R1+Vin3_R2)
endif;	Vin3_Use_Negative_Input
		mov	bx,Vin3_R2

		call	X_Display_Vin
	@@:
		ret

X_Show_Current_IN3	endp
endif;	NO_VIA686HM_VIN3					;R05

ifndef	NO_VIA686HM_VIN4					;R05
X_Show_Current_IN4	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,26h			; IN4
		call	X_Get_VIA686HM

ifdef	Vin4_Use_Negative_Input
		mov	dx,Vin4_R1
else;	Vin4_Use_Negative_Input
		mov	dx,(Vin4_R1+Vin4_R2)
endif;	Vin4_Use_Negative_Input
		mov	bx,Vin4_R2

		call	X_Display_Vin
	@@:
		ret

X_Show_Current_IN4	endp
endif;	NO_VIA686HM_VIN4					;R05

ifndef NO_VIA686HM_VIN5					
X_Show_Current_IN5	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,27h			; IN5
		call	X_Get_VIA686HM

ifdef	Vin5_Use_Negative_Input
		mov	dx,Vin5_R1
else;	Vin5_Use_Negative_Input
		mov	dx,(Vin5_R1+Vin5_R2)
endif;	Vin5_Use_Negative_Input
		mov	bx,Vin5_R2

		call	X_Display_Vin
	@@:
		ret

X_Show_Current_IN5	endp
endif	;NO_VIA686HM_VIN5					

 ifndef	NO_VIA686HM_VIN6					
X_Show_Current_IN6	Proc	Near

		cmp	al, Special_Before
		je	short @F

		mov	cl,28h			; IN6
		call	X_Get_VIA686HM

ifdef	Vin6_Use_Negative_Input
		mov	dx,Vin6_R1
else;	Vin6_Use_Negative_Input
		mov	dx,(Vin6_R1+Vin6_R2)
endif;	Vin6_Use_Negative_Input
		mov	bx,Vin6_R2

		call	X_Display_Vin
	@@:
		ret

X_Show_Current_IN6	endp
 endif;	NO_VIA686HM_VIN6					
endif;	NO_SHOW_Voltage_FOR_VIA686HM


ifndef	BIOS60							
		Public	X_Update_VIA686HM_Screen
X_Update_VIA686HM_Screen	Proc	far

		pusha

ifdef	Update_Sensor_in_CPUFEAT				
		cmp	byte ptr CUR_PAGE[bp], PAGE_CPU
else;	Update_Sensor_in_CPUFEAT
ifdef	Update_Sensor_in_IOFEAT					
		cmp	byte ptr CUR_PAGE[bp], PAGE_IO		
else;	Update_Sensor_in_IOFEAT					
		cmp	byte ptr CUR_PAGE[bp], PAGE_CFEATURE
endif;	Update_Sensor_in_IOFEAT					
endif;	Update_Sensor_in_CPUFEAT				
		jne	short Update_VIA686HM_end

	;----------------------------------------
		mov	si, offset VIA686HM_Item_List

	Update_VIA686HM_Start:

		mov	bx, cs:[si]
		cmp	bx, -1
		je	short Update_VIA686HM_end
		push	si
		call	X_Display_Whole_Item
		pop	si
		inc	si
		inc	si
		jmp	short Update_VIA686HM_Start
	;----------------------------------------

	Update_VIA686HM_end:

		popa
		retf

X_Update_VIA686HM_Screen	Endp
endif	;BIOS60							

ifdef	BIOS60							
	db	'$SpeRT'					
endif	;BIOS60							

VIA686HM_Item_List	Label	Word

ifdef	BIOS60							
	dw	VIA686HM_Runtime_No				
endif	;BIOS60							

	dw	offset Current_CPU_Temp_Item			
	dw	offset Current_System_Temp_Item
ifdef	SHOW_VIA686HM_CPUFAN1
	dw	offset Current_CPUFAN1_Item
endif;	SHOW_VIA686HM_CPUFAN1
ifdef	SHOW_VIA686HM_CPUFAN2
	dw	offset Current_CPUFAN2_Item
endif;	SHOW_VIA686HM_CPUFAN2
ifndef	NO_SHOW_Voltage_FOR_VIA686HM
ifndef	No_Show_VIA686HM_IN0				
	dw	offset Current_IN0_Item
endif;	No_Show_VIA686HM_IN0				
ifndef	NO_VIA686HM_VIN1					;R05
	dw	offset Current_IN1_Item
endif;	NO_VIA686HM_VIN1					;R05
ifndef	NO_VIA686HM_VIN2					;R05
	dw	offset Current_IN2_Item
endif;	NO_VIA686HM_VIN2					;R05
ifndef	NO_VIA686HM_VIN3					;R05
	dw	offset Current_IN3_Item
endif;	NO_VIA686HM_VIN3					;R05
ifndef	NO_VIA686HM_VIN4					;R05
	dw	offset Current_IN4_Item
endif;	NO_VIA686HM_VIN4					;R05
ifndef NO_VIA686HM_VIN5					
	dw	offset Current_IN5_Item
endif	;NO_VIA686HM_VIN5					

 ifndef	NO_VIA686HM_VIN6					
	dw	offset Current_IN6_Item
 endif;	NO_VIA686HM_VIN6					
endif	;NO_SHOW_Voltage_FOR_VIA686HM

VIA686HM_Runtime_No	EQU	(($ - offset VIA686HM_Item_List)-2)/2

	dw	-1
endif	;SENSOR_IN_XGROUP			
ENDIF	;COMPILE_FOR_SENSOR_MNU
ENDIF	;COMPILE_FOR_SENSOR_MNU

;R02 - end
