;	[]===========================================================[]
;
;	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
;----------------------------------------------------------------------------
;R38 	01/28/99  DRS	This function depends on Not_Change_Setup_Color definition
;			Don't support "Change Color" function in SETUP.
;			Set default SETUP color by CMOS3B[bp] = 03h
;R37	12/17/98  LAW	added "CPU_FEATURE_USE_SPECIAL_STR" can change Feature
;			title 
;R36	11/23/98 ADS	Support KEYBOARD PASSWORD function by chipset.
;			note: define " PassWord_PSON_By_Chipset" please don't
;			      define " Double_Password "	
;R35	09/29/98  RAY	Move code to XGROUP
;R34	09/23/98  RCH	Change warning message for HDD mode usage for SCO-UNIX
;			. The SCO-UNIX v5.xx already supported LBA mode.
;R33    06/17/98  TNY	Add two option "EXIT_D4_YES" and "SAVE2CMOS_D4_YES"
;R31b	06/05/98  MAX	Support CMOS default value save to 2M ROM Flash function
;R31a	06/01/98  MAX	Fixed by 1M ROM 4k Unit Only
;R32    05/08/98  TNY	Added CPU internal frequency into setup main menu
;R31	04/24/98  MAX	Support CMOS backup to Flash ROM function.This function
;                       will create 2 hot key (F6-Save CMOS to BIOS and
;			F7-Load CMOS from BIOS) in kernel page of setup screen
;			If you want to to use it just define "Backup_CMOS_to_FLASH EQU 1"
;			in BIOS.CFG
;R30	04/13/98  STV	Added "MENU IN BIOS" func-key F7 to print if switch
;			"MIB_Print".
;R29	03/26/98  RAY	Move all help messages of this file to XGROUP.
;R28E	02/18/98  KVN	Fixed coding mistake
;R28D	02/18/98  KVN	Cut all MIB code in 0F000h segment and paste to XGROUP
;R28C	02/13/98  STV	Fixed setup in Modbin must can't show "F5 : Menu in BIOS"
;R28B	02/13/98  STV	Fixed UP key became DOWN in setup by R28A
;R28A	02/13/98  STV	Fixed "MENU IN BIOS" item change to func-key F5 and not
;			Define "MENU_IN_BIOS" by cbrom.exe v1.22 after.
;			The length of each line in txt file can't exceed 78 bytes.
;R28	02/11/98  STV	Add "MENU IN BIOS" item for cbrom.exe(V1.22) /mib.
;			ifdef MENU_IN_BIOS.
;R27	01/22/98  KGN	Add define LoadD4_from_STDCMOS for chicony request
;R26	09/09/97  LAW	added "Set_Value_at_Save_and_Exit_Cmos_For_Superio" for
;			set w83977tf password on now function ,When is do "Save CMOS and Exit"
;			at Setup
;R25	08/19/97  LAW	added Public Password_Disable_Strfor Winbond 83977TF
;			"Password_ON_NOW_SUPPORT" 
;R21A	07/24/97  TNY	Move "Setup_Saved_Handler" hook to setup.asm .
;R24	07/14/97  RCH	Added a switch to disable item "LOAD BIOS DEFAULT"
;R23	06/25/97  KVN	Fixed HDD of secondary channel can't to do low level
;			format on some MB (e.g. VX)
;r22	06/04/97  PTY	Add code for RPB
;R21	05/28/97  TNY	Add "Special_Handler_Setup_Saved" definition .
;R20	11/15/96  RAY	Move those password related codes to E000 to save F000 area
;R19A	05/02/96  KVN	Fixed musted to clear [CDROM_Exist_Flag] value before
;			Auto_IDE_Detect function otherwise HDD will detect none
;R19	05/01/96  KVN	Support any drive boot
;R18	02/14/96  RAY	Add option: Never_Disable_Password
;R14A	02/12/96  RAY	Always enable PNPFEAT
;R17	02/08/96  KVN	Modify Item position for setup default display title
;			string of MODBIN.EXE
;R16	10/26/95  AVN	Add NEW_IO_FEATURE Definition For Audio Setup.
;R15	10/16/95  RAY	1. Do not inplement F6/F7 if the corresponding item(s)
;			   is disabled
;			2. Save codes
;R14	09/21/95  KEN	Add NEW_PNP_SETUP definition.
;R13A	08/07/95  KVN	Add Perfect_Password compare twise input string
;R13	08/05/95  RAY	Add BIOS.CFG switch: Perfect_Password
;R10A	08/03/95  RAY	No_Support_4_IDE should placed after "include bios.cfg"
;R12	07/28/95  DNL	Define "IDE_PRIMARY_ONLY" to support no slave IDE mode
;R11A	07/15/95  KVN	Call reset controller routine from hdinstal.asm
;R12	07/14/95  KVN	Added SCO-UNIX installation note message
;R11	07/05/95  KVN	Add reset controller before IDE detect
;R10	06/14/95  KVN	Open Support_4_IDE feature become standard feature
;R09	06/13/95  KVN	Reduce Post_func_call and F000_call code size
;R08	04/15/95  RCH	Some customers like BIOSTAR don't want to display 
;			BIOS defalut string
;R07	10/11/94  RAY	If LBA HDD is found, set LBA mode be default
;R06	10/06/94  RAY	modify position of some strings for Low Level Format
;			in 4 IDE version
;R05	09/23/94  RAY	Change Show String under SETUP/DOS for 4 IDE Support.
;R02	09/05/94  KVN	Change POST auto IDE detect skip key is 'F4'
;R01	08/17/94  KVN	Added POST auto IDE detect function
;R00	06/02/94  RAY	Initial Revision for HDD LBA/LARGE mode & 4 IDE

		PAGE	56,132
		.286

IDE_LBA_MODE_SUPPORT	EQU	1
;R10A ifndef	No_Support_4_IDE					;R10
;R10A Support_4_IDE		EQU	1				;R10
;R10A endif	;No_Support_4_IDE					;R10

		include	bios.cfg

ifndef	No_Support_4_IDE					;R10A
Support_4_IDE		EQU	1				;R10A
endif	;No_Support_4_IDE					;R10A
;r22 start
ifdef RPB_ENABLED                   ; RXX
; Add these changes to support a seperate RPB setup page.
    include rpb.cfg                 
endif ; RPB_ENABLED
;r22 end
		include	bsetup.inc
		include	cmos.equ
		include	common.mac
		include	common.equ

		EXTRN	PM_STAT:ABS
		EXTRN	BIOS_STAT:ABS
		EXTRN	CHIP_STAT:ABS
ifdef	NEW_CPU_FEATURE				;R32
		EXTRN	CPU_STAT:ABS		;R32
endif;	NEW_CPU_FEATURE				;R32
;r22 start
ifdef RPB_FEATUREPAGE_ENABLED       ; RXX
		EXTRN	RPB_STAT:ABS
endif
;r22 end
		EXTRN	ASK_CONFIRM:NEAR
		EXTRN	CONFIRM_PASSWORD:NEAR
		EXTRN	DESTROY_KEY_THEN_RET:NEAR
		EXTRN	DISPLAY_CHAR:NEAR
		EXTRN	DISPLAY_STRING:NEAR
		EXTRN	DISPLAY_WHOLE_ITEM:NEAR
		EXTRN	GET_PASSWORD:NEAR
		EXTRN	GO_LEFT_ITEM:NEAR
		EXTRN	GO_RIGHT_ITEM:NEAR
		EXTRN	HDDC_ITEM:NEAR
		EXTRN	HDDD_ITEM:NEAR

ifdef	Support_4_IDE
		extrn	HDDE_ITEM:near
		extrn	HDDF_ITEM:near
		extrn	CYL_HEAD_STR_1:near		;R05
		extrn	SnameKc:near			;R05
		extrn	SnameKd:near			;R05
		extrn	SnameKe:near			;R05
		extrn	SnameKf:near			;R05
endif	;Support_4_IDE

		EXTRN	INIT_PAGE:NEAR
		EXTRN	KEY:NEAR
		EXTRN	LOAD_ALL_DEFAULT:NEAR
		EXTRN	NULLSTR:NEAR
		EXTRN	REFRESH_MENU:NEAR
		EXTRN	REFRESH_MENU1:NEAR
;R35		EXTRN	RESHOW_HDD:NEAR
		EXTRN	X_RESHOW_HDD:NEAR		;R35
		EXTRN	SELF_DISABLE:NEAR
		EXTRN	SEQ_DOWN:NEAR
		EXTRN	SEQ_UP:NEAR
		EXTRN	SNAMEKC:NEAR
		EXTRN	SNAMEKD:NEAR
		EXTRN	VHILITE:NEAR
		EXTRN	WRITE_OUT_CMOS:NEAR
		EXTRN	YES_EXIT:NEAR
		EXTRN	VNormal:NEAR
		extrn	VReverse:near
		EXTRN	PCI_STAT:ABS
		EXTRN	PNP_STAT:ABS		;R14A
		extrn	PCI_Feature_Str:near
		extrn	PM_Feature_Str:near
		extrn	Write_Item_Value:near
		extrn	redo:near
		extrn	NUM_OF_IDE_ITEM:ABS
		extrn	HDD_TYPE_DIFF:ABS
		extrn	Get_HDD_CMOS_Info:near
		extrn	Disp_ItemTitle:near
		extrn	Auto_IDE_Detect_X:near
;R35		extrn	Skip_HDD_Type:near
		extrn	X_Skip_HDD_Type:near		;R35
		extrn	Ask_Inputs:near
;R14A ifdef	NEW_PNP_SETUP	;R14
		extrn	PNP_Feature_Str:near
;R14A endif	;NEW_PNP_SETUP

;R16 - start
ifdef	NEW_IO_FEATURE
		extrn	IO_Feature_Str:near
endif	;NEW_IO_FEATURE
;R16 - end

ifndef	DOSVERSION
		extrn	Get_Cmos:Near
		extrn	Set_Cmos:Near
		extrn	BIOS_ID_NUMBER:Near
		extrn	BUS_ID_STR:Near
endif	;DOSVERSION

;R09		extrn	POST_func_end:Near	;128k
;R09		extrn	POST_VECT:Near		;128k
		extrn	Post_call_proc:near	;R09

ifdef	Double_Password
		extrn	Ct_User_Password_Location:near
endif	;Double_Password

ifdef	IDE_LBA_MODE_SUPPORT
		extrn	CYL_HEAD_STR:near
endif	;IDE_LBA_MODE_SUPPORT

ifndef	NO_HDD_LOW_LEVEL_FORMAT
		extrn	Low_Format:near
endif	;NO_HDD_LOW_LEVEL_FORMAT
		extrn	Reset_HDD_controller:near	;R11A

	ifdef	Perfect_Password			;R13
		extrn	Save_Perfect_Password:near	;R13
	endif	;Perfect_Password			;R13

		extrn	F000_call_proc:near		;R20
		extrn	Display_CS_String:near		;R20
		extrn	F000_Display_String:near	;R20
ifdef	Set_Value_at_Save_and_Exit_Cmos_For_Superio		;R26
		extrn	Immediate_Set_Value_For_Superio:Near	;R26
endif;	Set_Value_at_Save_and_Exit_Cmos_For_Superio		;R26
;R31 start
;R31bifndef Flash_16K_8K_8K_Unit	  ;R31a
ifdef Backup_CMOS_to_FLASH
		extrn	Check_Flash_CMOS:near
		extrn	XCALL_PROC:near
                Public  Save_CMOS_TO_BIOS_Default	
	        Public  Load_CMOS_From_BIOS_Default
		public	S_CMOS_TO_BIOS			
		public	L_CMOS_FROM_BIOS		      
endif ;Backup_CMOS_to_FLASH
;R31bendif ; Flash_16K_8K_8K_Unit	  ;R31a
;R31 end

		extrn	X_Refresh_Menu1:near		;R35
		extrn	X_Display_CS_String:near	;R35
		extrn	X_Display_String:near		;R35
		extrn	X_Display_Char:Near		;R35
		extrn	X_Disp_ItemTitle:Near		;R35
		extrn	X_Get_HDD_CMOS_Info:near	;R35
		extrn	X_Write_Item_Value:near		;R35
		extrn	X_VReverse:Near			;R35
		extrn	X_VNormal:near			;R35

		Public	KERNAL_START
		Public	KERNAL_END
		Public	KERNAL_STARTUP_STR
		Public	KERNAL_SPECIAL_DO
		Public	KERNAL_SPECIAL_SHOW
		Public	KERNAL_KEY_LIST

		Public	STD_CLR_STR
		Public	STD_CLR_STR1
		Public	Common_StartUp_Str
		Public	AWARD_Title
		Public	DO_K_ESC
		Public	DO_SAVE_EXIT
		Public	GOTO_KERNAL

		Public	GOTO_PM_FEATURE		;Setup From DOS

		Public	Std_CMOS_Str
		Public	BIOS_Feature_Str
		Public	Chip_Feature_Str
ifdef	NEW_CPU_FEATURE				;R32
		Public	CPU_Feature_Str		;R32
endif;	NEW_CPU_FEATURE				;R32

;r22 start
ifdef RPB_FEATUREPAGE_ENABLED       ; RXX
; Enable this code if RPB feature page is desired
    Public  RPB_Feature_Str
endif ; RPB_FEATUREPAGE_ENABLED
;r22 end
;r22 start
ifdef RPB_POSTMENU_ENABLED          ; RXX
; Enable this code if RPB post menu is desired
		Public	RPB_POSTMENU_Start
		Public	RPB_POSTMENU_End
		Public	RPB_POSTMENU_Startup_Str
		Public	RPB_POSTMENU_Special_Do
		Public	RPB_POSTMENU_Special_Show
endif
;r22 end
		public	MIB_Screen		;R28D
		public	MIB_key			;R28D
DGROUP		GROUP	FCODE
FCODE		SEGMENT	PARA PUBLIC 'CODE'
		ASSUME	CS:DGROUP,DS:DGROUP

		db	'$ML$'				;R29
Kernal_Special_Do:
		dw	((offset Enter_List_End) - (offset Enter_List))/4
Enter_List	Label	Word
		dw	offset Std_CMOS_Item,offset Goto_Std_CMOS
		dw	offset BIOS_Feature_Item,offset Goto_BIOS_Feature
		dw	offset Chip_Feature_Item,offset Goto_Chip_Feature
		dw	offset PM_Feature_Item,offset Goto_PM_Feature
		dw	offset PCI_Feature_Item,offset Goto_PCI_Feature
		dw	offset Load_BIOS_D4_Item,offset Load_BIOS_Default
		dw	offset Load_SETUP_D4_Item,offset Load_SETUP_Default
;R14A ifdef	NEW_PNP_SETUP	;R14
		dw	offset PNP_Feature_Item,offset Goto_PNP_Feature
;R14A endif	;NEW_PNP_SETUP
;R16 - start
ifdef	NEW_IO_FEATURE
		dw	offset IO_Feature_Item,offset Goto_IO_Feature
endif	;NEW_IO_FEATURE
ifdef	NEW_CPU_FEATURE							;R32
		dw	offset CPU_Feature_Item,offset Goto_CPU_Feature	;R32
endif;	NEW_CPU_FEATURE							;R32
;r22 start
ifdef RPB_FEATUREPAGE_ENABLED       ; RXX
; Enable this code if RPB feature page is desired
		dw	offset RPB_Feature_Item,offset Goto_RPB_Feature
endif	; RPB_FEATUREPAGE_ENABLED
;r22 end
;R16 - end
ifdef	Double_Password
		dw	offset SuperPassword_Item,offset SuperPass_Set
		dw	offset UserPassword_Item,offset UserPass_Set
else	;Double_Password
		dw	offset Password_Item,offset Password_Set
;R36 - starts
ifdef	Password_PSON_By_Chipset
		dw	offset Password_PSON_Item,offset Password_PSON_Set
endif;	Password_PSON_By_Chipset
;R36 - ends
endif	;Double_Password
		dw	offset Auto_IDE_Item,offset IDE_Detect
ifndef	NO_HDD_LOW_LEVEL_FORMAT
		dw	offset HDD_LFormat_Item,offset HDD_LFormat
endif	;NO_HDD_LOW_LEVEL_FORMAT

		dw	offset Save_Exit_Item,offset Do_Save_Exit1
		dw	offset Exit_NoSave_Item,offset Do_Exit_NoSave

Enter_List_End	Label	Word

Kernal_Special_Show:

		dw	Kernal_Show_NO

Kernal_Show_NO	EQU	(($ - offset Kernal_Special_Show)-2)/4

Kernal_Key_List:
		dw	offset Seq_Up		;function for UP_ARROW
		dw	offset Seq_Down		;function for DOWN_ARROW
		dw	offset Go_Left_Item	;function for LEFT_ARROW
		dw	offset Go_Right_Item	;function for RIGHT_ARROW
;--------------------------------------------------------------------------------

		Public	PAGE_NAME_Y
		Public	START_Y

START_Y		EQU	0
END_Y		EQU	24
BLOCK_START_Y	EQU	START_Y	+ 3
AWARD_NAME_Y	EQU	START_Y + 2
BIOS_ID_Y	EQU	START_Y
PAGE_NAME_Y	EQU	START_Y + 1
KERNAL_HELP_Y	EQU	END_Y - 7
COMMON_HELP_Y	EQU	END_Y - 6

LEFT_X		EQU	0
CENTER_X	EQU	40
RIGHT_X		EQU	79

Kernal_StartUp_Str	label	near

		db	V_WARN

		BORDER1	<,LEFT_X  ,BLOCK_START_Y,RIGHT_X,END_Y,1>

		BORDER1	<,LEFT_X+1,KERNAL_HELP_Y,RIGHT_X-1,KERNAL_HELP_Y,0>
		POS	<,LEFT_X  ,KERNAL_HELP_Y>
		db	'Ç'
		POS	<,RIGHT_X ,KERNAL_HELP_Y>
		db	'¶'

;R31 start
ifdef Backup_CMOS_to_FLASH

		BORDER1	<,LEFT_X+1,KERNAL_HELP_Y+4,RIGHT_X-1,KERNAL_HELP_Y+4,0>	;;chage	y
		POS	<,LEFT_X  ,KERNAL_HELP_Y+4>				;;add  y+5
		db	'Ç'							;;old  y+3
		POS	<,RIGHT_X ,KERNAL_HELP_Y+4>				;;
		db	'¶'							;;

else;Backup_CMOS_to_FLASH
		BORDER1	<,LEFT_X+1,KERNAL_HELP_Y+3,RIGHT_X-1,KERNAL_HELP_Y+3,0>	
		POS	<,LEFT_X  ,KERNAL_HELP_Y+3>				
		db      'Ç'						
		POS	<,RIGHT_X ,KERNAL_HELP_Y+3>				
		db	'¶'						
endif	;Backup_CMOS_to_FLASH
;R31 end

		BORDER1	<,CENTER_X,BLOCK_START_Y+1,CENTER_X,KERNAL_HELP_Y-1,0>
		POS	<,CENTER_X,BLOCK_START_Y>
		db	'Ñ'
		POS	<,CENTER_X,KERNAL_HELP_Y>
		db	'Á'

		STRSHOW	<,,,offset AWARD_Title>

	;Help menu
		POS	<,2,KERNAL_HELP_Y+1>
		db	'Esc : Quit'
		POS	<,2,KERNAL_HELP_Y+2>
		db	'F10 : Save & Exit Setup'
		POS	<,42,KERNAL_HELP_Y+1>
		db	'      : Select Item'
ifNdef	Not_Change_Setup_Color				;R38
		POS	<,42,KERNAL_HELP_Y+2>
		db	'(Shift)F2 : Change Color'
endif	;Not_Change_Setup_Color				;R38
		db	0			;end of string

Common_StartUp_Str	label	near
			db	V_WARN
 			BORDER1	<,CENTER_X,COMMON_HELP_Y,RIGHT_X,END_Y,0>
			BORDER1	<,LEFT_X  ,BLOCK_START_Y,RIGHT_X,END_Y,1>
			BORDER1	<,CENTER_X,BLOCK_START_Y,CENTER_X,21,0>
			POS	<,CENTER_X,BLOCK_START_Y>
			db	'Ñ'
			POS	<,CENTER_X,END_Y>
			db	'Ï'
			POS	<,CENTER_X,COMMON_HELP_Y>
			db	'Ã'
			POS	<,RIGHT_X ,COMMON_HELP_Y>
			db	'¶'

		;Help Menu
			db	V_NORMAL
			POS	<,42,COMMON_HELP_Y+1>
			db	'ESC : Quit'
			POS	<,60,COMMON_HELP_Y+1>
			db	' : Select Item'

			POS	<,42,COMMON_HELP_Y+2>
			db	'F1  : Help'
			POS	<,60,COMMON_HELP_Y+2>
			db	'PU/PD/+/- : Modify'

			POS	<,42,COMMON_HELP_Y+3>
			db	'F5  : Old Values'
ifNdef	Not_Change_Setup_Color				;R38
			POS	<,60,COMMON_HELP_Y+3>
			db	'(Shift)F2 : Color'
endif	;Not_Change_Setup_Color				;R38

			POS	<,42,COMMON_HELP_Y+4>
;R15;R08 - start
;R15ifdef	NO_BIOS_DEFAULT_MENU
;R15			db	'                        '
;R15else;	NO_BIOS_DEFAULT_MENU
;R15			db	'F6  : Load BIOS Defaults'
;R15endif;	NO_BIOS_DEFAULT_MENU
;R15;R08 - end
;R15
;R15			POS	<,42,COMMON_HELP_Y+5>
;R15			db	'F7  : Load Setup Defaults'

		CALLROUTINE <,offset Show_Load_BIOS_D4_Str>	;R15
		POS	<,42,>					;R15
		CALLROUTINE <,offset Show_Load_Setup_D4_Str>	;R15

AWARD_Title:
ifndef	AWARD_Title_Put_in_Cantral			;R37
		POS	<,28,BIOS_ID_Y>
else;	AWARD_Title_Put_in_Cantral			;R37
ifndef	PCI_BUS						;R37
		POS	<,28,BIOS_ID_Y>			;R37
else;	PCI_BUS						;R37
		POS	<,27,BIOS_ID_Y>			;R37
endif;	PCI_BUS						;R37
endif;	AWARD_Title_Put_in_Cantral			;R37
		db	V_NORMAL,'ROM '
		STRSHOW	<,,,offset BUS_ID_STR>
		db	' BIOS '
		db	'('
		STRSHOW	<,,,offset BIOS_ID_NUMBER>
		db	')'

		POS	<,31,PAGE_NAME_Y>
		db	'CMOS SETUP UTILITY'
		POS	<,30,AWARD_NAME_Y>
		db	'AWARD SOFTWARE, INC.'
		db	0

;R15 - Starts
		Public	LoadBiosD4Str
F6_Str		db	'F6  : '
LoadBiosD4Str	db	'Load BIOS  Defaults',0

		Public	LoadSetupD4Str
F7_Str		db	'F7  : '
LoadSetupD4Str	STRSHOW	<,,,offset LoadBiosD4Str>
		SUBX	<,14>
		db	'Setup'
		ADDX	<,9>
		db	0

Show_Load_BIOS_D4_Str	Proc	Near

		extrn	If_BIOS_D4_Needed:near
		call	If_BIOS_D4_Needed
		jnz	short @F
		pusha
		mov	si, offset F6_Str
		call	Display_String
		popa
		inc	byte ptr CURSOR_Y[bp]
	@@:
		ret

Show_Load_BIOS_D4_Str	Endp

Show_Load_Setup_D4_Str	Proc	Near

		extrn	If_Setup_D4_Needed:near
		call	If_Setup_D4_Needed
		jnz	short @F
		pusha
		mov	si, offset F7_Str
		call	Display_String
		popa
	@@:
		ret

Show_Load_Setup_D4_Str	Endp
;R15 - Ends

ifdef	DOSVERSION
BIOS_ID_NUMBER	Label	Byte
		include	idnumber.inc

BUS_ID_STR	Label	Byte
IF BUS_TYPE EQ EISA_BUS
		db	'EISA'
ELSEIF BUS_TYPE EQ ISA_BUS
		db	'ISA'
ENDIF ;BUS_TYPE
		db	0

endif	;DOSVERSION

;************************************************************************
;*									*
;*									*
;*									*
;*			    MENU ITEMS					*
;*									*
;*									*
;*									*
;************************************************************************

KERNAL_START	LABEL	NEAR
;------------------------------------------------------------------
NOCT		EQU	-1
;R17 Yaxis	=	BLOCK_START_Y + 1
L_Yaxis	=	BLOCK_START_Y + 1	;R17 

Std_CMOS_Item	Label	near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Std_CMOS_Str,0,0, 5,L_Yaxis,0,0,offset Std_CMOS_Help>	;R17 
;R17 			  offset Std_CMOS_Str,0,0, 5,Yaxis,0,0,offset Std_CMOS_Help>

;------------------------------------------------------------------
IFE BIOS_STAT EQ ITEMDISABLE
;R17 Yaxis	= Yaxis + 2
L_Yaxis	= L_Yaxis + 2	;R17 
ENDIF
BIOS_Feature_Item	Label	near
		menuitem <0+BIOS_STAT,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset BIOS_Feature_Str,0,0, 5,L_Yaxis,0,0,offset BIOS_Feature_Help>	;R17 
;R17 			  offset BIOS_Feature_Str,0,0, 5,Yaxis,0,0,offset BIOS_Feature_Help>

;------------------------------------------------------------------
IFE CHIP_STAT EQ ITEMDISABLE
;R17 Yaxis	= Yaxis + 2
L_Yaxis	= L_Yaxis + 2	;R17 
ENDIF
Chip_Feature_Item	Label	near
		menuitem <0+CHIP_STAT,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Chip_Feature_Str,0,0, 5,L_Yaxis,0,0,offset Chip_Feature_Help>	;R17 
;R17 			  offset Chip_Feature_Str,0,0, 5,Yaxis,0,0,offset Chip_Feature_Help>

;------------------------------------------------------------------
IFE PM_STAT EQ ITEMDISABLE
;R17 Yaxis	= Yaxis + 2
L_Yaxis	= L_Yaxis + 2	;R17 
ENDIF

PM_Feature_Item	Label	near
		menuitem <0+PM_STAT,\
			  offset NullStr,NOCT,1,KERNAL_CONTROL,00000001b,\
			  offset PM_Feature_Str,0,0, 5,L_Yaxis,0,0,offset PM_Feature_Help>	;R17 
;R17 			  offset PM_Feature_Str,0,0, 5,Yaxis,0,0,offset PM_Feature_Help>

;------------------------------------------------------------------
IFE PCI_STAT EQ ITEMDISABLE
;R17 Yaxis	= Yaxis + 2
L_Yaxis	= L_Yaxis + 2	;R17 
ENDIF

PCI_Feature_Item	Label	near
		menuitem <0+PCI_STAT,\
			  offset NullStr,NOCT,1,KERNAL_CONTROL,00000001b,\
			  offset PCI_Feature_Str,0,0, 5,L_Yaxis,0,0,offset PCI_Feature_Help>	;R17 
;R17 			  offset PCI_Feature_Str,0,0, 5,Yaxis,0,0,offset PCI_Feature_Help>

;------------------------------------------------------------------
;R17 Yaxis	= Yaxis + 2
;R17 		Public	Load_BIOS_D4_Item	;R15
;R17 Load_BIOS_D4_Item	Label	Near
;R17 		menuitem <0,\
;R17 			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
;R17 			  offset BIOS_D4_Str,0,0, 5,Yaxis,0,0,offset BIOS_D4_Help>
;R17 
;R17 ;------------------------------------------------------------------
;R17 Yaxis	= Yaxis + 2
;R17 		Public	Load_Setup_D4_Item	;R15
;R17 Load_Setup_D4_Item	Label	Near
;R17 		menuitem <0,\
;R17 			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
;R17 			  offset Chipset_D4_Str,0,0, 5,Yaxis,0,0,offset Chipset_D4_Help>

;------------------------------------------------------------------
Yaxis	=	BLOCK_START_Y + 1

;R14A ifdef	NEW_PNP_SETUP	;R14
PNP_Feature_Item	Label	near
;R14A		menuitem <0,\
		menuitem <0+PNP_STAT,\
			  offset NullStr,NOCT,1,KERNAL_CONTROL,00000001b,\
			  offset PNP_Feature_Str,0,0, 45,Yaxis,0,0,offset PNP_Feature_Help>
Yaxis	= Yaxis + 2
;R14A endif	;NEW_PNP_SETUP

;R32 - start
ifdef	NEW_CPU_FEATURE
;------------------------------------------------------------------
; CPU internal frequency
;------------------------------------------------------------------
CPU_Feature_Item		Label	near
	menuitem <0,\
		  offset NullStr,NOCT,1,KERNAL_CONTROL,00000001b,\
		  offset CPU_Feature_Str,0,0, 45,Yaxis,0,0,offset CPU_Feature_Help>
Yaxis	= Yaxis + 2
endif;	NEW_CPU_FEATURE
;R32 - end

;------------------------------------------------------------------
;R16 - start
;------------------------------------------------------------------
ifdef	NEW_IO_FEATURE
IO_Feature_Item		Label	near
		menuitem <0,\
			  offset NullStr,NOCT,1,KERNAL_CONTROL,00000001b,\
			  offset IO_Feature_Str,0,0, 45,Yaxis,0,0,offset IO_Feature_Help>
Yaxis	= Yaxis + 2
endif	;NEW_IO_FEATURE

;r22 start
ifdef RPB_FEATUREPAGE_ENABLED       ; RXX
; Enable this code if RPB feature page is desired
L_Yaxis	= L_Yaxis + 2
RPB_Feature_Item	Label	near
		menuitem <0+RPB_STAT,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset rpb_feature_str,0,0,5,L_YAXIS,0,0,offset rpb_feature_help>
endif ; RPB_FEATUREPAGE_ENABLED
;r22 end
;------------------------------------------------------------------
;R16 - end

;R17 start
;------------------------------------------------------------------
BIOSD4_STAT	=	0			;R24
ifdef	NO_BIOS_DEFAULT				;R24
BIOSD4_STAT	=	ITEMDISABLE 		;R24
endif;	NO_BIOS_DEFAULT				;R24
L_Yaxis	= L_Yaxis + 2
		Public	Load_BIOS_D4_Item	;R15
Load_BIOS_D4_Item	Label	Near
		menuitem <0+BIOSD4_STAT,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset BIOS_D4_Str,0,0, 5,L_Yaxis,0,0,offset BIOS_D4_Help>

;------------------------------------------------------------------
L_Yaxis	= L_Yaxis + 2
		Public	Load_Setup_D4_Item	;R15
Load_Setup_D4_Item	Label	Near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Chipset_D4_Str,0,0, 5,L_Yaxis,0,0,offset Chipset_D4_Help>
;------------------------------------------------------------------
;R17 end
ifdef	Double_Password

		Public	SuperPassword_Item
SuperPassword_Item	Label	Near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset SuperPassword_Str,0,0, 45,Yaxis,0,0,offset Password_Help>

		Public	UserPassword_Item
Yaxis	= Yaxis + 2
UserPassword_Item	Label	Near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset UserPassword_Str,0,0, 45,Yaxis,0,0,offset Password_Help>

else	;Double_Password

Password_Item	Label	Near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Password_Str,0,0, 45,Yaxis,0,0,offset Password_Help>

;R36 - starts
ifdef	Password_PSON_By_Chipset
Password_PSON_Item	Label	Near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Password_PSON_Str,0,0, 45,Yaxis,0,0,offset Password_Help>
endif;	Password_PSON_By_Chipset
;R36 - ends
endif	;Double_Password

;------------------------------------------------------------------
Yaxis	= Yaxis + 2
Auto_IDE_Item	Label	Near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Auto_IDE_Str,0,0, 45,Yaxis,0,0,offset Auto_IDE_Help>

;------------------------------------------------------------------
ifndef	NO_HDD_LOW_LEVEL_FORMAT
Yaxis	= Yaxis + 2
HDD_LFormat_Item	Label	Near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset HDD_LFormat_Str,0,0, 45,Yaxis,0,0,offset HDD_LFormat_Help>
endif	;NO_HDD_LOW_LEVEL_FORMAT
;------------------------------------------------------------------
Yaxis	= Yaxis + 2
Save_Exit_Item	Label	near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Save_Exit_Str,0,0, 45,Yaxis,0,0,offset Save_Exit_Help>

;------------------------------------------------------------------
Yaxis	= Yaxis + 2
Exit_NoSave_Item	Label	near
		menuitem <0,\
			  offset NullStr,NOCT,0,KERNAL_CONTROL,00000001b,\
			  offset Exit_NoSave_Str,0,0, 45,Yaxis,0,0,offset Exit_NoSave_Help>

;------------------------------------------------------------------

KERNAL_END	LABEL	NEAR

;R29 ;************************************************************************
;R29 ;*									*
;R29 ;*									*
;R29 ;*									*
;R29 ;*			HELP STRINGS					*
;R29 ;*									*
;R29 ;*									*
;R29 ;*									*
;R29 ;************************************************************************
;R29 Std_CMOS_Help		POS	<,27,22>
;R29 			db 	'Time, Date, Hard Disk Type...',0
;R29 
;R29 BIOS_Feature_Help	POS	<,24,22>
;R29 			db 	'Virus Protection, Boot Sequence...',0
;R29 
;R29 Chip_Feature_Help	POS	<,28,22>
;R29 			db 	'AT clock, DRAM timings...',0
;R29 
;R29 PCI_Feature_Help	POS	<,26,22>
;R29 			db 	'IRQ Settings, Latency Timers...',0
;R29 
;R29 PM_Feature_Help		POS	<,26,22>
;R29 			db 	'Sleep timer, Suspend timer...',0
;R29 ;r22 start
;R29 ifdef RPB_FEATUREPAGE_ENABLED       ; RXX
;R29 ; Enable this code if RPB feature page is desired
;R29 RPB_Feature_Help	POS	<,25,22>
;R29 			db 	'Remote Pre=Boot Support Setup...',0
;R29 endif ; RPB_FEATUREPAGE_ENABLED
;R29 ;r22 end
;R29 
;R29 BIOS_D4_Help		POS	<,18,22>
;R29 ;R15			db 	'Load BIOS Defaults except Standard CMOS SETUP',0
;R29 ;R15 - starts
;R29 			STRSHOW	<,,,offset LoadBiosD4Str>
;R29 Execpt_Str		db	' except Standard CMOS SETUP',0
;R29 ;R15 - Ends
;R29 
;R29 Chipset_D4_Help		POS	<,18,22>
;R29 ;R15			db 	'Load SETUP Defaults except Standard CMOS SETUP',0
;R29 ;R15 - starts
;R29 			STRSHOW	<,,,offset LoadSetupD4Str>
;R29 			STRSHOW	<,,,offset Execpt_Str>
;R29 			db	0
;R29 ;R15 - Ends
;R29 
;R29 ;R14A ifdef	NEW_PNP_SETUP	;R14
;R29 PNP_Feature_Help	POS	<,26,22>
;R29 			db 	'System IRQ, DMA Assignment',0
;R29 ;R14A endif	;NEW_PNP_SETUP
;R29 
;R29 ;R16 - start
;R29 ifdef	NEW_IO_FEATURE
;R29 IO_Feature_Help		POS	<,22,22>
;R29 			db 	'Onboard I/O, IRQ, DMA Assignment...',0
;R29 endif	;NEW_IO_FEATURE
;R29 ;R16 - end
;R29 
;R29 Password_Help		POS	<,27,22>
;R29 			db 	'Change/Set/Disable Password',0
;R29 
;R29 Auto_IDE_Help		POS	<,19,22>
;R29 			db 	'Auto-Configure HDD: Sector, Cylinder, Head...',0
;R29 
;R29 HDD_LFormat_Help	POS	<,24,22>
;R29 			db 	'Hard Disk Low Level Format Utility',0
;R29 
;R29 Save_Exit_Help		POS	<,26,22>
;R29 ;R15			db 	'Save Data to CMOS & Exit SETUP',0
;R29 			db 	'Save Data to CMOS'		;R15
;R29 AndExitStr		db	' & Exit SETUP',0		;R15
;R29 
;R29 Exit_NoSave_Help	POS	<,26,22>
;R29 ;R15			db 	'Abandon all Datas & Exit SETUP',0
;R29 			db 	'Abandon all Datas'		;R15
;R29 			STRSHOW	<,,,offset AndExitStr>		;R15
;R29 			db	0				;R15

;************************************************************************
;*									*
;*									*
;*									*
;*			STRINGS FOR DISPLAY				*
;*									*
;*									*
;*									*
;************************************************************************

Std_CMOS_Str		db	'STANDARD CMOS SETUP',0
BIOS_Feature_Str	db	'BIOS FEATURES SETUP',0
Chip_Feature_Str	db	'CHIPSET FEATURES SETUP',0
BIOS_D4_Str		db	'LOAD BIOS DEFAULTS',0
Chipset_D4_Str		db	'LOAD SETUP DEFAULTS',0
ifdef	NEW_CPU_FEATURE						;R32
ifndef	CPU_FEATURE_USE_SPECIAL_STR				;R37
CPU_Feature_Str		db	'CPU SPEED SETTING',0		;R32
else;	CPU_FEATURE_USE_SPECIAL_STR				;R37
CPU_FEATURE_Str		db	CPU_FEATURE_USE_SPECIAL_STR	;R37
			db	0				;R37
endif;	CPU_FEATURE_USE_SPECIAL_STR				;R37
endif;	NEW_CPU_FEATURE						;R32
;R31 start
;R31bifndef Flash_16K_8K_8K_Unit	  ;R31a
ifdef  Backup_CMOS_to_FLASH
SAVE_CMOS_TO_BIOS_Str 	db	'SAVE CMOS TO BIOS',0	 
LOAD_CMOS_From_BIOS_Str db	'LOAD CMOS FROM BIOS',0	  
endif ;Backup_CMOS_to_FLASH
;R31bendif ; Flash_16K_8K_8K_Unit	  ;R31a
;R31 end
;r22 start
ifdef RPB_FEATUREPAGE_ENABLED       ; RXX
; Enable this code if RPB feature page is desired
RPB_Feature_Str	db	'RPB FEATURES SETUP',0
endif ; RPB_FEATUREPAGE_ENABLED
;r22 end
ifdef	Double_Password
SuperPassword_Str	db	'SUPERVISOR PASSWORD',0
UserPassword_Str	db	'USER PASSWORD',0
else	;Double_Password
Password_Str		db	'PASSWORD SETTING',0
;R36 - starts
ifdef 	Password_PSON_By_Chipset
Password_PSON_Str	db	'PASSWORD KB POWER ON',0
endif; 	Password_PSON_By_Chipset	
;R36 - ends
endif	;Double_Password

Auto_IDE_Str		db	'IDE HDD AUTO DETECTION',0
HDD_LFormat_Str		db	'HDD LOW LEVEL FORMAT',0
Save_Exit_Str		db	'SAVE & EXIT SETUP',0
Exit_NoSave_Str		db	'EXIT WITHOUT SAVING',0

Save_Exit_Msg	label	near
		db	V_REVERSE
		BORDER1	<,22,11,57,15,Empty_Border>
		POS	<,25,13>
		db	'SAVE to CMOS and EXIT (Y/N)? '
		db	0

Exit_NoSave_Msg	label	near
		db	V_REVERSE
		BORDER1	<,22,11,57,15,Empty_Border>
		POS	<,26,13>
		db	'Quit Without Saving (Y/N)? '
		db	0

Not_Available_Msg:
		db	V_REVERSE
		BORDER1	<,22,11,57,15,Empty_Border>
		POS	<,25,12>
		db	'NOT AVAILABLE in DOS version !'
		db	V_BLINK
		STRSHOW	<,26,14,offset Cont_Str>
		db	0
		Public	Cont_Str		;R25
Cont_Str	db	'Press any key to continue...',0

ifndef	NO_HDD_LOW_LEVEL_FORMAT
No_HDD_Msg	Label	Near
		db	V_REVERSE
		BORDER1	<,22,11,57,15,Empty_Border>
		POS	<,24,12>
		db	'Hard Disk type is not specified!'
		db	V_BLINK
		STRSHOW	<,27,14,offset Cont_Str>
		db	0
endif	;NO_HDD_LOW_LEVEL_FORMAT

;R20 ifndef	Never_Disable_Password					;R18
;R20 Password_Disable_Str:
;R20 		db	V_REVERSE
;R20 		BORDER1	<,22,12,57,15,Empty_Border>
;R20 		POS	<,29,13>
;R20 		db	'PASSWORD DISABLED !!!  '
;R20 		db	V_BLINK
;R20 		STRSHOW	<,26,14,offset Cont_Str>
;R20 		db	0
;R20 endif	;Never_Disable_Password					;R18

	DETECT_IDE_MSG_Y	=	13

;R35 Detect_Ide_Screen:
;R35 		db	V_WARN
;R35 		BORDER1	<,LEFT_X,BLOCK_START_Y,RIGHT_X,END_Y,1+Empty_Border>
;R35 ;R12		POS	<,35,DETECT_IDE_MSG_Y+10>
;R35 ;R12		db	'ESC : Skip'
;R35 ;R12 start
;R35 		db	V_Hilite
;R35 ;R34		POS	<,8,DETECT_IDE_MSG_Y+10>
;R35 ;R34		db	'Note: Some OSes (like SCO-UNIX) must use "NORMAL" for installation'
;R35 ;R34 - start
;R35 		POS	<,4,DETECT_IDE_MSG_Y+10>				
;R35 		db	'Note: Some OSes(SCO-UNIX Before v5.0) must use "NORMAL" for installation'
;R35 ;R34 - end
;R35 		db	V_Normal
;R35 		POS	<,33,DETECT_IDE_MSG_Y+11>
;R35 		db	'µ ESC : Skip Æ'
;R35 ;R12 end
;R35 ifdef	Support_4_IDE					;R05
;R35 		STRSHOW	<,,,Offset CYL_HEAD_STR_1>	;R05
;R35 endif	;Support_4_IDE					;R05
;R35 		db	0
;R35 
;R35 Detect_Ide_Str:
;R35 		db	V_REVERSE
;R35 
;R35 ifdef	Support_4_IDE							;R05
;R35   BORDER1 <,7,DETECT_IDE_MSG_Y+1,74,DETECT_IDE_MSG_Y+9,0+Empty_Border>	;R05
;R35   POS	  <,26,DETECT_IDE_MSG_Y+2>					;R05
;R35   db	  'Auto-Detecting'						;R05
;R35   db	  ' '								;R05
;R35 else	;Support_4_IDE							;R05
;R35   BORDER1 <,3,DETECT_IDE_MSG_Y,76,DETECT_IDE_MSG_Y+9,0+Empty_Border>
;R35   POS	  <,26,DETECT_IDE_MSG_Y+2>
;R35   db	  'Auto-Detecting'
;R35 endif	;Support_4_IDE							;R05
;R35 
;R35 		CALLROUTINE	<,offset Print_Drive_Type>
;R35 		db	'...'
;R35 		db	0
;R35 
;R35 ifdef	IDE_LBA_MODE_SUPPORT
;R35 Ask_HDD_Option_Str:
;R35 		db	V_REVERSE
;R35 
;R35 	ifdef	Support_4_IDE						;R05
;R35 
;R35 		BORDER1	<,13,18,70,18,0>				;R05
;R35 		STRSHOW	<,19,17,offset CYL_HEAD_STR>			;R05
;R35 		POS	<,13,17>					;R05
;R35 		db	'OPTIONS'					;R05
;R35 		ADDX	<,6>						;R05
;R35 		db	'SIZE'						;R05
;R35 		POS	<,17,19>					;R05
;R35 		db	'(Y)'						;R05
;R35 		CLEAR	<,22,DETECT_IDE_MSG_Y+2,55,DETECT_IDE_MSG_Y+2>	;R05
;R35 		POS	<,20,DETECT_IDE_MSG_Y+2>			;R05
;R35 		db	'Select '					;R05
;R35 
;R35 	else	;Support_4_IDE						;R05
;R35 
;R35 		BORDER1	<,5,18,73,18,0>
;R35 		STRSHOW	<,7,17,offset CYL_HEAD_STR>
;R35 		POS	<,5,17>
;R35 		db	'OPTIONS'
;R35 		ADDX	<,5>
;R35 		db	'SIZE'
;R35 		POS	<,8,19>
;R35 		db	'(Y)'
;R35 		CLEAR	<,22,DETECT_IDE_MSG_Y+2,55,DETECT_IDE_MSG_Y+2>
;R35 		POS	<,23,DETECT_IDE_MSG_Y+2>
;R35 		db	'Select'
;R35 
;R35 	endif	;Support_4_IDE						;R05
;R35 
;R35 		CALLROUTINE	<,offset Print_Drive_Type>
;R35 		db	' Option (N=Skip) : ',0
;R35 
;R35 else	;IDE_LBA_MODE_SUPPORT
;R35 
;R35 Accept_Str:
;R35 		db	V_REVERSE
;R35 		POS	<,22,DETECT_IDE_MSG_Y+2>
;R35 		db	'  Do you accept this drive (Y/N)? '
;R35 		db	0
;R35 endif	;IDE_LBA_MODE_SUPPORT

Wait_Key_Str:
		db	V_NORMAL,V_BLINK
		STRSHOW	<,22,22,offset Cont_Str>
		db	0

Blank_4		db	'    ',0

ifndef	NO_HDD_LOW_LEVEL_FORMAT						;R06
HDD_Name_Str:
		BORDER1	<,0,3,79,24,1+Empty_Border>
	ifdef	Support_4_IDE						;R06
		STRSHOW	<,5,17,SnameKc>					;R06
		STRSHOW	<,5,18,SnameKd>					;R06
		STRSHOW	<,5,19,SnameKe>					;R06
		STRSHOW	<,5,20,SnameKf>					;R06
		POS	<,31,16>					;R06
		db	'SIZE'						;R06
		STRSHOW	<,24,16,offset CYL_HEAD_STR>			;R06
	else	;Support_4_IDE						;R06
		STRSHOW	<,5,18,SnameKc>
		STRSHOW	<,5,19,SnameKd>
	endif	;Support_4_IDE						;R06
		db	0
endif	;NO_HDD_LOW_LEVEL_FORMAT					;R06

Std_Clr_Str	db	V_NORMAL
		CLEAR	<,22,11,57,15>
		db	0

Std_Clr_Str1	db	V_NORMAL
		CLEAR	<,18,11,61,15>
		db	0

Load_BIOS_D4_Str:
		db	V_REVERSE
		BORDER1	<,22,11,57,15,1+Empty_Border>
		POS	<,26,13>
;R15		db	'Load  BIOS Defaults (Y/N)? '
		STRSHOW	<,,,offset LoadBiosD4Str>	;R15
		db	' (Y/N)? '			;R15
		db	0

Load_SETUP_D4_Str:

		STRSHOW	<,,,offset Load_BIOS_D4_Str>
		POS	<,31,13>
		db	'SETUP'
		ADDX	<,17>
		db	0
;R31 start
;R31bifndef Flash_16K_8K_8K_Unit	  ;R31a
ifdef  Backup_CMOS_to_FLASH
CMOS_TO_BIOS_Str:
		db	V_REVERSE
		BORDER1	<,22,11,57,15,1+Empty_Border>
		POS	<,26,13>
		STRSHOW	<,,,offset Save_CMOS_TO_BIOS_Str>
		db	' (Y/N)? '			
		db	0

CMOS_From_BIOS_Str:
		db	V_REVERSE
		BORDER1	<,22,11,57,15,1+Empty_Border>
		POS	<,26,13>
		STRSHOW	<,,,offset Load_CMOS_From_BIOS_Str>
		db	' (Y/N)? '	 
		db	0
endif  ;Backup_CMOS_to_FLASH
;R31bendif  ; Flash_16K_8K_8K_Unit	  ;R31a
;R31 end

;************************************************************************
;*									*
;*									*
;*									*
;*			SUBROUTINES					*
;*									*
;*									*
;*									*
;************************************************************************

;[]===========================================================[]
;[]===========================================================[]
Do_K_ESC	Proc	Near
		cmp	LAST_KEY[bp],K_ESC1
		je	short @F
		clc
		ret
@@:
		cmp	word ptr PAGE_START[bp],offset Kernal_Start	;kernal ?
		jne	short @F

Call_Exit_NoSave:					;setup from DOS

		call	Do_Exit_NoSave
		clc
		ret
@@:
		call	Goto_Kernal
		ret
Do_K_ESC	Endp
;[]===========================================================[]
;[]===========================================================[]
Goto_Kernal	Proc	Near
		mov	byte ptr Post_Auto_type[bp],46		;R01
		mov	byte ptr KERNAL_CONTROL[bp],0
		mov	al,PAGE_KERNAL
		call	Init_Page
		ret
Goto_Kernal	Endp

;[]===========================================================[]
;[]===========================================================[]
Goto_Std_CMOS	Proc	Near
		mov	byte ptr Post_Auto_type[bp],47		;R01
		mov	al,PAGE_STDCMOS
		call	Init_Page
		ret
Goto_Std_CMOS	Endp

;[]===========================================================[]
;[]===========================================================[]
Goto_BIOS_Feature	Proc	Near
		mov	al,PAGE_BFEATURE
		call	Init_Page
		ret
Goto_BIOS_Feature	Endp

;[]===========================================================[]
;[]===========================================================[]
Goto_Chip_Feature	Proc	Near
		mov	al,PAGE_CFEATURE
		call	Init_Page
		ret
Goto_Chip_Feature	Endp

;[]===========================================================[]
;[]===========================================================[]
Goto_PM_Feature	Proc	Near
		mov	al,PAGE_PFEATURE
		call	Init_Page
		ret
Goto_PM_Feature	Endp

;[]===========================================================[]
;[]===========================================================[]
Goto_PCI_Feature	Proc	Near
		mov	al,PAGE_PCI
		call	Init_Page
		ret
Goto_PCI_Feature	Endp

;R14A ifdef	NEW_PNP_SETUP	;R14
;[]===========================================================[]
;[]===========================================================[]
Goto_PNP_Feature	Proc	Near
		mov	al,PAGE_PNP
		call	Init_Page
		ret
Goto_PNP_Feature	Endp
;R14A endif	;NEW_PNP_SETUP

;[]===========================================================[]
;R16 - start
;[]===========================================================[]
ifdef	NEW_IO_FEATURE
Goto_IO_Feature	Proc	Near
		mov	al,PAGE_IO
		call	Init_Page
		ret
Goto_IO_Feature	Endp
endif	;NEW_IO_FEATURE
;r22 start
ifdef RPB_FEATUREPAGE_ENABLED       ; RXX
Goto_RPB_Feature	Proc	Near
		mov	al,PAGE_RPBFEAT
		call	Init_Page
		ret
Goto_RPB_Feature	Endp
endif ; RPB_FEATUREPAGE_ENABLED
;r22 end
;R32 - start
ifdef	NEW_CPU_FEATURE				
;[]===========================================================[]
; CPU internal frequency
;[]===========================================================[]
Goto_CPU_Feature	Proc	Near
		mov	al,PAGE_CPU
		call	Init_Page
		ret
Goto_CPU_Feature	Endp
endif;	NEW_CPU_FEATURE				
;R32 - end

;[]===========================================================[]
;R16 - end
;[]===========================================================[]
Do_Exit_NoSave	Proc	Near
		mov	si,offset Exit_NoSave_Msg
		call	Display_String

ifdef	EXIT_D4_YES						;R33
		clc				;default YES	;R33
else;	EXIT_D4_YES						;R33
		stc				;default no
endif;	EXIT_D4_YES						;R33

		call	Ask_Confirm
		jnz	short @F		;ESC is pressed
		jnc	short Exit_And_NoSave
@@:
		jmp	Show_Std_Clr_And_Exit
Exit_And_NoSave:
		mov	sp,STACK_POINTER[bp]
		jmp	Yes_Exit

Do_Exit_NoSave	Endp

;[]===========================================================[]
;[]===========================================================[]
Do_Save_Exit	Proc	Near

		cmp	ax,K_F10
		je	short Do_Save_Exit1
Dont_Exit:
		ret
;------------------------------------------------------------------------
Do_Save_Exit1:
		cmp	word ptr PAGE_START[bp],offset KERNAL_START
		jne	short Dont_Exit
Do_Save_Exit2:

		mov	si,offset Save_Exit_Msg
		call	Display_String

ifdef	SAVE2CMOS_D4_YES					;R33
		clc				;default YES	;R33
else;	SAVE2CMOS_D4_YES					;R33
		stc				;default NO
endif;	SAVE2CMOS_D4_YES					;R33

		call	Ask_Confirm
		jnz	short @F		;ESC pressed
		jnc	short Save_And_Exit	;'Y'
@@:
		jmp	Show_Std_Clr_And_Exit
Save_And_Exit:

 		cmp	byte ptr CALLTYPE[bp],DOS_CALL
		jne	short Save_And_Exit1
		mov	si,offset Ask_Reboot
		call	Display_String

		stc				;default no
		call	Ask_Confirm		;ask user for Y/N
		jz	short @F
		call	Refresh_Menu1
		jmp	short Do_Save_Exit2	;ESC pressed!
@@:
		jc	short Save_And_Exit1	;'N' i.e. user doesn't want to reboot
		mov	byte ptr CALLTYPE[bp],POST_CALL
		mov	ax,offset redo
		push	ax
		jmp	Write_Out_Cmos

Save_And_Exit1:

;R21A;R21 - start
;R21Aifdef	Special_Handler_After_Setup_Saved
;R21A		extrn	Setup_Saved_Handler:far
;R21A		far_call	EGROUP:Setup_Saved_Handler, 0E000h
;R21Aendif	;Special_Handler_After_Setup_Saved
;R21A;R21 - end
ifdef	Set_Value_at_Save_and_Exit_Cmos_For_Superio		;R26
		call	Immediate_Set_Value_For_Superio		;R26
endif;	Set_Value_at_Save_and_Exit_Cmos_For_Superio		;R26

		mov	sp,STACK_POINTER[bp]
		jmp	Write_Out_Cmos

Do_Save_Exit	Endp

Ask_Reboot	label	near
		db	V_REVERSE
		POS	<,54,13>
		db	'Y'
		BORDER1	<,29+4,14,55+4,18,Empty_Border>
		POS	<,32+4,16>
		db	'Reboot System (Y/N)? '
		db	0

;R35 - starts
ifndef	NO_HDD_LOW_LEVEL_FORMAT
HDD_LFormat	Proc	Near

 		call	Not_For_Modbin
		call	far ptr fProc_HDD_LFormat
 		jmp	Destroy_Key_Then_Ret

HDD_LFormat	Endp
endif	;NO_HDD_LOW_LEVEL_FORMAT

;[]===========================================================[]
;[]===========================================================[]
IDE_Detect	Proc	Near

		call	Not_For_Modbin
		call	far ptr fProc_IDE_Detect
 		jmp	Destroy_Key_Then_Ret

IDE_Detect	Endp

Show_Not_Avail	Label	Near
		call	Display_String
		call	key
		jmp	Show_Std_Clr_And_Exit

Prn_CYL_HEAD_STR	Proc	Near
		call	far ptr fPROC_Prn_CYL_HEAD_STR
		ret
Prn_CYL_HEAD_STR	Endp

Print_Drive_Type	Proc	Near
		call	far ptr fPROC_Print_Drive_Type
		ret
Print_Drive_Type	Endp
;R35 - ends

;R35 ifndef	NO_HDD_LOW_LEVEL_FORMAT
;R35 ;[]===========================================================[]
;R35 ;[]===========================================================[]
;R35 HDD_LFormat	Proc	Near
;R35 
;R35 ;R20		cmp	byte ptr CALLTYPE[bp],POST_CALL
;R35 ;R20		je	short @F
;R35 ;R20		mov	si,offset Not_Available_Msg
;R35 ;R20		jmp	short Show_Not_Avail
;R35 ;R20@@:
;R35 		call	Not_For_Modbin			;R20
;R35 		jmp	short @F			;R23
;R35 
;R35 ;R23		cmp	word ptr CMOS19[bp],0
;R35 ;R23		jne	short @F
;R35 ;R23		mov	si,offset No_HDD_Msg
;R35 
;R35 endif	;NO_HDD_LOW_LEVEL_FORMAT
;R35 
;R35 Show_Not_Avail:
;R35 		call	Display_String
;R35 		call	key
;R35 		jmp	Show_Std_Clr_And_Exit
;R35 
;R35 ifndef	NO_HDD_LOW_LEVEL_FORMAT
;R35 @@:
;R35 		push	bx
;R35 		call	VNormal
;R35 		mov	si,offset HDD_Name_Str
;R35 		call	Display_String
;R35 		mov	byte ptr USE_ITEMSTAT_BUF[bp],2
;R35 		mov	bx,offset hddc_item
;R35 		call	ReShow_HDD
;R35 		mov	bx,offset hddd_item
;R35 		call	ReShow_HDD
;R35 	ifdef	Support_4_IDE						;R06
;R35 		mov	bx,offset hdde_item				;R06
;R35 		call	ReShow_HDD					;R06
;R35 		mov	bx,offset hddf_item				;R06
;R35 		call	ReShow_HDD					;R06
;R35 	endif	;Support_4_IDE						;R06
;R35 		mov	byte ptr USE_ITEMSTAT_BUF[bp],0
;R35 		pop	bx
;R35 ifndef	DOSVERSION
;R35 		POST_func_call	Low_Format
;R35 endif	;DOSVERSION
;R35 
;R35 		call	Refresh_Menu1
;R35 Low_Format_Exit:
;R35 		jmp	Destroy_Key_Then_Ret
;R35 
;R35 HDD_LFormat	Endp
;R35 endif	;NO_HDD_LOW_LEVEL_FORMAT

;R20 - starts
		Public	Not_For_Modbin
Not_For_Modbin	Proc	Near
		cmp	byte ptr CALLTYPE[bp],POST_CALL
		je	short @F
		pop	si				;kill stack
		mov	si,offset Not_Available_Msg
		jmp	short Show_Not_Avail
@@:
		ret
Not_For_Modbin	Endp
;R20 - ends

;R35 ;[]===========================================================[]
;R35 ;[]===========================================================[]
;R35 IDE_Detect	Proc	Near
;R35 
;R35 	;------------------------------
;R35 
;R35 ;R20		cmp	byte ptr CALLTYPE[bp],POST_CALL
;R35 ;R20		je	short @F
;R35 ;R20		mov	si,offset Not_Available_Msg
;R35 ;R20 		jmp	short Show_Not_Avail
;R35 ;R20	@@:
;R35 		call	Not_For_Modbin			;R20
;R35 
;R35 		lea	si,Detect_Ide_Screen
;R35 		call	Display_String
;R35 
;R35 	;------------------------------
;R35 
;R35 		push	ds
;R35 		push	es
;R35 
;R35 ;R19A		and	byte ptr CDROM_Exist_Flag[bp],not (PM_CDROM+PS_CDROM+SM_CDROM+SS_CDROM)	;R19
;R35 		Post_func_call	Reset_HDD_controller		;R11A
;R35 comment %						;R11A
;R35 ;R11 start
;R35 		mov	dx,3f6h
;R35 		mov	al,04				; assert reset
;R35 		out	dx,al
;R35 ifdef	Support_4_IDE
;R35 		newiodelay
;R35 		sub	dx,80h
;R35 		out	dx,al
;R35 		newiodelay
;R35 endif	;Support_4_IDE
;R35 
;R35 		mov	cx,21h
;R35 		align	4
;R35 		loop	short $
;R35 
;R35 		xor	al,al			; deassert reset
;R35 		out	dx,al
;R35 ifdef	Support_4_IDE
;R35 		newiodelay
;R35 		add	dx,80h
;R35 		out	dx,al
;R35 		newiodelay
;R35 endif	;Support_4_IDE
;R35 ;R11 end
;R35 %							;R11A
;R35 		mov	cx,NUM_OF_IDE_ITEM
;R35 ;R12 - start
;R35 ifdef	IDE_PRIMARY_ONLY		
;R35 		shr	cx,1
;R35 endif	;IDE_PRIMARY_ONLY		
;R35 ;R12 - end
;R35 		mov	bx,offset HDDC_ITEM
;R35 Detect_Next_HDD:
;R35 
;R35 		mov	KEYIN_BUF[bp+9],cl
;R35 		push	cx
;R35 		push	bx
;R35 		call	Detect_Drive
;R35 		pop	bx
;R35 		jc	short @F
;R35 		mov	word ptr LAST_KEY[bp],K_PLUS
;R35 		call	Skip_HDD_Type
;R35 	@@:
;R35 		pop	cx
;R35 
;R35 		add	bx,HDD_TYPE_DIFF
;R35 ;R12 - start
;R35 ifdef	IDE_PRIMARY_ONLY		
;R35 		add	bx,HDD_TYPE_DIFF
;R35 endif	;IDE_PRIMARY_ONLY		
;R35 ;R12 - end
;R35 		loop	short Detect_Next_HDD
;R35 
;R35 		call	Refresh_Menu1
;R35 		pop	es
;R35 		pop	ds
;R35 
;R35 		jmp	Destroy_Key_Then_Ret
;R35 
;R35 IDE_Detect	Endp
;R35 
;R35 ;[]===========================================================[]
;R35 ;input	:	bx = HDD type item offset
;R35 ;[]===========================================================[]
;R35 Detect_Drive	Proc	Near
;R35 
;R35 ;-----------------------------------------------
;R35 ;save HDD type & user type info
;R35 ;-----------------------------------------------
;R35 
;R35 		lea	si,Detect_Ide_Str
;R35 		call	Display_String
;R35 
;R35 		push	word ptr CMOS3B[bp]
;R35 		push	word ptr CMOS_LBA_LGA[bp]
;R35 
;R35 		call	Get_HDD_CMOS_Info		;DX = HDD type item offset
;R35 							;SI = HDD type loc.
;R35 							;DI = HDD params loc.
;R35 		push	word ptr FIXED_TYPE[bp]
;R35 		push	word ptr [bp+si]		;save hdd type
;R35 
;R35 		mov	ax,di
;R35 		mov	cx,8				;save HDD params
;R35 	@@:
;R35 		push	word ptr [bp+di]
;R35 		add	di,2
;R35 		loop	@B
;R35 		mov	di,ax
;R35 
;R35 ;---------------------------------------------------
;R35 
;R35 		ALIGN	16
;R35 
;R35 ifdef	IDE_LBA_MODE_SUPPORT
;R35 		mov	word ptr KEYIN_BUF[bp+0],('n' shl 8) + 'N'
;R35 		mov	word ptr KEYIN_BUF[bp+2],('y' shl 8) + 'Y'
;R35 		mov	word ptr KEYIN_BUF[bp+4],( 0  shl 8) + '1'
;R35 		mov	byte ptr KEYIN_BUF[bp+6],0
;R35 endif	;IDE_LBA_MODE_SUPPORT
;R35 
;R35 		mov	word ptr IDE_Detect_Skip_Key[bp],K_ESC1	;R02 Skip key is 'ESC'
;R35 		POST_func_call	Auto_IDE_Detect_X
;R35 
;R35 	;------------------------------------------------------------
;R35 	;Show disk drive C parameters according auto-detection result
;R35 	;------------------------------------------------------------
;R35 
;R35 
;R35 ifdef	IDE_LBA_MODE_SUPPORT
;R35 
;R35 ;R07		xor	al,al				;show CHS
;R35 ;R07		mov	byte ptr USE_ITEMSTAT_BUF[bp],19
;R35 ;R07		push	dx
;R35 ;R07		call	Disp_HDD_Option
;R35 ;R07		pop	dx
;R35 ;R07	;----------------
;R35 ;R07		test	dh,02h				;LBA mode support?
;R35 ;R07		jz	short No_LBA			;no, skip!
;R35 ;R07
;R35 ;R07		inc	byte ptr USE_ITEMSTAT_BUF[bp]
;R35 ;R07		mov	al,1				;show LBA
;R35 ;R07		call	Disp_HDD_Option
;R35 ;R07		mov	byte ptr KEYIN_BUF[bp+5],'2'
;R35 ;R07	No_LBA:
;R35 ;R07	;----------------
;R35 
;R35 ;R07 - starts
;R35 		mov	byte ptr USE_ITEMSTAT_BUF[bp],19
;R35 		mov	byte ptr KEYIN_BUF[bp+7],0	;'Y' choose CHS
;R35 
;R35 		test	dh,02h				;LBA mode support?
;R35 		jz	short No_LBA			;no, skip!
;R35 		mov	byte ptr KEYIN_BUF[bp+7],1	;'Y' choose LBA
;R35 
;R35 		mov	al,1				;show LBA
;R35 		mov	ah,1
;R35 		call	Disp_HDD_Option
;R35 		inc	byte ptr USE_ITEMSTAT_BUF[bp]
;R35 		mov	byte ptr KEYIN_BUF[bp+5],'2'
;R35 	No_LBA:
;R35 		xor	al,al				;show CHS
;R35 		call	Disp_HDD_Option
;R35 ;R07 - ends
;R35 
;R35 		call	Get_HDD_CMOS_Info		;SI = HDD type loc.
;R35 		cmp	word ptr [bp+di],1024
;R35 		jbe	short NO_LARGE
;R35 
;R35 		inc	byte ptr USE_ITEMSTAT_BUF[bp]
;R35 		mov	al,2				;show LARGE
;R35 		call	Disp_HDD_Option
;R35 		mov	byte ptr KEYIN_BUF[bp+6],'3'
;R35 	NO_LARGE:
;R35 	;----------------
;R35 
;R35 		mov	si,offset Ask_HDD_Option_Str
;R35 		call	Display_String
;R35 
;R35 		mov	cx,7
;R35 		call	Ask_Inputs
;R35 
;R35 		jnz	short Not_Replace_Drive	;ESC is pressed
;R35 ;R07		mov	al,0
;R35 		mov	al,KEYIN_BUF[bp+7]	;R07
;R35 		jnc	short Disp_Opt		;'Y' is pressed
;R35 		cmp	si,1			;'N' is pressed	: si=0,1
;R35 		jbe	short Not_Replace_Drive	;'N' is pressed
;R35 		mov	ax,si
;R35 		sub	al,4
;R35 	Disp_Opt:
;R35 		and	al,03h
;R35 		mov	byte ptr USE_ITEMSTAT_BUF[bp],1		;tell show hdd routine to
;R35 		call	ReDisp_HDD
;R35 		jmp	short Replace_Drive
;R35 
;R35 else	;IDE_LBA_MODE_SUPPORT
;R35 
;R35 		mov	byte ptr USE_ITEMSTAT_BUF[bp],01h	;tell show hdd routine to
;R35 		call	ReDisp_HDD
;R35 		mov	byte ptr USE_ITEMSTAT_BUF[bp],00h
;R35 
;R35 		mov	si,offset Accept_Str
;R35 		call	Display_String
;R35 
;R35 		stc				;default 'N'
;R35 		call	Ask_Confirm
;R35 		jnz	short Not_Replace_Drive	;ESC is pressed
;R35 		jnc	short Replace_Drive	;NC = 'Y' is pressed
;R35 
;R35 endif	;IDE_LBA_MODE_SUPPORT
;R35 
;R35 
;R35 ;----------------------------------------------------
;R35 ;restore the saved HDD type & user defined parameters
;R35 ;----------------------------------------------------
;R35 Not_Replace_Drive:
;R35 		call	Get_HDD_CMOS_Info		;SI = HDD type loc.
;R35 							;DI = HDD param loc.
;R35 		mov	cx,8
;R35 		add	di,0Eh
;R35 	@@:
;R35 		pop	word ptr [bp+di]
;R35 		sub	di,2
;R35 		loop	@B
;R35 
;R35 		pop	word ptr [bp+si]
;R35 		pop	word ptr FIXED_TYPE[bp]
;R35 
;R35 		pop	word ptr CMOS_LBA_LGA[bp]
;R35 		pop	word ptr CMOS3B[bp]
;R35 
;R35 		stc
;R35 		jmp	short Detect_Drive_Exit
;R35 
;R35 ;----------------------------------------------------
;R35 ;accept the HDD found
;R35 ;----------------------------------------------------
;R35 Replace_Drive:
;R35 		clc
;R35 		add	sp,12*2
;R35 
;R35 Detect_Drive_Exit:
;R35 
;R35 		ret
;R35 
;R35 Detect_Drive	Endp
;R35 
;R35 Disp_HDD_Option	Proc	Near
;R35 		push	ax
;R35 		push	ax
;R35 		call	VReverse
;R35 		pop	ax
;R35 		mov	ah,USE_ITEMSTAT_BUF[bp]
;R35 		mov	CURSOR_Y[bp],ah
;R35 
;R35 ifdef	Support_4_IDE							;R05
;R35 		mov	byte ptr CURSOR_X[bp],16			;R05
;R35 else	;Support_4_IDE							;R05
;R35 		mov	byte ptr CURSOR_X[bp],7
;R35 endif	;Support_4_IDE							;R05
;R35 
;R35 		or	al,30h
;R35 		inc	al
;R35 		call	Display_Char
;R35 		pop	ax
;R35 		jmp	short ReDisp_HDD
;R35 Disp_HDD_Option	Endp
;R35 
;R35 ;----------------------------------------------------
;R35 ;input :	0 = show CHS
;R35 ;		1 = show LBA
;R35 ;		2 = show LARGE
;R35 ;----------------------------------------------------
;R35 ReDisp_HDD	Proc	Near
;R35 		call	Get_HDD_CMOS_Info			;DX = HDD type item
;R35 
;R35 ifdef	IDE_LBA_MODE_SUPPORT
;R35 		push	dx
;R35 		mov	bx,dx
;R35 		add	bx,HDD_TYPE_DIFF-ITEM_SIZE
;R35 		mov	dl,al
;R35 		xor	dh,dh
;R35 		call	Write_Item_Value
;R35 		pop	dx
;R35 endif	;IDE_LBA_MODE_SUPPORT
;R35 
;R35 		mov	bx,dx
;R35 		call	Disp_ItemTitle
;R35 		mov	byte ptr HDD_CURSOR_FLG[bp],0FFh
;R35 		call	ReShow_HDD
;R35 		mov	byte ptr HDD_CURSOR_FLG[bp],0
;R35 		ret
;R35 ReDisp_HDD	Endp
;R35 
;R35 Print_Drive_Type	Proc	Near
;R35 		pusha
;R35 
;R35 ifdef	Support_4_IDE					;R05
;R35 		mov	si,offset Drive_Str_Tbl		;R05
;R35 		mov	al,KEYIN_BUF[bp+9]		;R05
;R35 		dec	al				;R05
;R35 		xor	ah,ah				;R05
;R35 		shl	ax,1				;R05
;R35 		add	si,ax				;R05
;R35 		mov	si,cs:[si]			;R05
;R35 		call	Display_String			;R05
;R35 		sub	byte ptr CURSOR_X[bp],3		;R05
;R35 else	;Support_4_IDE					;R05
;R35 
;R35 		mov	si,offset DRIVE_Str
;R35 		call	Display_String
;R35 		mov	al,KEYIN_BUF[bp+9]
;R35 		not	al
;R35 		inc	al
;R35 		and	al,03h
;R35 ;R05	ifdef	Support_4_IDE
;R35 ;R05		add	al,43h
;R35 ;R05	else	;Support_4_IDE
;R35 		add	al,41h
;R35 ;R05	endif	;Support_4_IDE
;R35 		call	Display_Char
;R35 
;R35 endif	;Support_4_IDE					;R05
;R35 
;R35 		popa
;R35 		ret
;R35 Print_Drive_Type	Endp
;R35 
;R35 ifdef	Support_4_IDE					;R05
;R35 Drive_Str_Tbl:						;R05
;R35 ifndef	IDE_PRIMARY_ONLY				;R12
;R35 		dw	offset SnameKf			;R05
;R35 endif	;IDE_PRIMARY_ONLY				;R12
;R35 		dw	offset SnameKe			;R05
;R35 ifndef	IDE_PRIMARY_ONLY				;R12
;R35 		dw	offset SnameKd			;R05
;R35 endif	;IDE_PRIMARY_ONLY				;R12
;R35 		dw	offset SnameKc			;R05
;R35 else	;Support_4_IDE					;R05
;R35 DRIVE_Str	db	' Drive ',0
;R35 endif	;Support_4_IDE					;R05

ifdef	Double_Password

;[]===========================================================[]
;[]===========================================================[]
SuperPass_Set	PROC	NEAR
;R20		pusha
;R20		call	Do_Security
;R20		jnc	short @F
;R20		and	byte ptr CMOS11[bp],0FDh	;password invalid
;R20		or	cl,cl
;R20		jz	short @F
;R20		mov	word ptr CMOS1C[bp],ax		;write hashed password
;R20		or	byte ptr CMOS11[bp],02h		;password valid
;R20	@@:
;R20		popa
		call	Not_For_Modbin			;R20
		call	far ptr fProc_SuperPass_Set	;R20
		jmp	Show_Std_Clr_And_Exit
SuperPass_Set	ENDP

;[]===========================================================[]
;[]===========================================================[]
UserPass_Set	PROC	NEAR
;R20		pusha
;R20		call	Do_Security
;R20		jnc	short @F
;R20		call	Ct_User_Password_Location
;R20		not	dl
;R20		and	byte ptr [bp+si],dl		;password invalid
;R20		not	dl
;R20		or	cl,cl
;R20		jz	short @F
;R20		mov	word ptr [bp+di],ax		;write hashed password
;R20		or	byte ptr [bp+si],dl		;password valid
;R20	@@:
;R20		popa
		call	Not_For_Modbin			;R20
		call	far ptr fProc_UserPass_Set	;R20
		jmp	Show_Std_Clr_And_Exit
UserPass_Set	ENDP

else	;Double_Password

;[]===========================================================[]
;[]===========================================================[]
Password_Set	PROC	NEAR
;R20 		pusha
;R20 		call	Do_Security
;R20 		jnc	short @F
;R20 		and	byte ptr CMOS11[bp],0FDh	;password invalid
;R20 		or	cl,cl
;R20 		jz	short @F
;R20 ifdef	Perfect_Password				;R13
;R20 		call	Save_Perfect_Password		;R13
;R20 else	;Perfect_Password				;R13
;R20 		mov	word ptr CMOS1C[bp],ax		;write hashed password
;R20 endif	;Perfect_Password				;R13
;R20 		or	byte ptr CMOS11[bp],02h		;password valid
;R20 	@@:
;R20 		popa
		call	Not_For_Modbin			;R20
		call	far ptr fProc_Password_Set	;R20
		jmp	Show_Std_Clr_And_Exit
Password_Set	ENDP

;R36 - starts
ifdef	Password_PSON_By_Chipset
Password_PSON_Set	PROC	NEAR
		call	Not_For_Modbin
		call	far ptr fProc_KBPassword_Set
		jmp	Show_Std_Clr_And_Exit
Password_PSON_Set	ENDP
endif;	Password_PSON_By_Chipset
;R36 - ends

endif	;Double_Password

;R20 ;[]==============================================================[]
;R20 ;[]==============================================================[]
;R20 Do_Security	Proc	Near
;R20 
;R20 ;-----------------------------------------------
;R20 EnterPass:
;R20 		call	Get_Password			;handle password enter
;R20 
;R20 		jnc	short ConfirmPass
;R20 
;R20 		cmp	word ptr LAST_KEY[bp],K_ESC1	;if user escape	;sss
;R20 		je	short Security_Exit2		;yes, exit?	;sss
;R20 
;R20 ifdef	Never_Disable_Password					;R18
;R20 		jmp	short EnterPass				;R18
;R20 else	;Never_Disable_Password					;R18
;R20 		mov	si,offset Password_Disable_Str
;R20 		call	Display_String
;R20 		call	key
;R20 		xor	cl,cl	;indicates password cleared
;R20 		jmp	short EnterPass_Exit1
;R20 endif	;Never_Disable_Password					;R18
;R20 
;R20 ;-----------------------------------------------
;R20 ConfirmPass:
;R20 	ifdef	Perfect_Password			;R13A
;R20 		push	word ptr KEYIN_BUF[bp+6]	;R13A
;R20 		push	word ptr KEYIN_BUF[bp+4]	;R13A
;R20 		push	word ptr KEYIN_BUF[bp+2]	;R13A
;R20 		push	word ptr KEYIN_BUF[bp+0]	;R13A
;R20 	else	;Perfect_Password			;R13A
;R20 		push	ax				;save hashed result
;R20 	endif	;Perfect_Password			;R13A
;R20 		call	Confirm_Password
;R20 		jnc	short @F
;R20 	ifdef	Perfect_Password			;R13A
;R20 		add	sp,8				;R13A
;R20 	else	;Perfect_Password			;R13A
;R20 		pop	ax
;R20 	endif	;Perfect_Password			;R13A
;R20 		jmp	short EnterPass
;R20 @@:
;R20 ;R13A start
;R20 	ifdef	Perfect_Password
;R20 		xor	si,si
;R20 		xor	dl,dl		;assume	compare complete
;R20 Cmp_Password_loop:
;R20 		test	si,1
;R20 		jnz	short @F
;R20 		pop	ax
;R20 @@:
;R20 		or	al,al		;String end?
;R20 		jnz	short @F	;No,jump
;R20 		or	dl,1		;compare complete
;R20 @@:
;R20 		or	dl,dl		;compare complete?
;R20 		jnz	short @F	;Yes,jump
;R20 		cmp	al,KEYIN_BUF[bp+si]
;R20 		je	short @F
;R20 		or	dl,2
;R20 @@:
;R20 		shr	ax,8
;R20 		inc	si
;R20 		cmp	si,8
;R20 		jb	short Cmp_Password_loop
;R20 		test	dl,2		;twise enter string is equal?
;R20 		jnz	short EnterPass	;No,jump
;R20 	else	;Perfect_Password				
;R20 ;R13A end
;R20 		pop	dx				;restore hashed result
;R20 		cmp	ax,dx
;R20 		jne	short EnterPass
;R20 	endif	;Perfect_Password			;R13A
;R20 
;R20 		mov	cl,1	;indicates password set
;R20 
;R20 EnterPass_Exit1:
;R20 
;R20 		stc
;R20 		ret
;R20 
;R20 Security_Exit2:
;R20 		clc
;R20 		ret
;R20 
;R20 Do_Security	Endp

;[]===========================================================[]
;[]===========================================================[]
Load_BIOS_Default	Proc	Near
		mov	si,offset Load_BIOS_D4_Str
		mov	di,RomDefault
		call	Load_Default
		ret
Load_BIOS_Default	Endp

;[]===========================================================[]
;[]===========================================================[]
Load_SETUP_Default	Proc	Near
		mov	si,offset Load_SETUP_D4_Str
		mov	di,SetupDef
		call	Load_Default
		ret
Load_SETUP_Default	Endp

;R31 start
;R31bifndef Flash_16K_8K_8K_Unit	  ;R31a
ifdef  Backup_CMOS_to_FLASH
Load_CMOS_From_BIOS_Default	Proc	Near
		mov	si,offset  CMOS_From_BIOS_Str
		mov	di,RomDefault
		mov     dh,05h 
	       	call	CMOS_Load_Default
		ret
Load_CMOS_From_BIOS_Default	Endp

;[]===========================================================[]
;[]===========================================================[]
Save_CMOS_TO_BIOS_Default	Proc	Near
		mov	si,offset CMOS_TO_BIOS_Str
		mov	di,SetupDef
	      	mov     dh,0aah 
	       	call	CMOS_Load_Default
		ret
Save_CMOS_TO_BIOS_Default       Endp

;[]===========================================================[]
CMOS_Load_Default	Proc	Near
		push    dx     
       		call	Display_String			;display message
      		stc		     			;default NO
     		call	Ask_Confirm			;ask for Y/N
    		pop     dx          
   		jnz    	short Load_D4_Exit       	;ESC pressed
  		jc      short Load_D4_Exit		;'N' pressed
	  	Xcall    Check_Flash_CMOS   
 	  	call	Goto_Kernal			;initial page 0
;Load_CMOS_D4_Exit:
	      	mov	si,offset Std_Clr_Str		;clear block
	      	call	Display_String			;clear blocl
	      	call	Refresh_Menu			;re-display screen
		jmp	Destroy_Key_Then_Ret
CMOS_Load_Default	Endp
endif ;Backup_CMOS_to_FLASH
;R31bendif ; Flash_16K_8K_8K_Unit	  ;R31a
;R31 end

;[]===========================================================[]
;[]===========================================================[]
Load_Default	Proc	Near
		call	Display_String			;display message
		stc					;default NO
		call	Ask_Confirm			;ask for Y/N
		jnz	short Load_D4_Exit		;ESC pressed
		jc	short Load_D4_Exit		;'N' pressed
ifndef	LoadD4_from_STDCMOS				;R27
		mov	cx,3				;started form BIOS features
else	;LoadD4_from_STDCMOS				;R27
		mov	cx,2				;R27 started form STDCMOS
endif	;LoadD4_from_STDCMOS				;R27
		call	Load_All_Default		;load all defaults
		call	Goto_Kernal			;initial page 0

Show_Std_Clr_And_Exit:
Load_D4_Exit:
		mov	si,offset Std_Clr_Str		;clear block
		call	Display_String			;clear blocl
		call	Refresh_Menu			;re-display screen
		jmp	Destroy_Key_Then_Ret
Load_Default	Endp

;r22 start
ifdef RPB_POSTMENU_ENABLED          ; RXX
; Enable this code if RPB post menu is desired
  include rpb_menu.inc              ; RPB Post Menu
endif
;r22 end

;R28E start
Show_BUS_ID_STR:
		push	ds
		push	si

		push	DGROUP
		pop	ds
		lea	si,BUS_ID_STR
		call	Display_String

		pop	si
		pop	ds
		ret

Show_BIOS_ID_NUMBER:
		push	ds
		push	si

		push	DGROUP
		pop	ds
		lea	si,BIOS_ID_NUMBER
		call	Display_String

		pop	si
		pop	ds
		ret
;R28E end

FCODE		ENDS

;R20 - starts
.386p
EGROUP		GROUP	ECODE
ECODE		SEGMENT USE16 PARA PUBLIC 'ECODE'
		ASSUME	CS:EGROUP,DS:NOTHING,ES:NOTHING

ifdef	Double_Password
;[]===========================================================[]
;[]===========================================================[]
fProc_SuperPass_Set	PROC	Far
		pusha
		call	Do_Security
		jnc	short @F
		and	byte ptr CMOS11[bp], 0FDh	;password invalid
		or	cl, cl
		jz	short @F
		mov	word ptr CMOS1C[bp], ax		;write hashed password
		or	byte ptr CMOS11[bp], 02h		;password valid
	@@:
		popa
		ret
fProc_SuperPass_Set	ENDP

;[]===========================================================[]
;[]===========================================================[]
fProc_UserPass_Set	PROC	Far

		pusha
		call	Do_Security
		jnc	short @F
		F000_call	Ct_User_Password_Location
		not	dl
		and	byte ptr [bp+si], dl		;password invalid
		not	dl
		or	cl, cl
		jz	short @F
		mov	word ptr [bp+di], ax		;write hashed password
		or	byte ptr [bp+si], dl		;password valid
	@@:
		popa
		ret

fProc_UserPass_Set	ENDP

else	;Double_Password

;[]===========================================================[]
;[]===========================================================[]
fProc_Password_Set	Proc	Far
		pusha
		call	Do_Security
		jnc	short @F
		and	byte ptr CMOS11[bp], 0FDh	;password invalid
		or	cl, cl
		jz	short @F
	ifdef	Perfect_Password
		call	Save_Perfect_Password
	else	;Perfect_Password
		mov	word ptr CMOS1C[bp], ax		;write hashed password
	endif	;Perfect_Password
		or	byte ptr CMOS11[bp], 02h	;password valid
	@@:
		popa
		ret
fProc_Password_Set	Endp
;R36 - starts
ifdef Password_PSON_By_Chipset
fProc_KBPassword_Set	Proc	Far

		pusha
		call	Do_Security
		test	cl,01h		;;;security set ?
		jnz	short @f
		mov	al,81h		
		out	72h,al
		mov	al,00h		;;no
		out	73h,al

@@:
		test	byte ptr CMOS11[bp], 002h	;password set
		jnz	short @f			

		and	byte ptr CMOS11[bp], 0FDh	;password invalid	
@@:
	ifdef	Perfect_Password
		call	Save_Perfect_Password
	endif	;Perfect_Password
		popa
		ret
fProc_KBPassword_Set	Endp
endif; Password_PSON_By_Chipset	
;R36 - ends
endif	;Double_Password

;[]==============================================================[]
;[]==============================================================[]
Do_Security	Proc	Near

		push	ds

		mov	ax, DGROUP
		mov	ds, ax
		ASSUME	DS: DGROUP

;-----------------------------------------------
EnterPass:
		call	Get_Password			;handle password enter
		jnc	short ConfirmPass

		cmp	word ptr LAST_KEY[bp], K_ESC1	;if user escape
		je	short Security_Exit2		;yes, exit?

ifdef	Never_Disable_Password
		jmp	short EnterPass
else	;Never_Disable_Password
		mov	si, offset Password_Disable_Str
		call	Display_CS_String
		mov	si, offset Cont_Str
		call	F000_Display_String
		F000_call key
		xor	cl, cl				;indicates password cleared
		jmp	short EnterPass_Exit1
endif	;Never_Disable_Password

;-----------------------------------------------
ConfirmPass:

	ifdef	Perfect_Password
		push	word ptr KEYIN_BUF[bp+6]
		push	word ptr KEYIN_BUF[bp+4]
		push	word ptr KEYIN_BUF[bp+2]
		push	word ptr KEYIN_BUF[bp+0]
	else	;Perfect_Password
		push	ax				;save hashed result
	endif	;Perfect_Password
		call	Confirm_Password
		jnc	short @F
	ifdef	Perfect_Password
		add	sp, 8
	else	;Perfect_Password
		pop	ax
	endif	;Perfect_Password
		jmp	short EnterPass
	@@:

	ifdef	Perfect_Password
		xor	si, si
		xor	dl, dl		;assume	compare complete

	Cmp_Password_loop:

		test	si, 1
		jnz	short @F
		pop	ax
	@@:
		or	al, al		;String end?
		jnz	short @F	;No, jump
		or	dl, 1		;compare complete
	@@:
		or	dl, dl		;compare complete?
		jnz	short @F	;Yes, jump
		cmp	al, KEYIN_BUF[bp+si]
		je	short @F
		or	dl, 2
	@@:
		shr	ax, 8
		inc	si
		cmp	si, 8
		jb	short Cmp_Password_loop
		test	dl, 2		;twise enter string is equal?
		jnz	short EnterPass	;No, jump

	else	;Perfect_Password

		pop	dx				;restore hashed result
		cmp	ax, dx
		jne	short EnterPass

	endif	;Perfect_Password

		mov	cl, 1	;indicates password set

EnterPass_Exit1:
		pop	ds
		stc
		ret

Security_Exit2:
		pop	ds
		clc
		ret

Do_Security	Endp

ifndef	Never_Disable_Password
		Public	Password_Disable_Str	;R25
Password_Disable_Str:
		db	V_REVERSE
		BORDER1	<, 22, 12, 57, 15, Empty_Border>
		POS	<, 29, 13>
		db	'PASSWORD DISABLED !!!  '
		db	V_BLINK
		POS	<, 26, 14>
		db	0
endif	;Never_Disable_Password
ECODE		ENDS
;R20 - ends

;R28D start
XGROUP		GROUP	XCODE
XCODE		SEGMENT USE16 PARA PUBLIC 'XCODE'
		ASSUME	CS:XGROUP,ES:XGROUP
MIB_Screen:
		db	V_WARN
		CLEAR	<,0,0,80,25>
		BORDER1	<,LEFT_X,BLOCK_START_Y,RIGHT_X,END_Y,1+Empty_Border>
;R30		POS	<,2,24>
;R30		db	'µ ESC : Quit ,   PgUp PgDn : Scroll Line/Page , (Shift)F2 : Change Color Æ'
;R30 start
ifdef MIB_Print
		POS	<,3,24>
		db	'µ ESC:Quit   //PgUp/PgDn:Scroll Line/Page   F2:Change Color   F7:Print Æ'
else
		POS	<,9,24>
		db	'µ ESC:Quit   //PgUp/PgDn:Scroll Line/Page   F2:Change Color Æ'
endif	;MIB_Print
;R30 end


		POS	<,28,BIOS_ID_Y>
		db	V_NORMAL,'ROM '
;R28E		STRSHOW	<,,,offset BUS_ID_STR>
		CALLROUTINE	<,offset Show_BUS_ID_STR>	;R28E
		db	' BIOS '
		db	'('
;R28E		STRSHOW	<,,,offset BIOS_ID_NUMBER>
		CALLROUTINE	<,offset Show_BIOS_ID_NUMBER>	;R28E
		db	')'

		POS	<,33,PAGE_NAME_Y>
		db	'MENU IN BIOS '
		POS	<,30,AWARD_NAME_Y>
		db	'AWARD SOFTWARE, INC.'

		POS	<,1,4>
		db	V_HILITE
		db	0

MIB_key		db	V_WARN
		POS	<,15,18>
		db	'F5 : Menu in BIOS'
		db	0
;R31 start
;R31bifndef Flash_16K_8K_8K_Unit	  ;R31a
ifdef	Backup_CMOS_to_FLASH

S_CMOS_TO_BIOS		db	V_WARN
			POS	<,2,20>
			db	'F6  : SAVE CMOS TO BIOS'
			db	0


L_CMOS_FROM_BIOS        db	V_WARN
			POS	<,42,20>
			db	'F7  : LOAD CMOS FROM BIOS'
			db	0
endif	;Backup_CMOS_to_FLASH
;R31bendif   ; Flash_16K_8K_8K_Unit	  ;R31a
;R31 end

;R29 - starts
;************************************************************************
;*									*
;*									*
;*									*
;*			HELP STRINGS					*
;*									*
;*									*
;*									*
;************************************************************************
Std_CMOS_Help		POS	<,27,22>
			db 	'Time, Date, Hard Disk Type...',0

BIOS_Feature_Help	POS	<,24,22>
			db 	'Virus Protection, Boot Sequence...',0

Chip_Feature_Help	POS	<,28,22>
			db 	'AT clock, DRAM timings...',0

PCI_Feature_Help	POS	<,26,22>
			db 	'IRQ Settings, Latency Timers...',0

PM_Feature_Help		POS	<,26,22>
			db 	'Sleep timer, Suspend timer...',0

ifdef	RPB_FEATUREPAGE_ENABLED
; Enable this code if RPB feature page is desired
RPB_Feature_Help	POS	<,25,22>
			db 	'Remote Pre=Boot Support Setup...',0
endif	;RPB_FEATUREPAGE_ENABLED

BIOS_D4_Help		POS	<,18,22>
			db	'Load BIOS'
_Except_Str		db	' Defaults except Standard CMOS SETUP'
			db	0

Chipset_D4_Help		POS	<,18,22>
			db	'Load Setup'
			JMPSTRING <,offset _Except_Str>

PNP_Feature_Help	POS	<,26,22>
			db 	'System IRQ, DMA Assignment',0

ifdef	NEW_IO_FEATURE
IO_Feature_Help		POS	<,22,22>
			db 	'Onboard I/O, IRQ, DMA Assignment...',0
endif	;NEW_IO_FEATURE

Password_Help		POS	<,27,22>
			db 	'Change/Set/Disable Password',0

Auto_IDE_Help		POS	<,19,22>
			db 	'Auto-Configure HDD: Sector, Cylinder, Head...',0

HDD_LFormat_Help	POS	<,24,22>
			db 	'Hard Disk Low Level Format Utility',0

Save_Exit_Help		POS	<,26,22>
			db 	'Save Data to CMOS'
_AndExitStr		db	' & Exit SETUP',0

Exit_NoSave_Help	POS	<,26,22>
			db 	'Abandon all Datas'
			JMPSTRING <,offset _AndExitStr>
;R29 - ends
;R31 start
;R31bifndef Flash_16K_8K_8K_Unit	  ;R31a
ifdef  Backup_CMOS_to_FLASH
Load_CMOS_From_BIOS_Help		POS	<,26,22>
			db 	'Save Data to CMOS'
Save_CMOS_TO_BIOS_Help     POS	<,26,22>
			db 	'Save Data to BIOS'

endif ;Backup_CMOS_to_FLASH
;R31bendif ; Flash_16K_8K_8K_Unit	  ;R31a
;R31 end

;R32 - start
ifdef	NEW_CPU_FEATURE				;R32
CPU_Feature_Help		POS	<,22,22>
			db 	'Setting CPU internal frequency...',0
endif;	NEW_CPU_FEATURE				;R32
;R32 - end

;R35 - starts
ifndef	NO_HDD_LOW_LEVEL_FORMAT
;[]===========================================================[]
;[]===========================================================[]
fProc_HDD_LFormat	Proc	Far

		push	bx
		call	X_VNormal
		mov	si, offset HDD_Name_Str
		mov	ax, SEG HDD_Name_Str
		mov	ds, ax
		call	X_Display_String
		mov	byte ptr USE_ITEMSTAT_BUF[bp], 2
		mov	bx, offset hddc_item
		call	X_ReShow_HDD
		mov	bx, offset hddd_item
		call	X_ReShow_HDD
	ifdef	Support_4_IDE
		mov	bx, offset hdde_item
		call	X_ReShow_HDD
		mov	bx, offset hddf_item
		call	X_ReShow_HDD
	endif	;Support_4_IDE
		mov	byte ptr USE_ITEMSTAT_BUF[bp], 0
		pop	bx

	ifndef	DOSVERSION
		POST_func_call	Low_Format
	endif	;DOSVERSION

		call	X_Refresh_Menu1
Low_Format_Exit:
		ret

fProc_HDD_LFormat	Endp
endif	;NO_HDD_LOW_LEVEL_FORMAT

;[]===========================================================[]
;[]===========================================================[]
fProc_IDE_Detect	Proc	Far

		mov	si, offset Detect_Ide_Screen
		call	X_Display_CS_String

ifdef	Support_4_IDE
		push	ds
		mov	ax, SEG CYL_HEAD_STR_1
		mov	ds, ax
		mov	si, offset CYL_HEAD_STR_1
		call	X_Display_String
		pop	ds
endif	;Support_4_IDE

		push	ds
		push	es

		Post_func_call	Reset_HDD_controller
		mov	cx, NUM_OF_IDE_ITEM
ifdef	IDE_PRIMARY_ONLY
		shr	cx, 1
endif	;IDE_PRIMARY_ONLY
		mov	bx, offset HDDC_ITEM
Detect_Next_HDD:

		mov	KEYIN_BUF[bp+9], cl
		push	cx
		push	bx
		call	Detect_Drive
		pop	bx
		jc	short @F
		mov	word ptr LAST_KEY[bp], K_PLUS
		call	X_Skip_HDD_Type
	@@:
		pop	cx

		add	bx, HDD_TYPE_DIFF
ifdef	IDE_PRIMARY_ONLY
		add	bx, HDD_TYPE_DIFF
endif	;IDE_PRIMARY_ONLY
		loop	short Detect_Next_HDD
		pop	es
		pop	ds
		call	X_Refresh_Menu1
		ret

fProc_IDE_Detect	Endp

Detect_Ide_Screen:
		db	V_WARN
		BORDER1	<, LEFT_X, BLOCK_START_Y, RIGHT_X, END_Y, 1+Empty_Border>
		db	V_Hilite
		POS	<, 4, DETECT_IDE_MSG_Y+10>				
		db	'Note: Some OSes(SCO-UNIX Before v5.0) must use "NORMAL" for installation'
		db	V_Normal
		POS	<, 33, DETECT_IDE_MSG_Y+11>
		db	'µ ESC : Skip Æ'
		db	0

Detect_Ide_Str:
		db	V_REVERSE

ifdef	Support_4_IDE							
		BORDER1 <, 7, DETECT_IDE_MSG_Y+1, 74, DETECT_IDE_MSG_Y+9, 0+Empty_Border>	
		POS	  <, 26, DETECT_IDE_MSG_Y+2>					
		db	  'Auto-Detecting'						
		db	  ' '								
else	;Support_4_IDE							
		BORDER1 <, 3, DETECT_IDE_MSG_Y, 76, DETECT_IDE_MSG_Y+9, 0+Empty_Border>
		POS	  <, 26, DETECT_IDE_MSG_Y+2>
		db	  'Auto-Detecting'
endif	;Support_4_IDE							

		CALLROUTINE <, offset Print_Drive_Type>
		db	'...'
		db	0

ifdef	IDE_LBA_MODE_SUPPORT
Ask_HDD_Option_Str:
		db	V_REVERSE

	ifdef	Support_4_IDE						

		BORDER1	<, 13, 18, 70, 18, 0>				
		POS	<, 19, 17>
		CALLROUTINE <, offset Prn_CYL_HEAD_STR>
		POS	<, 13, 17>
		db	'OPTIONS'					
		ADDX	<, 6>						
		db	'SIZE'						
		POS	<, 17, 19>					
		db	'(Y)'						
		CLEAR	<, 22, DETECT_IDE_MSG_Y+2, 55, DETECT_IDE_MSG_Y+2>	
		POS	<, 20, DETECT_IDE_MSG_Y+2>			
		db	'Select '					

	else	;Support_4_IDE						

		BORDER1	<, 5, 18, 73, 18, 0>
		POS	<, 7, 17>
		CALLROUTINE <, offset Prn_CYL_HEAD_STR>
		POS	<, 5, 17>
		db	'OPTIONS'
		ADDX	<, 5>
		db	'SIZE'
		POS	<, 8, 19>
		db	'(Y)'
		CLEAR	<, 22, DETECT_IDE_MSG_Y+2, 55, DETECT_IDE_MSG_Y+2>
		POS	<, 23, DETECT_IDE_MSG_Y+2>
		db	'Select'

	endif	;Support_4_IDE						

		CALLROUTINE <, offset Print_Drive_Type>
		db	' Option (N=Skip) : ', 0

else	;IDE_LBA_MODE_SUPPORT

Accept_Str:
		db	V_REVERSE
		POS	<, 22, DETECT_IDE_MSG_Y+2>
		db	'  Do you accept this drive (Y/N)? '
		db	0

endif	;IDE_LBA_MODE_SUPPORT

;[]===========================================================[]
;input	:	bx = HDD type item offset
;[]===========================================================[]
Detect_Drive	Proc	Near

;-----------------------------------------------
;save HDD type & user type info
;-----------------------------------------------

		mov	si, offset Detect_Ide_Str
		call	X_Display_CS_String

		push	word ptr CMOS3B[bp]
		push	word ptr CMOS_LBA_LGA[bp]

		call	X_Get_HDD_CMOS_Info		;DX = HDD type item offset
							;SI = HDD type loc.
							;DI = HDD params loc.
		push	word ptr FIXED_TYPE[bp]
		push	word ptr [bp+si]		;save hdd type

		mov	ax, di
		mov	cx, 8				;save HDD params
	@@:
		push	word ptr [bp+di]
		add	di, 2
		loop	@B
		mov	di, ax

;---------------------------------------------------

		ALIGN	16

ifdef	IDE_LBA_MODE_SUPPORT
		mov	word ptr KEYIN_BUF[bp+0], ('n' shl 8) + 'N'
		mov	word ptr KEYIN_BUF[bp+2], ('y' shl 8) + 'Y'
		mov	word ptr KEYIN_BUF[bp+4], ( 0  shl 8) + '1'
		mov	byte ptr KEYIN_BUF[bp+6], 0
endif	;IDE_LBA_MODE_SUPPORT

		mov	word ptr IDE_Detect_Skip_Key[bp], K_ESC1	;R02 Skip key is 'ESC'
		POST_func_call	Auto_IDE_Detect_X

	;------------------------------------------------------------
	;Show disk drive C parameters according auto-detection result
	;------------------------------------------------------------


ifdef	IDE_LBA_MODE_SUPPORT
		mov	byte ptr USE_ITEMSTAT_BUF[bp], 19
		mov	byte ptr KEYIN_BUF[bp+7], 0	;'Y' choose CHS

		test	dh, 02h				;LBA mode support?
		jz	short No_LBA			;no, skip!
		mov	byte ptr KEYIN_BUF[bp+7], 1	;'Y' choose LBA

		mov	al, 1				;show LBA
		mov	ah, 1
		call	Disp_HDD_Option
		inc	byte ptr USE_ITEMSTAT_BUF[bp]
		mov	byte ptr KEYIN_BUF[bp+5], '2'
	No_LBA:
		xor	al, al				;show CHS
		call	Disp_HDD_Option

		call	X_Get_HDD_CMOS_Info		;SI = HDD type loc.
		cmp	word ptr [bp+di], 1024
		jbe	short NO_LARGE

		inc	byte ptr USE_ITEMSTAT_BUF[bp]
		mov	al, 2				;show LARGE
		call	Disp_HDD_Option
		mov	byte ptr KEYIN_BUF[bp+6], '3'
	NO_LARGE:
	;----------------

		mov	si, offset Ask_HDD_Option_Str
		call	X_Display_CS_String

		mov	cx, 7
		F000_call Ask_Inputs

		jnz	short Not_Replace_Drive	;ESC is pressed
		mov	al, KEYIN_BUF[bp+7]	;R07
		jnc	short Disp_Opt		;'Y' is pressed
		cmp	si, 1			;'N' is pressed	: si=0, 1
		jbe	short Not_Replace_Drive	;'N' is pressed
		mov	ax, si
		sub	al, 4
	Disp_Opt:
		and	al, 03h
		mov	byte ptr USE_ITEMSTAT_BUF[bp], 1		;tell show hdd routine to
		call	ReDisp_HDD
		jmp	short Replace_Drive

else	;IDE_LBA_MODE_SUPPORT

		mov	byte ptr USE_ITEMSTAT_BUF[bp], 01h	;tell show hdd routine to
		call	ReDisp_HDD
		mov	byte ptr USE_ITEMSTAT_BUF[bp], 00h

		mov	si, offset Accept_Str
		call	X_Display_CS_String

		stc				;default 'N'
		F000_call Ask_Confirm
		jnz	short Not_Replace_Drive	;ESC is pressed
		jnc	short Replace_Drive	;NC = 'Y' is pressed

endif	;IDE_LBA_MODE_SUPPORT


;----------------------------------------------------
;restore the saved HDD type & user defined parameters
;----------------------------------------------------
Not_Replace_Drive:
		call	X_Get_HDD_CMOS_Info		;SI = HDD type loc.
							;DI = HDD param loc.
		mov	cx, 8
		add	di, 0Eh
	@@:
		pop	word ptr [bp+di]
		sub	di, 2
		loop	@B

		pop	word ptr [bp+si]
		pop	word ptr FIXED_TYPE[bp]

		pop	word ptr CMOS_LBA_LGA[bp]
		pop	word ptr CMOS3B[bp]

		stc
		jmp	short Detect_Drive_Exit

;----------------------------------------------------
;accept the HDD found
;----------------------------------------------------
Replace_Drive:
		clc
		add	sp, 12*2

Detect_Drive_Exit:

		ret

Detect_Drive	Endp

Disp_HDD_Option	Proc	Near

		push	ax
		push	ax
		call	X_VReverse
		pop	ax
		mov	ah, USE_ITEMSTAT_BUF[bp]
		mov	CURSOR_Y[bp], ah

ifdef	Support_4_IDE
		mov	byte ptr CURSOR_X[bp], 16
else	;Support_4_IDE
		mov	byte ptr CURSOR_X[bp], 7
endif	;Support_4_IDE

		or	al, 30h
		inc	al
		call	X_Display_Char
		pop	ax
		jmp	short ReDisp_HDD

Disp_HDD_Option	Endp

;----------------------------------------------------
;input :	0 = show CHS
;		1 = show LBA
;		2 = show LARGE
;----------------------------------------------------
ReDisp_HDD	Proc	Near

		call	X_Get_HDD_CMOS_Info			;DX = HDD type item

ifdef	IDE_LBA_MODE_SUPPORT
		push	dx
		mov	bx, dx
		add	bx, HDD_TYPE_DIFF-ITEM_SIZE
		mov	dl, al
		xor	dh, dh
		call	X_Write_Item_Value
		pop	dx
endif	;IDE_LBA_MODE_SUPPORT

		mov	bx, dx
		call	X_Disp_ItemTitle
		mov	byte ptr HDD_CURSOR_FLG[bp], 0FFh
		call	X_ReShow_HDD
		mov	byte ptr HDD_CURSOR_FLG[bp], 0
		ret

ReDisp_HDD	Endp

fPROC_Prn_CYL_HEAD_STR	Proc	Far
		push	si
		push	ds
		push	SEG CYL_HEAD_STR
		pop	ds
		mov	si, offset CYL_HEAD_STR
		call	X_Display_String
		pop	ds
		pop	si
		retf
fPROC_Prn_CYL_HEAD_STR	Endp

ifdef	IDE_LBA_MODE_SUPPORT
fPROC_Print_Drive_Type	Proc	Far

		pusha
		push	ds

ifdef	Support_4_IDE
		mov	si, offset Drive_Str_Tbl
		mov	ax, word ptr cs:[si-2]
		mov	ds, ax
		mov	al, KEYIN_BUF[bp+9]
		dec	al
		xor	ah, ah
		shl	ax, 1
		add	si, ax
		mov	si, cs:[si]
		call	X_Display_String
		sub	byte ptr CURSOR_X[bp], 3
else	;Support_4_IDE
		mov	si, offset DRIVE_Str
		call	X_Display_CS_String
		mov	al, KEYIN_BUF[bp+9]
		not	al
		inc	al
		and	al, 03h
		add	al, 41h
		call	X_Display_Char
endif	;Support_4_IDE

		pop	ds
		popa
		ret

fPROC_Print_Drive_Type	Endp
endif	;IDE_LBA_MODE_SUPPORT

ifdef	Support_4_IDE
		dw	SEG SnameKc
Drive_Str_Tbl:
ifndef	IDE_PRIMARY_ONLY
		dw	offset SnameKf
endif	;IDE_PRIMARY_ONLY
		dw	offset SnameKe
ifndef	IDE_PRIMARY_ONLY
		dw	offset SnameKd
endif	;IDE_PRIMARY_ONLY
		dw	offset SnameKc
else	;Support_4_IDE
DRIVE_Str	db	' Drive ', 0
endif	;Support_4_IDE
;R35 - ends

XCODE		ENDS
;R28D end

		END
