;	[]===========================================================[]
;
;	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.
;
; 	[]===========================================================[]
;

;		PAGE	60,132
;		TITLE	POST  -- 386 ROM/BIOS POST
;----------------------------------------------------------------------------
;Rev	Date	 Name	Description
;----------------------------------------------------------------------------
;R434A	04/30/99 MCH	Clear EPA Logo Area first before POST_79S in R434 coding.
;R441	04/29/99 STV	Fixed SCSI boot fail when use a ISA AHA-SCSI card.
;			This reason is INT19 be replaced by the SCSI card and
;			cause 'Enable_SCSI_Boot' flag not be enabled in int 19h.
;			So we set this flag in POST instead int 19h.
;R440	04/28/99 AVN	Added define 'Always_Disable_IDE_32BIT_Mode' for SiS
;			chipset (530,620) fail to use HDD on some customer board.
;R329	04/16/99 GAR	Add Superio_Need_Do_Before_Boot
;R328B	04/06/99 STV	Fixed R328A must check "IDE_drive_Max_num" not "NUMHDSKS"
;R438	03/24/99  RAY	Add switch: NO_Y2K_CHECK for some customer that they
;			have RTC that supports century
;R437	03/16/99 RAY	NO "Check_K6_CPU" if it is not 586 BIOS
;R436	03/12/99 RAY	Modify file to support BIOS 4.6
;R435	03/10/99 RCH	Fixed garbage screen if switch 
;			"RESTORE_POSTSCN_FOR_ERROR" is used
;R431E	03/09/99 KVN	Don't restore Int 13h vector when system not boot from
;			SCSI first.That can fix some diskette card operate
;			abnormally.(e.g. Altec PCMCIA card)
;R434	03/05/99 MCH	Added the "Support_Keyboard_Clear_CMOS" feature.
;			It will maintain the system security function if
;			the CMOS is cleared from Keyboard by users only.
;			The required definition is as followings:
;			Support_Keyboard_Clear_CMOS	EQU	1
;			Keyboard_Clear_CMOS_CMOS	EQU	Cmos_Loc1
;			Keyboard_Clear_CMOS_PassW_CMOS	EQU	Cmos_Loc2
;			Keyboard_Clear_CMOS_Temp_PassW	EQU	Cmos_Loc3
;			** Note: Cmos_Loc3 needs 2 consecutive CMOS data area **
;			The further detail programming please see 2A6LFZ1A.INC(R15).
;R433	02/05/99 KVN	Fixed system hang in Get_OptionROM_Map procedure.
;R432	02/03/99 DRS	This function depends on Support_SumScr_Item definition
;			You can enable/disable the System configuration
;R420F	02/03/99 KVN	Fixed coding mistake that will cause some combined
;			PCI code (NCR) execute abnormally in 1MB BIOS
;R431D	02/03/99 KVN	Fixed coding mistake
;R431C	01/28/99 KVN	Fixed always read data from IDE HDD when system boot
;			from IDE and connected both IDE and SCSI of HDD.
;R431B	01/28/99 KVN	Fixed coding mistake
;R431A	01/27/99 KVN	Fixed coding mistake that cause SCSI boot fail when
;			system only one SCSI HDD drive without IDE and boot
;			sequence selected drive C first boot priority
;R420E	01/15/99 KVN	Fixed onboard SCSI card not to init.The enviroment
;			same as R420C
;R426A	01/08/99 RCH	Also invoke OEM POST code with 0FFH to prevent the
;			OEM POST code display stay at POST 63H.
;R420D	12/29/98 KVN	Fixed coding mistake by R420C
;R420C	12/24/98 KVN	Fixed decompress process error on new POST_decompress
;			and old Expand subroutine of Boot Block.For example :
;			There is a old BIOS (that contain old decompress method)
;			and updated a new BIOS but BootBlock is protected then
;			reboot and decompress all of in POST data(EPA,P6upd,PCI...)
;			are error.
;R431	12/21/98 KVN	Fixed Iomage Jaz device boot fail.That is SCSI has no
;			asign driver letter for Jaz when have IDE drive to be
;			installed before SCSI looking for jaz.So we asign
;			SCSI drive letter ahead of IDE if boot sequence is
;			"SCSI,A,C" or "SCSI,C,A".
;R430	12/16/98 LAW	addeed "ALWAYS_101_key_keyboard_SUPPORT" to fix IBM 84key
;			keyboard some key lose
;R429	12/12/98 RCH	Discard "Video BIOS Shadow" setup item for platform
;			without ISA Bus support like Intel/i820 & i810 chipset
;R422A	12/01/98 RCH	Added dot display for each POST if the custom message
;			display is choiced.
;R420B	10/27/98 RCH	Fixed wrong decompressed data size return by changing
;			decompress method from real mode to protected mode.
;			It waste too much time, if the CPU micro code is not
;			supported in BIOS.
;R428	10/20/98 KVN	Fixed CDROM test hang in QAPLUSFE v5.50
;			Test method is list below:
;			   1. made a bootable floppy diskette with LGIDECD.SYS
;			      CDROM driver and load qaplus program by LOAD.COM
;			      utility
;			   2. connect CDROM on secondary channel
;			   3. boot from floppy and auto run qaplus (by load utility)
;			      and system will hang on analysis CDROM
;R427	10/02/98 BAR	Fixed define support " No_Support_4_IDE " 
;			compile error.
;R426	10/02/98 RAY	Hook to OEM_Service_Roution_Post_Code in new file
;			OEMPOST.ASM for easily adding OEM code.
;R425	09/29/98 RAY	Mask out some unused externals.
;R424	09/17/98 KVN	Don't switch to text anyway for Acer OEM.They will
;			clear screen in OS
;R423A	09/10/98 DNL	Fixed coding mistake
;R423	09/09/98 DNL	Initial ACPI table and AML code late to fix VIA IRQ
;			assign incorrectly problem
;M03  	09/02/98 RAY	Adapt Preboot-Agent from code modified by US
;	04/09/98 TJM  Move snooping enable support before Option ROMs
;
;M02  	09/02/98 RAY	Adapt Preboot-Agent from code modified by US
;	01/29/98 TJM  Fix Monochrome shadow bug if MPC enabled
;
;M01  	09/02/98 RAY	Adapt Preboot-Agent from code modified by US
;	(01/29/98 TJM)  Added MPC 2.0 (Formerly RPB) modifications
;
;R422	08/31/98 RCH	Added specific POST message customerization
;R421	08/11/98 RCH	Added specfic LCD display for POST code output
;R420A	07/24/98 KVN	Coding mistake that will cause system hang on POST_14S
;			by R420
;R420	07/23/98 KVN	Change method of decompressing in protect mode
;R419	07/20/98 RAY	Add BIOS.CFG switch: Special_ISA_ROM_Range
;R418	06/26/98 DRS	Add No_Automatic_Load_Awdflash_InPOST definition
;			Some customers want to automatically load awdflash.exe,
;			but they don't want this function during POST.
;			They just want to autmaticlly load awdflash.exe in BootBlock.
;			POST hang at 82s or 61s when BIOS combine ISA ROM
;R417	06/01/98 TNY	Fix Num-Lock LED action error if "Boot Up Num-Lock Sts"
;			is off after warm-reset.
;R411A	05/27/98 KVN	Calculate exactly size to clear base memory to correctly
;			The old method only clear base memory over 240h KB so
;			if option ROM use base memory size over 64KB that will
;			clear option ROM code or data by system BIOS
;R416	05/07/98 KVN	Set FS=DGROUP(0F000h) for all POST stage
;R394C	04/23/98 KGN	Move Get_Hdd_Info earlyer , cause AMD266,300 will hang
;R415	04/23/98 KEN	Fixed bug that the system reboot from the routine
;			Move_and_Clear_RAM_in_Prot at POST_82s when the CPU
;			is AMD K6/3D and the USB keyboard is plugged on
;			AladinV M/B.
;R374A	04/23/98 JSN	Delete the duplicate function defination.
;R414	04/22/98 KVN	Remove AWARD logo font location to ASCII 251-255 from
;			27-31 and reload ASCII standard font 0-250 after show
;			EPA that to avoid some addon card use ASCII 0-31 font
;			but show wrong character
;R394B	04/21/98 KGN	Move code to kernel , cause this part is all same in
;			every chipset.
;R400A 	04/20/98 KVN	Fixed SI and BX registers will be destored by call
;			F000_shadow_W subroutine that will cause write shadow
;			fail, this cause new ZIP drive booting failure
;R396C	04/15/98 KVN	Fixed R396A to destroy 9000:0 area data.That will cause
;			2M BIOS to run in SYMBIOS-53C895 SCSI card with PS2
;			mouse then system hang at POST_96S.The reason is 2M BIOS
;			will use 8000:0-9000:FFFF to store option ROM data.Now
;			we backup 90000h to 150000h and restore it after post
;			decompress
;R413	04/08/98 RCH	Change CELERON CPU name to "INTEL(R) CELERON(TM)"
;			requested by Intel Taiwan.
;R396B	04/08/98 KVN	Enter flat mode for POST decompress subroutine to avoid
;			AMD CPU hang at generate SMI during entern protect mode
;R396A	04/02/98 KVN	Fixed initial combine ROM error in 2M BIOS and option
;			ROM are locate on 2 segment area.Because of only copy
;			64KB code for init.So we need copy 128KB code for init
;			now.
;R412	03/25/98 TNY	Add Intel ALERTPACK chip support
;			Option:"ALERTPACK_Support"
;			       "ALERTPACK_ID"
;R379A	03/19/98 KVN	If define 'NO_SYSTEM_CONFIG' then dont make binary
;			code for BIOS
;R411	03/12/98 KVN	Added ChipAwayVirus ROM to F000 shadow
;R410	03/10/98 KVN	Added ChipAwayVirus driver message in POST screen
;R409	03/10/98 DNL	Reduce ACPI S4/BIOS code size to save more space
;R328A	03/10/98 KVN	Don't read HDD if none any HDD drive otherwise will
;			cause system hang on POST 60h (2A5LCL7A)
;R408	03/06/98 RCH	Skip BIOS virus warning function if ChipAway anti-
;			virus is implemented
;R393A	03/02/98 RCH	Changed new PS2 mouse flag location for IRQ 12 control
;R407	02/02/98 KGN	Add defin No_C8_DF_Shadow_Item for save F000 Code
;			remove C800-DFFF shadow menuitem from bfeature
;R406	01/21/98 KVN	Added a function in 'POST_decompress' procedure that
;			let caller can specification decompress segment
;R405	01/21/98 DRS	Support run awdflash.exe during POST 
;R404	01/21/98 KVN	Added a new switch for special ISA ROM init
;R403B	01/02/98 LAW	fixed set password show Graphics_Post
;R403A	12/24/97 LAW	Post_82s don't call switch_logo_to_text, use int 10h
;			ax, 3 to switch screen mode
;R403	12/18/97 LAW	change "EPA_LOGO_Use_Graphics" with "FULL_SCREEN_LOGO"
;			switch to "Graphics_post"
;R402	12/17/97 KVN	Dont access floppy if controller be disabled by user
;			password
;R401	12/16/97 KEN	Calling Usb_Final_Init before PCI option ROM
;			initialization to release shadow RAM if USB legacy
;			supporting is disabled.
;R400 	12/15/97 BAR	Added a interface to write shadow RAM
;		         function name	 	    , offset , data
;			 " Write_F000_shadow_Byte " , SI+BX  , al	
;			 " Write_F000_shadow_Word " , SI+BX  , ax
;			 " Write_F000_shadow_DWord" , SI+BX  , eax
;R399	12/15/97 BAR	Added check INTEL/TI 28F020 EEPROM,this type not support PNP function
;R394A	12/12/97 KGN	Remove HPM Final call before preint19, cause press key
;			to much will hang here ( Initial PNP device )
;R397A	12/01/97 LAW	Switch text mode after Show PNP card msg
;R398	11/28/97 JKY	IF need SMI_HANDLER & USB routing move to XGROUP ,
;			USB init hook call need use Xcall (TX support only).
;R397	11/26/97 LAW	added "EPA_LOGO_Use_Graphics" support to fixed some
;			LCD VGA chipset problem at text mode show EPA logo
;R396	11/17/97 KVN	Remove POST_decompress code allocate behind E800h to
;			avoid be clear if BIOS use E000h-E800h after POST_82S
;R395	11/07/97 RAY	Kill some un-used external definitions
;R394	11/06/97 KGN	Add HPM Support
;R382C	11/05/97 RAY	Clean XGROUP data after PciRom_Before_Init
;R393	11/05/97 RCH	Fixed KBC hang up while hot plugging PS2 mouse, also
;			mask IRQ 12 if mouse not plugged.
;R392	11/03/97 LAW	fixed some old bios set Century error
;R391	10/27/97 KGN	move defin LCD_CRT_OPTION to common.equ
;R390	10/21/97 RCH	Added option to skip item "BootSpeed" due to current
;			platform have no speed control
;R389	10/16/97 Stv	Add NET PC Table Func
;R388	10/08/97 RIC	Add "ONCHIP_2ND_ALWAYS_DISABLE" define
;R387	10/07/97 BAR	Added Fixed Disk Parameter Table Extension(FDPTE)
;R382B	09/18/97 KVN	Don't copy XGROUP code to above 1M memory when none
;			extent memory
;R386	08/28/97 DNL	Do not call LCD function wile onboard VGA no work
;R385A	08/22/97 KVN	Disable interrupt before enter protect mode
;R365A	08/20/97 KVN	Don't turn CPU cache on/off during call	"Usb_Final_Init"
;			to fixed system hang on 2A59GJ39 M/B and CPU is cyrix
;R336I	08/13/97 KVN	Remove R336F add code to fixed ROM disk card boot fail
;R385	08/05/97 KVN	Fixed 2M BIOS combine ROM source data be destroied after
;			POST_49S to solve ACPI table not establish to correct
;R384	08/05/97 RCH	Disable FDD port if type user password and FDD access
;			is selected with "supervisor only" for special
;			customerization
;R382A	08/05/97 KVN	Fixed system reset at POST_82S on VIA VPX chiprun MB
;			by R382
;R383	08/04/97 JKY	Patch when SiS5120 useing M38813 KBC when POST 98s
;			read KB ID spend long time, now change POST 98s before
;			Show_system_cfg by customer request.
;R382	08/04/97 KVN	Fixed Buslogic PCI card (81C15) BIOS version is 2.00Z
;			or 2.01T cause POST hang during enter its utility when
;			press CTRL-B.Because it will use 6000h:0 segment area
;			so we move 6000h:0 to protect mode before init it and
;			remove back after init
;R336H	07/18/97 KVN	Fixed R336F cause IDE HDD can't boot if plug BusLogic
;			81c15 PCI card and no connect SCSI HDD
;R371A	07/14/97 JSN	Fixed ALi M6117 chipset post hang at 61h.
;R336G	07/03/97 KVN	Fixed R336F cause Floppy disk can't boot if none HDD
;R336F	07/01/97 KVN	Fixed MO boot fail.Asign SCSI driver letter ahead
;R381	06/25/97 RCH	Added "E_F000_Shadow_W" and "E_F000_Shadow_R" for
;			shadow RAM access for all POST procedures usage.
;R380	06/24/97 KEN	Fixed bugs:
;			 1. The system hang up while running the diagnostic
;			    program of Adaptec SCSI ROM.
;			 2. The system hang up when the boot-ROM of 3Com 3C900
;			    is executed.
;			The causation is that the USB kernal uses the base
;			memory at POST stage, and the base memory is conflicted
;			with these programs. To solve these problems, the USB
;			kernal will use the shadow RAM at whole time.
;R198A	06/12/97 RAY	Problem:
;
;			  Fail to initialize the new AHA 7880 ROM
;
;			Reason:
;
;			  We do not have enough empty space for this new ROM
;			  to decompress it's ROM after we add a new POST
;			  segment XGROUP in 6000h.
;
;			Fix:
;
;			  Do not duplicate the NCR & AHA combined ROM to 
;			  7000:0
;
;R379	06/06/97 KVN	Move 'Show_system_cfg' subroutine to Xsegment to save
;			E8 code space
;R378	06/02/97 pty	add code for RPB
;R317A	05/28/97 AVN	In SiS5571 if there is NET card plug when boot from
;			NET card and run test program, then warmboot will
;			hang in here. Define 'DONT_UNMASK_IRQ'
;R377	05/26/97 DNL	Add "Support_1_FDD" definition to save more space
;R376	05/20/97 RCH	Modify codes to display memory size up to 1GB
;R368A	05/20/97 AVN	Let MXIC 28F2000PPC reduce to alone in BIOS support.
;R375	05/19/97 RCH	Added PCI/IRQ routing header information for 
;			Microsoft's extra spec. on PCI v2.1
;R266B	05/13/97 RIC	Fixed R226A lost some define.
;R374	05/09/97 JSN	Add M1523B_USB define for ALi chipset.
;R373	05/07/97 DRS	GIANTEC don't want beep when vga select "Absent" item
;			It's special for GIANTEC 
;R372	05/07/97 JKY	Added Pci listing for PCMCIA
;R371	04/29/97 JSN	Added M6117_CPU	define.
;R370	04/28/97 KEN	Support USB always enabled at POST stage, and
;			initialize USB before memory testing.
;R369	04/18/97 KVN	Added MP table for dynamic to built into shadow
;R368	04/11/97 AVN	Link MX28F2000PPC EEPROM into 2M EEPROM Group
;R367	04/09/97 KVN	Add "POST96_RESET_HDD_CTLR" definition for some CDROM
;			boot failure (e.g. Pioneer DR-A12X)
;R366A	04/07/97 DNL	Fixed coding mistake
;R366	04/03/97 DNL	Added STD resume password check support
;R308A	04/02/97 RIC	Fixed that the boot Rom of ISA LAN Card(use IRQ9) run
;			error in no PCI Reset Chipset.
;			Solve Method :
;			Always enable IRQ 9 during System Reset because most
;			chipset already have PCI Reset function.
;			Note :
;			If your old chipset hang during reset, you can
;			define FORCE_DISABLE_IRQ9 for covering noise of IRQ9
;
;R365	04/01/97 RCH	Fixed system hang when system BIOS cacheable turn on
;			and USB legacy support is enabled.
;R364	03/12/97 KVN	Add "No_Auto_Switch_to_Text" definition
;R173B	02/25/97 KVN	Fixed coding mistake
;R363	02/18/97 DNL	Added "TV_OUT_SUPPORT" definition to support VGA TV-out
;			function
;R359A	02/17/97 KVN	Fixed LS120 drive display to CDROM
;R352A	02/04/97 KVN	Fixed R352 coding mistake
;R362	02/01/97 KVN	Support IOMEGA ZIP-100 drive active
;R361	01/27/97 KVN	Don't reset hdd controller for JETWAY Intel-VX MB (2A59GJ1C)
;			when connect Seagate(ST32140A) on primary master and
;			CREATIVE CDROM (CD820E.1V1090000) on secondary master
;R360	01/24/97 RCH	Move P6 USWC code for video display buffer from 
;			chippost.asm to kernel control.
;R359	01/22/97 KVN	Support dual LS120 drive active
;R358	01/22/97 RAY	Add Write Allocation support for K6 CPU
;R355A	12/07/96 RAY	Save codes for showing CPU P-Rating
;R357	12/06/96 TNY	Add ACPI string.
;R356	12/04/96 RAY	Do not show P-rating in the current stage and will
;			wait for AMD's further information.
;R355	12/03/96 RAY	By AMD's request:
;
;			Do not show the actual internal CPU clock for AMD
;			& Cyrix CPU on screen by default.
;
;			Add switch: DISP_MHZ_FOR_AMD_CYRIX to bypass the
;			above default, i.e. always show internal clock
;
;R354	11/30/96 RAY	Move all the CPU related code to CPUPOST.ASM for
;			easy debugging
;R353	11/28/96 KVN	Fixed show HDD size wrong in system config table when
;			set type is not user (i.e. type 1-45)
;R352	11/27/96 KVN	Fixed secondary slave HDD access failure
;R351	11/19/96 RAY	Call fProc_Qualify_PciBus instead of Find_P2P for 
;			maximum pci bus no.
;R350	11/15/96 RAY	call "far ptr Fproc_Verify_Password" instead of
;			"F000_call Verify_Password"
;R349	11/15/96 KVN	Fixed CDROM PIO mode display wrong in system config
;			when none IDE HDD and setup set not auto
;R348	11/14/96 RCH	Added Klamath L2 cache enable/disable control, this
;			change also implment Pentium Pro L2 cache as kernel
;			code.
;R347	11/11/96 KVN	Add ultra DMA message in system configuration table
;R346	11/06/96 KVN	Fixed some PCMCIA ROM card emulate boot to C error
;R345	11/01/96 KVN	Added LS-120 support
;R336E	10/22/96 KVN	Fixed some bootable device(e.g. PCMCIA card) boot fail
;R344	10/22/96 RCH	Support CPU clock over 255MHz for Klamath CPU.
;R343	10/21/96 KVN	Fixed SONY CDROM (MODEL NO. : CDU76E) during Triones
;			driver V3.22 initial then system hang on TRITON II and
;			CPU run at 200 MHz
;R336D	10/17/96 KVN	Fixed modify INT13 vector to be modifed 0F0000h segment
;			code when none IDE HDD then DS register not point to G_RAM
;R342	10/17/96 DNL	Added "E000_SMI_SUPPORT" definition to save F-segment 
;			space
;R340A	10/16/96 RCH	Some chipsets use "Ct_Parity_Control" for special
;			purpose, so don't skip it even define NO_PARITY_ITEM
;R341	10/15/96 RAY	Move the code in POST_11s which set the century as
;			20 & 19 to E8POST.ASM as a subroutine. This routine
;			will be called from POST_11S & also from POST_99S
;			in case the the RTC year is updated to 00h within
;			the time range of POST 11 & 99.
;R336C	10/11/96 KVN	Fixed Floppy can't boot if connected AdvanSys PCI SCSI
;			card rom driver version is v2.2.6 and none IDE HDD.
;R336B	10/11/96 KVN	Fixed HDD can't boot on Triton II if system cacheable
;			enabled and BIOS enable CDROM function
;R340	10/11/96 RCH	Don't build menuitem if defined "NO_PARITY_ITEM" and
;			kill unused external routines to save codes
;R339	10/09/96 JSN	Added ALi M6117_CPU define.
;R338	10/08/96 RCH	Show "Klamath" instead of "PENTIUM PRO" if define
;			"KLAMATH_CPU_ONLY"
;R336A	10/05/96 RIC	Fix compiler warnning.
;R337	10/04/96 RCH	Add SMI support for P6 multi-processor system
;R336	10/04/96 KVN	Added boot HDD selectable function
;R334A	09/26/96 KVN	Fixed R334 cause SCSI HDD can't boot because it is
;			always replace INT 13h even no bootable CD
;R335	09/25/96 RCH	Rewrite some routine to get more space
;R334	09/23/96 KVN	Fixed NT 4.0 no emulation CD install to SCSI HDD fail
;R333	09/20/96 RAY	Do not skip PM_INIT for P5 multi-processor system.
;			In other words, we support SMI for P5 MP systems.
;R332	09/20/96 KEN	Support USB_RAM with shadow RAM.
;R331   09/03/96 RCH	Get boot sequence from BIOS data area instead of
;			reading CMOS value
;R330A	09/02/96 KVN	Move "Reset_INT13" subroutine from HDINSTAL.ASM to this
;			file to fix system hang when define CD_ROM and E000-E800
;			be cleared before POST_97S
;R330	08/21/96 KVN	Calculate HDD size in system config show for move
;			HDINSTAL.ASM to E000-E800 range
;R329	08/16/96 KVN	Move some code for update CMOS clock to G_RAM of 8254
;			counter from POST_83s to POST_99S for update DMI pool
;			spent a few time(about 10 seconds)
;R328	08/15/96 KVN	Fixed a PCMCIA flash memory card can't boot when floppy
;			and HDD is none and the PCMCIA card driver version is
;			'SCM Boot V1.13P'
;R327	08/02/96 RCH	Added 6x86L CPU display , this CPU's revision is
;			20h-2fh , normal 6x86 is 00-1fh
;R326	08/02/96 RCH	Added Prating for 6x86 60 & 66 Mhz with string 'P90+'
;R325	07/25/96 KVN	If HDD failure then display none in system config show
;R324	07/25/96 RCH	The PCI devices display become modbinable
;R313A	07/23/96 KEN	Modified for initializing USB keyboard earlier.
;R323	07/22/96 RCH	Display ODP & MMX for P6 CPUs
;R322	07/22/96 RCH	Display "PENTIUM ODP" instead of "PENTIUM" if the
;			CPU ID is return 15xxH. Note: the INTEL P54CT 
;			can not report correct CPUID, so BIOS can not report 
;			it as ODP CPU.
;R321	07/04/96 RCH	BIOS should unmask IRQ 8 , otherwise multi-tasking
;			manangement software "GENERIC.EXE" can not work.
;			This is special patch for special customer.
;R320	07/03/96 TNY	Add "SWAP_FDD_SHOW" option.
;R319	07/03/96 RCH	Display "PENTIUM-MMX" if CPU with MMX supported for
;			PENTIUM CPUs.
;R318	07/01/96 HTR	For PCI device listing, Check class code For skip
;			show pci device
;R317	06/24/96 RCH	For Some M/B Have Noise on IRQ 11, That Cause System
;			Cannot Entry Suspend Mode, If IRQ 11 Event Was Enable.
;R316	06/18/96 RAY	For PCI device listing, class code=0001 is also
;			VGA devices !
;R312B	06/18/96 RCH	Show "Pxxx" for cyrix 6x86 and "PRxxx" for AMD K5
;			requested by cyrix
;R299B	06/17/96 KVN	Fixed don't detect HDD boot sector and 32bit access if
;			no any HDD drive
;R315	06/14/96 TNY	Add NO_SHOW_IDE_DEVICE for EFA.
;R299A	06/12/96 KVN	Always store HDD_Exist_Flag in HDINSTAL.ASM(R19)
;R314	06/10/96 KGN	Add defin Beep_Before_Boot for USI
;R313	06/07/96 KEN	Add USB_SUPPORT
;R312A	06/03/96 RCH	Added PRating 120 & 133Mhz for ID 050XH of K5 CPU
;R312	05/28/96 RCH	Replace CPU name "AMD5k86" with "AMD-K5" ,"Pxxx" with
;			"PRxxx" , and Prating for 051XH CPU
;R311	05/23/96 RCH	Added L2 cache display for P6 second CPU of MP M/B
;R310	05/14/96 HTR	Add code for special show IDE Device in PCI listing
;R304A	05/14/96 KVN	Fixed code mistake cause secondary channel HDD 32bit
;			transfer failure
;R309	05/10/96 KVN	Display exact HDD fail drive
;R308	05/09/96 RCH	Always enable IRQ 9 if PCI reset function is enabled
;R307	05/07/95 KVN	System can not boot if define CD_ROM and only SCSI HDD
;			installed with a ATAPI CD-ROM connected at IDE port.
;R306	05/06/96 RAY	Before option ROM initialization, we have to clear
;			bottom of screen(POST 79). Modify code to clear screen
;			according to current cursor position. This is to 
;			prevent the secondary IDE information being cleared.
;R301F  05/06/96 HTR	Fixed screen attribute fault before boot
;R305	05/02/96 RCH	Let routine "Check_M1_Cpu" become public
;R304	05/01/96 KVN	Support any drive boot
;R301E  05/01/96 DNL	Fixed coding mistake
;R301D  04/29/96 RCH	Fixed system hang while diplaying PCI devices if
;			PCI/SIG card used.
;R303	04/26/96 KVN	show all CDROM drive on SYSCFG if be connected,because
;			it just detect and display 1 CDROM on current BIOS
;R301C	04/25/96 HTR	Fixed Vender ID wrong in PCI Device No
;R285A	04/24/96 DNL	Fixed coding mistake
;R302A	04/24/96 KVN	Fixed R302 codeing mistake
;R302	04/23/96 KVN	Added always detect CDROM function and show it on SYSCFG
;R301B	04/22/96 HTR	Added "Func No" item for the PCI device listing
;R301A	04/22/96 HTR	NO_Show_PCI_device option added
;R301	04/19/96 HTR	Show PCI device after show_system_config added
;R300	04/12/96 RCH	Call "Ct_Option_Rom_Scan" for specific option scanning
;			if define "LATER_CT_ROM_SCAN"
;R299	04/09/96 DNL	Fix bug	of system halt when only SCSI HDD installed
;R298	04/02/96 DNL	Added C&T,Cirrus LCD controller support
;R297	04/02/96 RCH	Hide some standard items for special customer (ECS)
;			"floppy seek","boot up speed" & "typematic rate"
;R296	03/27/96 RCH	The MP table should be modified to report PCI level 
;			trigger IRQs to OS for new INTEL I/O APIC, otherwise
;			MP OS can not boot on PCI card.
;R295   03/26/96 HTR	MICRO_STAR_ROM_DISK_Support option added
;R294	03/20/96 KVN	Fixed format wrong when enable swap floppy function
;R293	03/14/96 RCH	Show CPU name "PENTIUM OverDrive" instead of P24T
;R292	03/13/96 DNL	Add Am5x86-P75+ CPU type
;R291	03/12/96 RCH	Added P-Rating display for 160Mhz Am5x86 CPU, now
;			the BIOS display "P75" for 133Mhz and "P90" for 160Mhz
;			no P-rating display for 150Mhz due to not X5 CPU ID.
;R290	03/07/96 RCH	Set extended memory to 15Mb only if installed memory 
;			is more than 64Mb and running OS2 to patch OS2 can 
;			not report proper memory size for more	than 64Mb.
;R289	02/28/96 RCH	Read L2 cache size by execute CPUID for P6 to show
;			size up to 512kb
;R288	02/28/96 RCH	Support MP table selectable by user
;R245J	02/14/95 KVN	Clean all R245 mark
;R279A	02/14/96 KVN	Added 640x480 logo display
;R287	02/13/96 TNY	Support new VGA BIOS which's size is tenderable.
;R286	02/12/96 RCH	Some M/B can not report correct status from IDE port
;			,if CREATE 4x CD-ROM can not detected , define
;			WAIT_STAT_FOR_ATAPI to fix it.
;R285	02/08/96 KVN	Add CD-ROM display string in system config show
;R284	02/07/96 RIC	Add Cyrix 6x86-P200+ CPU type.
;R245I	02/02/96 KVN	Added BIOS information for DMI structure
;R283	01/26/96 RCH	Rename K5 CPU name from "Am5K86" to "AMD5k86"
;R245H	01/24/96 KVN	Fix Creative CD-ROM can't found
;R282	01/24/96 RCH	Added P-rating display for AMD SSA/5 CPU .
;R281	01/23/96 RCH	Fixed NumLock always off for CPU clock bigger than
;			150Mhz and system BIOS cacheable is enabled
;R280A	01/22/96 RCH	Some customers don't like P-rating, so add a switch to
;			skip it.
;R280	01/17/96 RCH	Added CYRIX 6x86 P-rating display
;R279	01/12/96 KVN	Added full screen logo display function
;R245G	01/11/96 KVN	Fix SONY 6x CD-ROM sometime not found
;R245F	01/08/96 KVN	Fix Ocean UMC498 mother board plus CDR-582 on Secondary
;			MASTER driver not found
;R278	01/05/96 RCH	Added a switch to support no CPU frequency display
;R277	12/28/95 KVN	Fixed boot sequence for none CDROM
;R173A	12/27/95 RCH	Fixed error coding for adding item for 32bit access
;R276	12/22/95 KVN	Fixed Seagate ST31220A HDD 32 bits access mode detect
;			error. Move detect code from HDINSTAL.ASM
;RIR_A	12/06/95 RCH	Move routine from E0POST.ASM to here "If_MP_PLUGGED"
;R275	12/06/95 KVN	Fixed can't found SONY CDU76E-Q2 CD-ROM after hareware
;			reset 2/3 times.Test on 2A5IDM3B.BIN bios and config.sys
;			added ATAPI_CD.SYS driver
;R274	12/04/95 KVN	Fixed system hang after shutdown
;RIR	11/29/95 KVN	Splite post.asm become e0post.asm and e8post.asm
;R273	11/27/95 TNY	Fix Matrox VGA + VIA 496G + Intel CPU hang in 0dh.
;R269B	11/23/95 LRY	Modify string 'VGA share memory' to 'shared memory'
;R245E	11/20/95 KVN	Fix OAK 6x CD-ROM (OTI-SCYLLA) can't found
;R256A 	11/17/95 AVN	Just Check Base Mem Only, Because Always Cannot Be
;			Zero, And Let This Function Come To Standart.
;R272	11/16/95 KVN	Remove all POST message to E000h
;R269A	11/16/95 LRY	Skip show share memory size when shared 0k
;R264A	11/15/95 DNL	Add Support_1_FDD definition.
;R271	11/15/95 RCH	Some customers suggest show 166Mhz instead of 167Mhz
;R270	11/09/95 RCH	P6 CPU should program MTRR for each CPU , so scan
;			other AP later.
;R269	11/09/95 LRY	Added hook to show vga share memory size
;R266A	11/06/95 RCH	Ths shadow is done after POST 82S , so skip some 
;			functions
;R268	11/02/95 TNY	Some VGA BIOSes need more than 32Kb space , so the
;			low memory resource should be adjusted.
;R267	11/01/95 TNY	Tuned clock value for M1
;R266	11/01/95 RCH	The remap function is always not available for PCI
;			platform , so we don't need to shadow adaptor ROM
;			earlier.
;R265A	10/30/95 LRY	Tuned clock value for Pentium 167MHz
;R265	10/27/95 RCH	Some chipsets should use lower value checking value
;			for clock beyond 150Mhz,like SiS/551X,UMC890 ...
;R264	10/16/95 TNY	Add Support_1_FDD definition.
;R263	10/27/95 RCH	Added cacheable region control for M1 CPU
;R245D	10/13/95 KVN	Fix CD-ROM can't found when plug Buslogic BT-956C card
;R262	10/26/95 RAY	To support UMC 8669, which is a PnP device, we must
;			disable the chip's PnP ISA capability before we
;			send initiation key for PnP ISA devices
;R261	10/24/95 RCH	Added clock detection for AMD/5K86 , this CPU is a
;			little faster than PENTIUM
;R260	10/23/95 RCH	Fixed AMD-X5 error clock detection, BIOS have to 
;			turn on L1 cache before detection
;R259	10/23/95 AVN	All AUDIO IO initialization codes are collected in
;			AUDIO.ASM. Define AUDIO_KERNEL in BIOS.CFG for this.
;R254A	10/20/95 LRY	Some costumer must define 'DISABLE_PS2_AT_POST5'
;			otherwise system hang at post 0Fh
;R258	10/19/95 RCH	Rewrite MP checking routine
;R257	10/17/95 RAY	Modify the reference value for Pentium 180
;R256	10/16/95 RAY	Some RTC will have all CMOS bytes equal to 0 when it
;			is cleared by H/W. So we have to force CMOS checksum
;			error in this case! But Somehow, all zeros is a
;			possible configuration, thus we only support this
;			function by adding switch in BIOS.CFG (Check_CMOS_All_Zeros)
;
;R255	10/13/95 RCH	Added BIOS Update Data support, Now we only support
;			hard coding , changeable data is required in the 
;			future, it need implement in INT 15H and need 1kb
;			space
;R245C	10/13/95 KVN	Fix CD-ROM can't found when plug Buslogic BT-956C card
;R253A  10/12/95 RCH	System sometimes hang at POST C0 after exiting setup
;R254	10/06/95 TNY	Fixed ACER SiS 551x M/B with AMIKEY-2 KBC then keyboard
;			hang while run Unix
;R253	10/06/95 KEN	Support PnP Super I/O.
;R244A  10/04/95 RCH	Fixed error clock detection for AMD-X5 4x clock CPU
;R252	10/04/95 RCH	Don't enable IRQ 12 if PS2 mouse not plugged before
;			SCSI ROM initial , but must turn on IRQ 12 for mouse
;			hot plug, note : BusLogic 946C hang if IRQ 12 is 
;			assigned and is enabled.
;R251	10/02/95 RCH	KBD_A20_OFF is POST only , so move it from ATORGS.ASM
;R245B	09/21/95 KVN	Fixed R245 code bug
;R250	09/21/95 RCH	Rewrite CPU clock detection routine for P6 CPUs
;R249	09/20/95 RCH	The bus clock is 60Mhz if the host clock is 180Mhz
;R248	09/19/95 AVN	Fixed P54C-167 / 200 Value.
;R247	09/18/95 RCH	Change POST PnP string location to E-segment
;R245A	09/18/95 KVN	Fixed Quantum LP105A HDD failure if plug PCI VGA and
;			booting from floppy
;R246	09/15/95 KVN	Fix [Btv MediaStream controller] VGA card show EPA
;			logo bug
;R245	09/14/95 KVN	Fix CD-ROM can't found when plug Buslogic BT-956C card
;R244	08/28/95 RCH	Added 4x clock support for AMD-X5 or Cyrix/M1/M1sc
;R243	09/07/95 TNY	Add Higher_133MHz_Tbl definition ( 127 -> 129 )
;R242	09/07/95 RCH	Screen become abnormal while displaying energy star
;			logo if WD PCI/VGA plugged
;Rmm	09/06/95 KVN	Pcipost.asm move to f000 from e000 segment
;R241	08/30/95 RCH	Don't clear display buffer at address b000H, because
;			DEC/21130 PCI/VGA hang at initial stage
;R240	08/30/95 RCH	Kill c000H & e000H ROM scanning for VGA if the BIOS 
;			is for PCI_BUS, because the ROM address for PCI is
;			compressed in system BIOS.
;R206A	08/29/95 DNL	Fix UMC886B internal KBC bug (if no ketboard or no PS2 mouse
;			present, that KBC will work incorrect)
;R239	08/25/95 KVN	This file is moved into area E0000-E7FFFH , and the
;			MODBIN should be modified, otherwise referenced 
;			segment is wrong
;R238	08/24/95 AVN	Fixed P54C 120MHz Show 133MHz.
;R237	08/24/95 KVN	Adjust E000 segment start offset at 0
;R236A	08/23/95 RCH	Fixed error coding of R236 to support SMBase using
;			E000H
;R236	08/22/95 DNL	Modify some code to save code space
;R235	08/18/95 RCH	Intel has stoped developing P55CT , so MTRR is used
;			only for P6.
;R234	08/17/95 RCH	Some 486 chipsets have maximum DRAM size limit,so
;			define "MAX_DRAM_SIZE" to limit DRAM sizing.
;			ex. "MAX_DRAM_SIZE EQU 800H" means 128Mb maximum
;R233	08/16/95 RCH	BIOS will load default from "auto table" if CMOS 
;			failed in POST 0BH according CPU clock, but at this
;			moment the CPU_CLOCK in G_RAM is 00H , so system hang
;R232	08/14/95 RAY	Add BIOS.CFG switch: E_CODE_START_FROM_0
;R231	08/14/95 RCH	Some customers assign IRQ 9 for PCI , this cause
;			system hang while warm booting, so don't enable IRQ 9
;			by default.
;R230	08/11/95 RCH	Kill duplicate codes
;R229	08/11/95 RCH	Fixed error coding in routine "Reset_Kb"
;R228	08/04/95 RCH	Clear all variable MTRRs before memory sizing for P6
;R227	08/04/95 RCH	"PNP_Final_Init" still need POST data in stack, so
;			calling this routine earlier
;R201A	08/03/95 RAY	No_Support_4_IDE should placed after "include bios.cfg"
;R226	08/03/95 RAY	Add BIOS.CFG switch Skip_Cache_Size_If_None
;R200A	07/31/95 KVN	Move "F000_call_proc" to avideo.asm for F000_call
;			"SND_SPKR"
;R225	07/29/95 RAY	If user press "DEL" key for setup, skip clearing
;			the rest of memory so that entering setup will become
;			faster!
;R224	07/28/95 DNL	Define "IDE_PRIMARY_ONLY" to support no slave IDE mode
;R223	07/25/95 KEN	Support fixed-config for PCI and ISA/PNP devices.
;R219A	07/21/95 KVN	Remove HDD access mode error
;R222	07/19/95 RCH	System hang while warm booting if assigned IRQ for PCI
;			is IRQ 9.
;R221	07/18/95 KVN	Clear E000h shadow before call int 19h for emm386.exe
;R220	07/17/95 RCH	Set A0000-FFFFF as UC(Uncache) region for P6 or P55CT
;R219	07/15/95 KVN	Added HDD access mode error
;R207A	07/14/95 KVN	If HDD is standard type don't check sylinder
;R217	07/14/95 RCH	Clear PS2 mouse flag is user select disable in setup
;R216	07/12/95 RCH	Special patch for screen garbage after boot from DOS
;R215	07/10/95 RCH	Turn on traditional IRQs to speed up booting if no
;			is not installed
;R214	07/08/95 KVN	Replace (F000_call ...) to (call F000_...)
;R213	07/08/95 KVN	Added HDD CHS/LBA/LRG mode auto set function
;R212	07/07/95 LRY	Automatically set RTC year as 1995 if we notice
;			current century is neither 1900 nor 2000
;R211	07/05/95 KEN	Fixed code mistake
;R210	07/01/95 KEN	Modify the initializing of ISA/PnP devices before PCI
;			devices.
;R209	06/30/95 RCH	Added 200Mhz PENTIUM CPU support
;R208	06/29/95 DNL	Reset KBC after initialization PS2 mouse to fix UMC886B
;			internal KBC bug
;R207	06/28/95 KVN	Show HDD 'NONE' when is none drive and set auto mode
;R206	06/27/95 KVN	Add Ide detect counter
;R205	06/20/95 RCH	Display 133Mhz instead of 132Mhz for P6
;R204	06/19/95 KVN	Fixed SIS496/497 RECTRON board POST hang at FP_isntall
;			when CMOS failure
;R203	06/19/95 RCH	Kill some dummy codes
;R194B	06/17/95 RCH	Don't program A0000-BFFFF region as USWC even CPU is
;			P6 and let it control by CMOS setup
;R202	06/16/95 KVN	Fixed some time memory test hang at POST_49S
;R201	06/14/95 KVN	Open Support_4_IDE feature become standard feature
;R194A	06/14/95 RCH	Don't program A0000-BFFFF region as USWC if CPU is
;			is not P6
;R200	06/13/95 KVN	Reduce Post_func_call and F000_call code size
;R199	06/13/95 RAY	Fix bug of Error Halt Level
;			This bug was caused by upgrading our BIOS to compress
;			version in which BIOS ROM checksum error will no
;			longer needed (If checksum error, Boot Block BIOS
;			will function !)
;R198	06/10/95 RAY	Modify codes so that segment 1000:0-1000:FFFF will
;			not be used as scratch or temporary data area !
;			Thus, the combined option ROMs will not be killed
;			during POST !
;R197	06/09/95 KVN	Open Post_Auto_IDE_Detect feature become standard
;R196	06/09/95 DNL	Added Cyrix M1 CPU 4 clock mode support
;R195	06/09/95 KVN	Call AUTO_CDROM_DETECT at POST_99S for [LG CD-ROM (
;			GCD-R540B 4X)]
;R194	06/08/95 RCH	Added P55CT & P6 MTRR programming
;R192	05/31/95 KVN	Fix none cursor when define "NO_SYSTEM_CONFIG" and
;			extrn error
;R191	05/30/95 RCH	BIOS need to set PS2 mode for SMC93X and NS306, other
;			wise KB can not work.
;R190	05/30/95 RAY	All super IO initialization codes are collected in
;			SUPERIO.ASM. Define NEW_SUPERIO_KERNEL in BIOS.CFG
;			for this
;R189	05/30/95 RCH	BIOS must reset KB earlier if LANCE(LT38C41) + FUJITSU
;			KB , otherwise system become very slow during memory
;			test, But reset KB failure in this case for some
;			combinations of KB and PS2 mouse.
;R188	05/23/95 DNL	Support new BIOS structure
;R187	05/23/95 KVN	Fixed get offset error bug if DGROUP
;R186	05/13/95 DNL	Added Cyrix M1 CPU support
;R185	05/12/95 TNY	Fixed not clear RAM when Warm-Boot.
;R184	05/11/95 RAY	Clean any unexpected data in KB's output buffer
;			so that: 1. the KB200 works properly with a PS2 mouse
;				    attached (ESC key fail to skip memory testing)
;				 2. any DEL key pressed before screen comes up
;				    can not enter setup
;R112A	05/08/95 KVN	if "Turbo_Pin_Handler" compile codes relocated
;R164E	05/08/95 HTR	Don't do Wait_Refresh1, otherwise VIA 82C42N fail with
;			"Keyboard Error"
;R183	04/21/95 RAY	For PNP BIOS:
;			1. To prevent system enter Green status during PNP
;			   ROM initialization, PNP_BootDev_Init & PNP_OptROM_Init
;			   should be called before PM_INIT
;			2. CP_Install should be done before IRQs are assigned
;			   to PCI & PNP devices
;R164D	04/20/95 HTR	Insert delay for Disable KB interface otherwise
;			JETKEY failed with beep.
;R182	04/19/95 RAY	Automatically load RTC century as 2000 if we notice
;			that the current year is below 1980
;R181	04/17/95 RCH	Added "PS2_Setupable" option to turn on/off PS2 mouse
;R168A	04/11/95 DNL	If onboard SRAM size vey large (above 512K), then the
;			screen no display message for a long time
;R169A	04/10/95 RCH	The routine to check CMOS battery status moved to
;			post_11 , so destroy CMOS routine should be re-writed
;R180	04/07/95 DNL	Fixed bug of some M/Bs boot from FDD failed when P24T
;			installed (like UMC8880)
;R179	04/06/95 RCH	Some M/Bs always set battery failed every power on
;			reset (like RECTRON SiS/496/497), so don't check
;			battery power optional.
;R178	03/31/95 RCH	Toggle 8042 output pin to measure CPU clock become
;			optional, if the M/B is 386 and the speed is control
;			by 8042 , turn on this switch
;R177	03/31/95 RCH	The 3COM ethernet card boot ROM use 5000:0000 as
;			temporary buffer before booting, so don't destroy
;			content of this area
;R176	03/31/95 AVN	Fixed INTEL P54C-120 Clock 120MHz Show 133MHz.
;R175	03/30/95 RCH	Show 133 & 167 instead of 132 & 166
;R133A	03/27/95 KEN	Move PnP_Early_Init prior to Ct_Early_Shadow
;R174	03/23/95 KVN	Fix [Trident-TGUI9660 + driver] move screen block hang
;			when in windows program
;R173	03/22/95 KVN	Support HDD 32Bit access auto detect
;R164C	03/21/95 RCH	Disable KB interface during KB selftest, otherwise
;			JETKEY failed with "kebyard error"
;R172	03/21/95 KEN	Fixed UNIX can't boot problem caused by DRAM garbage
;R171	03/20/95 BEN	Added codes for Notebook Power Management.
;R164B	03/17/95 RCH	Move KBC reset routine from POST_15 to POST_61 due
;			to keyboard error with PS2 mouse & some special
;			KB plugged simultanesly
;R170	03/16/95 TNY	Clear screen more early for SIS496/496 with AMD/DX4
;			cannot boot.
;R169A	03/17/95 KVN	Fixed can't display "CMOS battery failed" message when
;			CMOS battery failure
;R164A	03/15/95 RCH	Fixed "NO keyboard error" for UMC chipset built-in KBC
;R169	03/15/95 BEN	Fixed for the RTC battery fail error message didn't
;			show when RTC battery charge failed.
;R168	03/15/95 DNL	Added Cyrix M9 CPU support
;R167	03/15/95 RCH	Don't issue memory write before memory sizing ,
;			otherwise UMC/890 system hang at POST_5s after
;			hardware reset with SST flash ROM.
;R166	03/14/95 RCH	Some M/Bs set CMOS 0DH bit 7 to "0" to implement
;			CMOS clear function ,and this bit will detected
;			at POST 7S and 0EH bit 7 will be high if 0DH bit 7
;			is cleared.
;R165	03/10/95 RAY	Move 64kb compressed SCSI ROM instead of 16kb from
;			0:0 to 6800:0 because diff SCSI(NCR, AHA7850) ROM
;			located at diff decompress addr.
;R164	03/09/95 RCH	Disable PS2 mouse interface earlier, otherwise
;			system can not pass KB selftest at POST_15 if KB &
;			mouse are plugged together
;R163	02/28/95 AVN	Added Onboard I/O Detect by Auto.
;R162	02/21/95 DNL	Don't care RTC update bit when check RTC date & time
;			boundary, because some RTC will hang-up
;RXXX	02/20/95 RAY	Duplicate NCR810 ROM from 0:8000 to 7000:0 to prevent
;			some option ROMs from accidentally destroy it
;R159	02/14/95 RCH	Don't support special modular for video or option ROM
;			to save more space
;R158	02/07/95 RCH	Check "clear password" function later for displaying
;			message
;R156	02/07/95 RCH	Test memory triple times instead of five times
;R154	01/24/95 RAY	ifdef	NEW_IDE_MODE_3
;				show HDD mode
;			else	;NEW_IDE_MODE_3
;				show HDD type
;			endif	;NEW_IDE_MODE_3
;R61A	01/18/95 DNL	Added TI486SXL2-66 support
;R151	01/11/95 RCH	Fixed warm boot keyboard lock bug when use JETKey-v5.0
;			+ Key-Pro keyboard.
;R150	01/11/95 RAY	Add No_TICPU_Support & No_386_Support option
;R149	01/10/94 RCH	Open function E820H to support memory over 64Mb
;R148	01/10/95 RAY	Add No_586_Support option
;R147	01/10/95 DNL	Fixed bug of system halt during warm boot under WINDOWS V3.X
;R143A	01/09/95 RCH	Show 83 & 63Mhz instead of 80 & 60 for P24T CPU
;R146	01/07/95 RCH	Added table for P55C-150,P54CT-150,P54CT-166 and
;			P54CT-180
;R145	01/06/95 RCH	The INTEL P54CS is a double clock CPU ,add extra
;			table for this CPU, we assume only have 2 types(
;			60x2 and 66x2)
;R144	12/29/94 RCH	Use INTEL's factor for measure CPU clock for IBM 486
;			DLC3
;R143	12/23/94 RAY	Tune speed testing for P24T
;R115A	12/21/94 DNL	Avoid some Mainboard test 8254 will system halt.
;R142	12/19/94 DNL	Avoid some Mainboard test DMA will system halt.
;R141	12/19/94 KVN	Added Multiprocessor Detect & display codes
;R138	11/09/94 KVN	Fixed MSD.EXE utility 'DISK Drives' test error
;R137	10/29/94 RCH	Added function E820H to support memory beyond 64Mb
;			for WINDOWS NT v3.5
;R134B	10/24/94 DNL	Fixed Am486DX2 CPU type detection incorrect bug
;R136	10/22/94 RCH	Align all procedure to 4 bytes boundary
;R001	12/29/94 RCH	Mask E000-EFFF shadow if 128k BIOS used
;R000	10/28/94 RCH	Don't blank out screen if it is power up POST
;R132A	10/21/94 BEN	Check if the EPA logo font can not load by our program
;			then call the VGA BIOS function call to load EPA font.
;R135	10/11/94 RCH	Don't touch port 92H , The EFAR 802G new chipset fail
;			with this port
;R134A	10/07/94 DNL	Fixed error coding for AMD486DX4
;R134	10/07/94 DNL	Added AMD486DXL4 CPU support
;R133	10/06/94 KEN	Add PNP_BIOS entry pointer.
;R132	10/05/94 BEN	Change load EPA logo font method for the MAG PCI VGA
;			card that load user character font function call
;			is fail in MGA VGA card.
;R131	10/03/94 RCH	Don't support manufacture loop any more.
;R126A	10/03/94 RCH	This routine cause Jetkey failure
;R130	09/27/94 RAY	Add No_8259_Mask_Test option to skip post 21, 22
;R122A	09/26/94 DNL	Load RTC with pratical value(e.g. 1-1-94) if RTC
;			exceed limit
;R129	09/21/94 AVN	Change Show String under SETUP/DOS for Support 4 IDE.
;R128	09/21/94 RCH	Some intelligent I/O cards initialize I/O port during
;			option ROM executing, BIOS have to initial I/O after
;			ROM initialization.
;R127	09/14/94 RAY	Clear whole B000 segment to blank
;R126	09/10/94 RCH	System sometimes show "KEYBORAD ERROR" and hang
;R125	09/10/94 RCH	Change EISA error message, don't show error slot
;			anymore.
;R124	09/10/94 RCH	Check main BIOS checksum only, don't care of message
;			checksum and do it earlier befor try_shadow
;R123A	09/10/94 RCH	Let override function be non-standard .
;R123	09/06/94 RAY	Add No_Override_Key Option
;R117A	08/29/94 KVN	Change check P54C clock boundary for special
;R122	08/26/94 RAY	Load RTC with pratical value(e.g. 1-1-94) if RTC
;			exceed limit
;R121	08/19/94 RCH	Turn on IRQ 9 before booting , because some sound
;			card testing program report IRQ 2 fail if IRQ is
;			disable
;R120	08/17/94 KVN	Added POST auto IDE detect function
;R119	08/04/94 RCH	Added IDE 32bit transfer by using "IDE_32BIT_SUPPORT"
;R118	08/02/94 RCH	Move enable parity routine from POST 81 to POST 82
;			if not , the port B parity always disable by PCI
;R117	07/29/94 RCH	Change check boundary for P54C clock qualification
;R116	07/28/94 RCH	Show "-S" for CPU only BIOS with power management
;R115	07/28/94 AVN	Avoid some Mainboard test 8254 will system halt.
;R114	07/22/94 RCH	The CPU clock will be 50Mhz in CPU_CLOCK even the
;			system is 60 or 66Mhz for P54C CPU.
;R113	07/20/94 BEN	Added No_Cyrix_Mark_For_M6M7 definition for special
;			customer that don't show Cyrix CPU type.
;R112	07/18/94 RAY	if "No_Turbo_Pin_Handler" do not compile codes reloated
;R111	07/18/94 RCH	Some adaptor cards can not initiate successfully due
;			to ealier ROM shadowing. But for some chipsets the
;			ROM shadow should be done before memory testing. So
;			we change the shadow structure.
;			First  - Shadowing adaptor ROM before memory testing
;			Second - Disable adaptor ROM shadow before adaptor
;				 ROM initialiation by calling routine
;				 "Ct_Disable_C8_To_DF_Shadow"
;			Third  - Re-shadow adaptor ROM after ROMs initial
;R110	07/15/94 RCH	Fixed setting TI CPU to double clock destroying
;			coprocessor flag.
;R109	07/09/94 RCH	Upgrade EISA code into v4.50G
;R108	07/04/94 KVN	Inhibit interrupt available before CT_CACHE routine
;R107	07/04/94 KVN	Fixed up Cpu internal Clock calculate error
;R106	07/01/94 RCH	Always test all memory , ignore EISA?ECU configuration
;R105	06/30/94 KVN	Fixed up CIRRUS CL-GD5434-HC-AF PCI VGA card bug
;R104	06/23/94 KVN	Added 'NO_EPA_LOGO' support don't want show EPA logo
;R103	06/23/94 BEN	Added 'NO_WAIT_RTC_UPDATE_ON' definition for some M/B
;			delay a long time in post 83S.
;R102	06/08/94 RAY	Show HDD E & F in System Configuration Table
;R101	06/01/94 KVN	Modify codes to support HDD LBA & LARGE mode
;R76A	05/25/94 RCH	Don't set 8254 channel to mode 2, because IBM Diag
;			v2.03 fails on serial/parallel testing
;R100	05/21/94 RCH	Don't turn on IRQ 9 for PCI Bus, system hang if IRQ 9
;			is level trigger
;R99	05/19/94 RCH	Fixed real time incorrect due to shadowing
;R98	05/18/94 RCH	Set double-clock mode if measured CPU clock is 50 or
;			66Mhz for P24C
;R97	05/11/94 RAY	Show cache size = 'None' if setup setting is disabled
;R96	05/09/94 DNL	Fixed P24C CPU clock detection incorrect bug
;R95	04/28/94 RAY	Limit the no of times of decreasing the intensity of
;			color in Routine: Show_light_dark to prevent some
;			VGA cards from running a infinite loop!
;R94	04/28/94 RAY	Modify Routine: Show_light_dark to save code
;R93	04/27/94 RAY	Double CPU_INT_CLOCK[BP] for TI486SXLC2
;R92	04/25/94 RAY	Modify show memory size routine
;R89A	04/19/94 RAY	Recover R89 because R90 use BH
;R91	04/18/94 RAY	Determine if it is a P54C CPU by checking if the CPU
;			clock is over 70Mhz (P54C is 1.5X CPU)
;R90	04/18/94 RAY	Measure_CPU_Speed: save the actual tested CPU speed
;			in CPU_INT_CLOCK[BP] for showing clock
;R89	04/18/94 RAY	Measure_CPU_Speed: compare BL,AL(results of KB low
;			speed & high speed) instead of BX,AX because the
;			speed results in BL
;R83A	04/18/94 RAY	R83 becomes invlid
;R88	04/14/94 RAY	Modify code for showing KB lock
;R87	04/13/94 DNL	Fixed bug for show total memory size mistake
;R86	04/11/94 KVN	Set IBM cpu clock detect is special.
;R85	03/25/94 RAY	Don't include .EXT files any more
;R84	03/24/94 RAY	Add Hook to PMU.ASM: Ct_PM_Final_Init
;R79A	03/23/94 RCH	The adaptec/7870 init failure is caused by odd POST
;			stack, It is solved by change stack from odd to even
;			in atbase.asm
;R21A	03/22/94 RAY	Fix OS/2 v2.1 boot failure when EXT MEM > 64M
;			EXT MEM must be multiple of 64k for stupid OS/2!!!
;R83	03/19/94 RAY	Lock Cyrix registers before boot
;R82	03/17/94 DNL	Added TI486SXLC/TI486SXLC2 support
;R81	03/16/94 RAY	Move Evaluation message to upper part of screen
;R80	-------- ---	---------
;R78A	03/02/94 KVN	Fixed POST error when used JETkey v5.0 and some keyboard
;			after warm-boot.
;R79	02/21/94 RCH	Fixed Adaptec/7870 PCI/SCSI initial fail bug
;R78	02/19/94 RCH	Read input port instead of 64h to check keylock pin
;R77	02/19/94 RCH	Added password clear function
;R76	02/17/94 RCH	Change 8254 channel 0 from mode 3 to mode 2 to enhance
;			performance for PC-BENCH 7.0
;R75	02/04/94 DNL	Fixed BIOS coding mistake
;R74	02/01/94 DNL	Fixed BIOS coding mistake
;R69A	02/01/94 RCH	Don't change factor for P24C CPU clock detection
;R73	01/27/94 DNL	Memory Size: show "1024" instead of "640"
;R72	01/26/94 KVN	Fixed up UMC vga card color cannot became dark.
;R71	01/24/94 RCH	Get_Real_Value become public routine
;R70	01/20/94 KVN	Recover EPA using color when is dark.
;R69	01/17/94 RCH	Fixed P24C CPU clock detection incorrect bug
;R68	01/14/94 RCH	Some ISA adaptor destory BP during initilization
;R67	01/13/94 RCH	Fixed floppy boot failure for PM_SUPPORT
;R66	01/12/94 RCH	Change CPU clock detection factor for U5
;R65	01/11/94 RCH	Some customer don't display system configuration
;R64	01/10/94 RCH	Disable fast gate A20 for 92H port
;R63	01/04/93 RCH	Don't Show award logo if no PM support
;R62	12/30/93 BEN	Added CFG_VIDEO_MODE for special initial video after
;			VGA BIOS initial.
;R61	12/29/93 KVN	Added TI486SXL2 support
;R60	12/24/93 RCH	Added TI486SXL support
;R59	12/16/93 RCH	Added INTEL/P24C support
;R58	12/13/93 RCH	Added CYRIX/486SLC2 support
;R57	12/11/93 RCH	Special routine for PCI expansion ROM scan
;R56	12/07/93 RCH	Send a dummy code to keyboard controller for light
;			green power down check
;R55	12/05/93 KVN	Add swap A and B drive function.
;R54	11/25/93 RAY	New method to detect S-Series CPU
;R53	11/22/93 RAY	Move PM_INIT from POST 79 to POST 82 after option ROM
;			scanning. This is to avoid system sleep inside the
;			option ROM's code for some ROM take a long time to
;			initial.
;R00			Initial Revision

.386P
;[]-----------------------------------[]
;
;   Award Software 386/486 BIOS
;	  Power-On Self-Test
;   Initial Revision 17-Apr-1991
;
;
;	Copyright (C) 1991
;	Award Software, Inc.
;	All Rights Reserved
;[]-----------------------------------[]

.XLIST

;R201A ifndef	No_Support_4_IDE					;R201
;R201A Support_4_IDE		EQU	1				;R201
;R201A endif	;No_Support_4_IDE					;R201

		INCLUDE BIOS.CFG

ifndef	No_Support_4_IDE					;R201A
Support_4_IDE		EQU	1				;R201A
endif	;No_Support_4_IDE					;R201A
;R378 start
ifdef RPB_ENABLED                   ; RXX
    include rpb.cfg
endif ; RPB_ENABLED
;R378 end
		INCLUDE COMMON.EQU
		INCLUDE POST.EQU
		INCLUDE ATORGS.EQU
		INCLUDE PORT61.EQU
		INCLUDE 8042.EQU
		INCLUDE 8259.EQU

		INCLUDE COMMON.MAC
		INCLUDE POST.MAC
		INCLUDE USERINT.MAC

;R85		INCLUDE ATORGS.EXT
;R85		INCLUDE USERINT.EXT
;R85		INCLUDE MOUSE.EXT
;R85		INCLUDE AUTO_CFG.EXT
;R85		INCLUDE ATBASE.EXT
;R85		INCLUDE AKBRD.EXT
;R85		INCLUDE SHADOW.EXT
;R85		INCLUDE CACHE.EXT
;R85		INCLUDE SETSPEED.EXT
;R85		INCLUDE MATHCOP.EXT
;R85		INCLUDE FPINSTAL.EXT
;R85		INCLUDE HDINSTAL.EXT
;R85		INCLUDE SETUP.EXT
;R85		INCLUDE A20.EXT
;R85		INCLUDE CPU.EXT
;R85		INCLUDE CPINSTAL.EXT
;R85		INCLUDE AMODTAB.EXT
;R85		INCLUDE POSTMSG.EXT
;R85		INCLUDE CHIPSET.EXT
;R85		INCLUDE CT_TABLE.EXT
		INCLUDE BTROMSEG.EQU			;R396
;R436 - starts
ifdef	DOUBLE_BYTE_LANGUAGE				
		extrn	fProc_Get_Language_Type:far	
		extrn	Init_Int10h:near		
		extrn	UnInit_Int10h:near		
endif	;DOUBLE_BYTE_LANGUAGE				
;R436 - ends

ifdef	Support_SumScr_Item				;R432
		extrn	SumScr_Item:near		;R432
endif	;Support_SumScr_Item				;R432

ifdef	CUSTOM_LCD_OUTPUT				;R421
                extrn   Lcd_Display_Msg:far         	;R421
endif;	CUSTOM_LCD_OUTPUT				;R421

;R394 - Start
ifdef	HPM_Support
		extrn	Post_init_hpm:Near
		extrn	HPM_32bit_Entry:Near
		extrn	Get_HDD_Information:Near	;R394B
endif	;HPM_Support
;R394 - End

;R384 - start
 ifdef	FDD_ACCESS_BY_PASSWORD
  ifdef	Double_Password
	extrn	Disable_SuperIO_FddPort:near
	extrn	FddAccess_Item:near
  endif;	Double_Password
 endif;	FDD_ACCESS_BY_PASSWORD
;R384 - end

;R313AIFDEF	USB_SUPPORT				;R313
;R313A		extrn	usb_kbd:near		;R313
;R313AENDIF	;USB_SUPPORT				;R313
ifdef	USB_SUPPORT				;R332
		extrn	Usb_Final_Init:near	;R332
		extrn	LMEM_RESERVED:abs	;R380
endif	;USB_SUPPORT				;R332

ifdef	PCI_BUS					;R375
		extrn	Build_MsPciIrq:near	;R375
endif;	PCI_BUS					;R375

		extrn	Prg_P6_USWC:near	;R360

ifndef No_Post_Auto_IDE_Detect			;R197
Post_Auto_IDE_Detect	equ	1		;R197
endif ;No_Post_Auto_IDE_Detect			;R197

	 	extrn	SYSTEM1_BYTE:byte	;R408

ifndef	No_Show_PCI_Device			;R301A
;R301 - Start
ifdef	PCI_BUS
;R408	 	extrn	SYSTEM1_BYTE:byte      	;R324
		extrn	Get_CfgSpace_DWord:near
		extrn	DISP_BYTE_INT2:near
		extrn	DISP_WORD_INT4:near
		extrn	DISP_WORD_HEX4:near
		extrn	VBORDER:near		;R301B
;R351		extrn	Find_P2P:near		;R301B
endif	;PCI_BUS
;R301 - End
endif	;No_Show_PCI_Device			;R301A

;R109 - start
IF BUS_TYPE EQ EISA_BUS
		extrn	Eisa_Early_Init:near
		extrn	Init_Eisa_Slots:near
		extrn	Eisa_Error_Chk:near
endif;BUS_TYPE EQ EISA_BUS
;R109 - end

;R288 - start
ifdef	MP_TBL_SELECTABLE
		extrn	MP_Tbl_Item:near
;R296		extrn	MP_FP_Stru:near
endif;	MP_TBL_SELECTABLE
;R288 - end

;R296 - start
ifdef	MP_SUPPORT						
;R369		extrn	MP_FP_Stru:near				
;R369		extrn	MP_FP_CHKSUM:ABS			
;R369		extrn	MP_FP_LENGTH:ABS			
;R369		extrn	MP_FP_Stru:near				
;R369		extrn	MP_Config_Table:near			
;R369		extrn	MPCFG_LEN:ABS				
;R369		extrn	MP_CFG_CHKSUM:ABS			
;R369
;R369ifdef	NEW_INTEL_IOAPIC	   
;R369		extrn	IO_Int_Entry16:near
;R369		extrn	IO_Int_Entry17:near
;R369		extrn	IO_Int_Entry18:near
;R369		extrn	IO_Int_Entry19:near
;R369endif;	NEW_INTEL_IOAPIC	      
		extrn	MP_Final_Init:near	;R369
endif;	MP_SUPPORT						
;R296 - end

		extrn	OS_Select_Item:near			;R290


;R111 - start
ifndef	PCI_BUS							;R266B
		extrn	Ct_Disable_C8_To_DF_Shadow:near
endif;	PCI_BUS							;R266B
;R111 - end

;R181 - start
ifdef	PS2_SETUPABLE
		extrn	PS2_select_item:near
		extrn	Clear_Ps2Mouse_Flag:near	;R217
endif	;PS2_SETUPABLE
;R181 - end
		extrn	Special_KBC_Init:near		;R191

		extrn	Init_Apic:near			;R141
;R296		extrn	Show_Processor_Number:near	;R141

ifdef	IDE_32BIT_SUPPORT				;R119;R173A
	extrn	IDE_transfer_item:near			;R119;R173A
endif	;IDE_32BIT_SUPPORT				;R119;R173A

;R137 - start
QUERY_SYSTEM_ADDRESS_MAP	EQU	1		;R149
ifdef	QUERY_SYSTEM_ADDRESS_MAP
		extrn	ExtData1Kb:near
		extrn	ExtMem128Mb:near
		extrn	F000_Shadow_W:near
		extrn	F000_Shadow_R:near
endif;	QUERY_SYSTEM_ADDRESS_MAP
;R137 - end

;R85 - starts
		EXTRN	ROM_AND_CMOS:NEAR
		EXTRN	ROM_OR_CMOS:NEAR
		EXTRN	A20_OFF:NEAR
		EXTRN	A20_ON:NEAR
		EXTRN	AX_To_HEX3:NEAR
		EXTRN	BATTERY_FAIL_MSG:NEAR
		EXTRN	BCD_TO_BINARY:NEAR
		EXTRN	BIOS_INFORM_STR:BYTE
		EXTRN	BTM_LINE_CLR:NEAR
		EXTRN	BUFFER_8042_FULL:NEAR
		EXTRN	Cache_Init:NEAR
		EXTRN	CKSM_ERROR_MSG:NEAR
		EXTRN	CODE_START:NEAR
		EXTRN	COLDBOOT:NEAR
		EXTRN	COPYRIGHT_MSG:BYTE
		EXTRN	CPU_CACHE:NEAR
;R272		EXTRN	CPU_DISPLAY:NEAR
		EXTRN	CP_INSTALL:NEAR
		EXTRN	Ct_Auto_Check:NEAR
		EXTRN	CT_CACHE:NEAR
		EXTRN	CT_EARLY_SHADOW:NEAR
		EXTRN	Ct_Ext_Mem_Limit:NEAR
		EXTRN	Ct_Math_Detect:NEAR
		EXTRN	Ct_Option_Rom_Scan:NEAR
		EXTRN	Ct_Parity_Control:NEAR
		EXTRN	CT_REMAP:NEAR
		EXTRN	Ct_Show_Config:NEAR
		EXTRN	CURSOR_GET:NEAR
		EXTRN	CURSOR_ON:NEAR
		EXTRN	CURSOR_SET:NEAR
		EXTRN	CYRIX_INIT:NEAR
;R159		EXTRN	C_MOD_CK:NEAR
		EXTRN	DISP_DWORD_INT6:NEAR
		EXTRN	DISP_WORD_INT5:NEAR
		EXTRN	ENABLE_PARITY:NEAR
		EXTRN	EVAL_MSG:BYTE
		EXTRN	EVAL_MSG_CHKSUM:BYTE
		EXTRN	FIXED_DIAG_MSG:NEAR
		EXTRN	FLOPPY_MISMATCH_MSG:NEAR
		EXTRN	FLOPPY_RESET_MSG:NEAR
		EXTRN	FP_INSTALL:NEAR
		EXTRN	GET_CMOS:NEAR
		EXTRN	Get_CPU_Speed:NEAR
		EXTRN	HALT_ERR_MSG:NEAR
		EXTRN	HD_INSTALL:NEAR
		EXTRN	Init_Onboard_Io:NEAR
		EXTRN	INT_TBL:WORD
		EXTRN	IRET_VECT:NEAR
		EXTRN	SIGN_ON_CHKSUM:BYTE
		EXTRN	DISP_BYTE_HEX2:NEAR
;R251		EXTRN	KBD_A20_OFF:NEAR
		extrn	SPD_DEF:byte				;R251
		EXTRN	KBD_ERR_MSG:NEAR
		EXTRN	KB_OUT:NEAR
		EXTRN	KEY_LOCK_MSG:NEAR
		EXTRN	MEM_ERROR_MSG:NEAR
;R131		EXTRN	MFG_POST_MSG:NEAR
;R159		EXTRN	MODULAR_TABLE:WORD
;R159		EXTRN	MODULAR_VIDEO_TABLE:WORD
		EXTRN	MS_INSTAL:NEAR
		EXTRN	OK_MSG:NEAR
		EXTRN	OUT_8042:NEAR
		EXTRN	OUT_8042_FULL:NEAR
		EXTRN	OVERRIDE_ENABLE_STR:NEAR
;R395		EXTRN	Prg_Auto:NEAR
;R395		EXTRN	PRG_CHIPSET:NEAR
;R395		EXTRN	PRG_CHIPSET_DEFAULT:NEAR
		EXTRN	REDO:NEAR
		EXTRN	REPORT_ERR_WSPKR:NEAR
		EXTRN	RST_VECT:NEAR
		EXTRN	R_MOD_CK:NEAR
;R309		EXTRN	SECTOR_VERIFY_MSG:NEAR
		EXTRN	SEC_HRDWR_INTS:WORD
		EXTRN	SETSPEED:NEAR
		EXTRN	SETTINGS:BYTE
		EXTRN	Setup:NEAR
		EXTRN	SET_CMOS:NEAR
		EXTRN	SIGN_ON_MSG:BYTE
		EXTRN	SIGN_ON_MSG:BYTE
		EXTRN	SIZE_SYS_INITS:ABS
		EXTRN	SKIP_MEM_MSG:NEAR
		EXTRN	SND_SPKR:NEAR
		EXTRN	SYSTEM4_BYTE:BYTE
		EXTRN	SYSTEM5_BYTE:BYTE
		EXTRN	SYSTEM_BYTE:BYTE
		EXTRN	SYS_INITS:WORD
ifndef	MULTI_LANGUAGE_SUPPORT				;R436
		EXTRN	TEST_EXT_MSG:NEAR
endif	;MULTI_LANGUAGE_SUPPORT				;R436
		EXTRN	TEST_MEM_MSG:NEAR
		EXTRN	TO_ENTER_SETUP:NEAR
;R309		EXTRN	UNABLE_INIT_MSG:NEAR
;R309		EXTRN	UNABLE_RECALIBRATE_MSG:NEAR
;R309		EXTRN	UNABLE_RESET_MSG:NEAR
;R219 start
;R219A		extrn	HDD0_MODE_NOT_MATCH_MSG:near
;R219A		extrn	HDD1_MODE_NOT_MATCH_MSG:near
;R219A		extrn	HDD2_MODE_NOT_MATCH_MSG:near
;R219A		extrn	HDD3_MODE_NOT_MATCH_MSG:near
		extrn	Disp_Access_mode:near
;R219 end
		EXTRN	USER_BEGIN:NEAR
		EXTRN	VCRLF:NEAR
		EXTRN	VID_SWITCH_MSG:NEAR
		EXTRN	VNORMAL:NEAR
		EXTRN	VREVERSE:NEAR
		EXTRN	WAIT_REFRESH:NEAR
		EXTRN	WORD_CHECKSUM:BYTE
;R409 - start
if	STD_Function		EQ	1
		EXTRN	Show_PM_Config:NEAR
		EXTRN	Notebook_Resume:NEAR
endif	;STD_Function		EQ	1
;R409 - end
ifdef	PM_SUPPORT
		EXTRN	PM_Sign_On_Msg:NEAR
	IFDEF	NoteBook_Power_Management			;R171
;R366		EXTRN	Check_0V_Resume:NEAR			;R171
;R409		EXTRN	Show_PM_Config:NEAR			;R171
;R409		EXTRN	Notebook_Resume:NEAR			;R171
;R366A		extrn	F000_Check_0V_Resume:near		;R366
;R391	ifndef	NO_LCD_DISPLAY					;R298
;R391		LCD_CRT_OPTION		EQU	1		;R298
;R391	endif	;NO_LCD_DISPLAY					;R298
	ENDIF	;NoteBook_Power_Management			;R171
;R394	ifdef	ONBOARD_PCI_VGA					;R386
;R394		extrn	PCI_VGA_INFO:near			;R386
;R394	endif	;ONBOARD_PCI_VGA				;R386
endif;	PM_SUPPORT
;R85 - ends

	ifdef	ONBOARD_PCI_VGA					;R394
		extrn	PCI_VGA_INFO:near			;R394
	endif	;ONBOARD_PCI_VGA				;R394
;R102 - starts
ifdef	Support_4_IDE
		extrn	HDDE_ITEM:near
		extrn	HDDF_ITEM:near
endif	;Support_4_IDE
;R102 - ends

;R163 - start
ifdef	AUTO_CFG_IO
		extrn	AUTO_CFG_IDE_PORT:near
endif;	AUTO_CFG_IO
;R163 - end

		extrn	Unlock_Cyrix:near		;R263
		extrn	Lock_Cyrix:near			;R263
.LIST

		extrn	Display_String:near
		extrn	Display_Char:near
		extrn	Chk_Intel_S_CPU:near		;R54
		extrn	Read_Cmos_To_Stack:near
;R340		extrn	GateA20_Item:near
ifndef	Support_1_FDD					;R377
		extrn	SwapFloppy_Item:near
endif	;Support_1_FDD					;R377
		extrn	Set_High_Speed:near
		extrn	Load_Auto_Cfg_D4:near
		extrn	Ct_Disable_E000_Vga:near
		extrn	Ct_Disable_Onboard_Vga:near
		extrn	Ct_Enable_Onboard_Vga:near
		extrn	Ct_Enable_E000_Vga:near
;R355		extrn	CPU_Type_Clk:near
;R279		extrn	LOGO_OFFSET:near
		extrn	QuickPost_Item:near
		extrn	CLR_SKIP_MEM_MSG:near
		extrn	Read_Memory:Near
		extrn	Later_cache_Sizing:near
		extrn	A20_Byte:byte
;R408		extrn	Virus_Item:near
		extrn	Enter_Setup_Check:near
		extrn	HaltOn_Item:near
;R53		extrn	PM_INIT:near
		extrn	Verify_Password:near
		extrn	Fproc_Verify_Password:far	;R350
		extrn	Save_All_Cmos:near
ifndef	NO_PARITY_ITEM					;R340
		extrn	Parity_Item:near
endif;	NO_PARITY_ITEM					;R340

ifdef	Turbo_Pin_Handler				;R112A
;R112A ifndef	No_Turbo_Pin_Handler			;R112
		extrn	TB_SW_Input_Item:near
;R112A endif	;No_Turbo_Pin_Handler			;R112
endif	;Turbo_Pin_Handler				;R112A
		extrn	CT_FINAL_INIT:near
		extrn	DayLight_Item:near
		extrn	NumLock_Item:near

ifndef	HIDE_STD_ITEMS						;R297
 ifndef	NO_SPEED_ITEM						;R390
		extrn	BootSpeed_Item:near
 endif;	NO_SPEED_ITEM						;R390
		extrn	TypeRate_Item:near
		extrn	TypeDelay_Item:near
		extrn	TypeSpeed_Item:near
endif;	HIDE_STD_ITEMS						;R297

		extrn	Get_Item_Setup_D4:near
		extrn	Get_Item_Bios_D4:near
		extrn	GetItem_Value:near
		extrn	GetItem_Cmos:near			;R277
;R331		extrn	BootSeq_Item:near			;R277
		extrn	Restore_Cyrix_Reg:near
		extrn	Out_8042_Pin:near
		extrn	VGA_Buffer:near
		EXTRN	DRIVE_A_ITEM:Near
		EXTRN	HDDC_ITEM:Near
ifndef	Support_1_FDD						;R377
		EXTRN	DRIVE_B_ITEM:Near
endif	;Support_1_FDD						;R377
		extrn	Get_HDD_CMOS_Info:near			;R207
		extrn	FDPTE_Drive0:near			;R387
		EXTRN	Read_Item_Value:Near
		EXTRN	Video_Item:Near
		EXTRN	Show_SIX_DIGIT:Near
		Extrn	Get_Cache_Size:Near
;R425		EXTRN	Transfer_Hdd_Parms:Near
		extrn	Wr_Cpu:near
		extrn	Restore_Speed:near
		extrn	IntCache_Item:near
		extrn	ExtCache_Item:near

;R32		extrn	Disable_F000_Shadow:near
		extrn	E000_Shadow_R:near
		extrn	E000_Shadow_W:near
		extrn	F000_Shadow_R:near
		extrn	F000_Shadow_W:near
		extrn	C000_Shadow_R:near
;R287		extrn	C000_Shadow_W:near
		extrn	C000_Shadow_RW:near		;R287
		extrn	C800_Shadow:near
		extrn	CC00_Shadow:near
		extrn	D000_Shadow:near
		extrn	D000_Shadow:near
		extrn	D400_Shadow:near
		extrn	D800_Shadow:near
		extrn	DC00_Shadow:near
;R001		extrn	E000_Shadow:near
;R001		extrn	E400_Shadow:near
;R001		extrn	E800_Shadow:near
;R001		extrn	EC00_Shadow:near
		extrn	Ct_Shadow_Alone_Check:near
		extrn	Ct_Shadow_Allow:near
;R32		extrn	F000_Item:near
ifndef	NO_VIDEO_BIOS_SHADOW_ITEM				;R429
		extrn	C000_Item:near
endif;	NO_VIDEO_BIOS_SHADOW_ITEM				;R429
ifndef	No_C8_DF_Shadow_Item			;R407
		extrn	C800_Item:near
		extrn	CC00_Item:near
		extrn	D000_Item:near
		extrn	D400_Item:near
		extrn	D800_Item:near
		extrn	DC00_Item:near
endif	;No_C8_DF_Shadow_Item			;R407
;R001		extrn	E000_Item:near
;R001		extrn	E400_Item:near
;R001		extrn	E800_Item:near
;R001		extrn	EC00_Item:near
		extrn	Shadow_Dr:near
		extrn	Move_Codes:near
		extrn	Clear_Parity:near
ifdef	QUERY_SYSTEM_ADDRESS_MAP
		extrn	Setup_PS2:Near
endif;	QUERY_SYSTEM_ADDRESS_MAP
		extrn	Do_F000_Shadow:Near
ifdef	No_Cyrix_Mark_For_M6M7		;R113
		extrn	Cyrix_Detect:near
endif	;No_Cyrix_Mark_For_M6M7 	;R113

		EXTRN		HDDD_ITEM:Near
		EXTRN		Get_VarString_Offset:Near
		EXTRN		AX_To_DEC3:Near 		;R91
		EXTRN		AX_To_DEC2:Near
		extrn	Mono_Style:near
ifdef	PM_SUPPORT
;R279		extrn	LOGO_SEGMENT:near			;128K
		extrn	PM_Option_Check:near
		extrn	EARLY_PM_INIT:near
		extrn	Cfg_Video_Mode:near
ifndef NO_EPA_LOGO					;R104
		extrn	EPA_pattern:NEAR
endif ;NO_EPA_LOGO					;R104
		extrn	Award_Mark_Font:Near
		extrn	Ct_PMRAM_Use_SYSRAM:near
		extrn	PM_INIT:near
		extrn	Ct_PM_Final_Init:Near			;R84
;R391	ifdef	LCD_CRT_OPTION					;R298
;R391		extrn	Switch_Display:near			;R298
;R391	endif	;LCD_CRT_OPTION					;R298
;R391	ifdef	TV_OUT_SUPPORT					;R363
;R391		extrn	TV_Out_Display:near			;R363
;R391	endif	;TV_OUT_SUPPORT					;R363
endif;	PM_SUPPORT
;R391 start
	ifdef	LCD_CRT_OPTION					;R298
		extrn	Switch_Display:near			;R298
	endif	;LCD_CRT_OPTION					;R298
	ifdef	TV_OUT_SUPPORT					;R363
		extrn	TV_Out_Display:near			;R363
	endif	;TV_OUT_SUPPORT					;R363
;R391 end
ifdef	PCI_BUS
		extrn	PciRom_Before_Init:near 		;R57
		extrn	PciRom_After_Init:near			;R57
		extrn	Copy_ROM:Near			;R198
;R379	ifdef	CONFIG_MECHANISM_1			;R351
;R379		extrn	fProc_Qualify_PciBus:Far	;R351
;R379	endif	;CONFIG_MECHANISM_1			;R351
endif;	PCI_BUS

ifdef	PNP_BIOS					;R133
;R350		extrn	PNP_System_Resource:near	;R133
;R350		extrn	PNP_Early_Init:near		;R133
;R350		extrn	PNP_Video_Init:near		;R133
		extrn	PNP_BootDev_Init:near		;R133
		extrn	PNP_OptROM_Init:near		;R133
		extrn	PNP_Final_Init:near		;R133
		extrn	PNP_IPL_Init:near		;R133
;R350		extrn	PNP_Disp_Logo:near		;R133
;R350		extrn	PNP_SuperIO_Init:near		;R223
endif	;PNP_BIOS					;R133
		extrn	Tran_HDD_User_Type:Near 	;R138

ifdef	CLEAR_PASSWORD_SUPPORT					; R77
		extrn	Ck_Password_Switch:near 		; R77
endif	;CLEAR_PASSWORD_SUPPORT 				; R77

ifdef	PnP_BIOS					;R262
		extrn	Kill_Onboard_PnP_IO:near	;R262
endif	;PnP_BIOS					;R262

		extrn	Init_Onboard_Super_IO:near	;R190
		extrn	Init_Onboard_AUDIO:near		;R259
ifdef	NO_SYSTEM_CONFIG					;R192
		extrn	AX_To_DEC3:Near 			;R192
		extrn	Show_SIX_DIGIT:near			;R192
endif	;NO_SYSTEM_CONFIG					;R192
;R307;R195 start
;R307ifdef	CD_ROM
;R307		extrn	AUTO_CDROM_DETECT:near
;R307endif	;CD_ROM
;R307;R195 end
		extrn	Preint_19:near				;R221
;R330A		extrn	Reset_INT13:near			;R307
		extrn	hrdskio:near				;R330A
;R428		extrn	int_hdisk1:near				;R330A

		extrn	Cmos_Check_Sum:near			;R256
ifdef	VGA_SHARE_MEMORY					;R269
		extrn	Ct_Share_Memory_Size:near		;R269
endif	;VGA_SHARE_MEMORY					;R269

;M01 - starts
ifdef RPB_ENABLED
	extrn	rpbf_post_code:near
	extrn	rpbf_reinit:near
	extrn	rpb_f000_is_running:near        ; M03
	extrn	rpb_install_late_services:near  ; M03
	extrn	rpb_disable_late_services:near  ; M03
endif ; RPB_ENABLED
;M01 - ends

		EXTRN	POST_3S:NEAR
		EXTRN	POST_4S:NEAR
		EXTRN	POST_5S:NEAR
		EXTRN	POST_6S:NEAR
		EXTRN	POST_7S:NEAR
		EXTRN	POST_8S:NEAR
		EXTRN	POST_9S:NEAR
		EXTRN	POST_10S:NEAR
		EXTRN	POST_11S:NEAR
		EXTRN	POST_12S:NEAR
		EXTRN	POST_13S:NEAR
		EXTRN	POST_14S:NEAR
		EXTRN	POST_15S:NEAR
		EXTRN	POST_16S:NEAR
		EXTRN	POST_17S:NEAR
		EXTRN	POST_18S:NEAR
		EXTRN	POST_19S:NEAR
		EXTRN	POST_20S:NEAR
		EXTRN	POST_21S:NEAR
		EXTRN	POST_22S:NEAR
		EXTRN	POST_23S:NEAR
		EXTRN	POST_24S:NEAR
		EXTRN	POST_25S:NEAR
		EXTRN	POST_26S:NEAR
		EXTRN	POST_27S:NEAR
		EXTRN	POST_28S:NEAR
		EXTRN	POST_29S:NEAR
		EXTRN	POST_30S:NEAR
		EXTRN	POST_48S:NEAR
		EXTRN	POST_49S:NEAR
		EXTRN	POST_50S:NEAR
		EXTRN	POST_51S:NEAR
		EXTRN	POST_52S:NEAR
		EXTRN	POST_53S:NEAR
		EXTRN	POST_54S:NEAR
		EXTRN	POST_55S:NEAR
		EXTRN	POST_56S:NEAR
		EXTRN	POST_57S:NEAR
		EXTRN	POST_58S:NEAR
		EXTRN	POST_59S:NEAR
		EXTRN	POST_60S:NEAR
		EXTRN	POST_61S:NEAR
		EXTRN	POST_62S:NEAR
		EXTRN	POST_63S:NEAR
		EXTRN	POST_64S:NEAR
		EXTRN	POST_65S:NEAR
		EXTRN	POST_66S:NEAR
		EXTRN	POST_67S:NEAR
		EXTRN	POST_68S:NEAR
		EXTRN	POST_69S:NEAR
		EXTRN	POST_70S:NEAR
		EXTRN	POST_71S:NEAR
		EXTRN	POST_72S:NEAR
		EXTRN	POST_73S:NEAR
		EXTRN	POST_74S:NEAR
		EXTRN	POST_75S:NEAR
		EXTRN	POST_76S:NEAR
		EXTRN	POST_77S:NEAR
		EXTRN	POST_78S:NEAR
;R378 start
ifdef RPB_ENABLED                   ; RXX
ifdef RPB_POSTMENU_ENABLED          ; M01
    EXTRN RPB_POST_MENU:NEAR
endif ; RPB_POSTMENU_ENABLED        ; M01
endif ; RPB_ENABLED
;R378 end

;R334A		extrn	IDE_Drive_Max_Num:byte		;R334
;R334A		extrn	Int13_original_address:dword	;R334
;R336A		extrn	SCSI_drive_Max_num:near		;R336
		extrn	SCSI_drive_Max_num:byte		;R336A
		extrn	IDE_Drive_Max_Num:byte		;R336
		extrn	Int13_original_address:dword	;R336
		extrn	DSK_VECT:near			;R336C
ifdef	E000_SMI_SUPPORT				;R342
		extrn	PM_Init_SMBASE:near		;R342
endif	;E000_SMI_SUPPORT				;R342
;R349 start
ifdef	NEW_IDE_MODE_3
		extrn	IdeA_Mode_Item:near
		extrn	IdeB_Mode_Item:near
ifndef  ONCHIP_2ND_ALWAYS_DISABLE		;R388
	ifdef	Support_4_IDE			;R427
		extrn	IdeC_Mode_Item:near
		extrn	IdeD_Mode_Item:near
	endif;	Support_4_IDE		   	;R427
endif;  ONCHIP_2ND_ALWAYS_DISABLE		;R388
endif	;NEW_IDE_MODE_3
;R349 end
		extrn	HDISK_PARMS:near	;R353
		extrn	E000_Enter_Prot_mode:near	;R382
		extrn	E000_Back_Real_Mode:near	;R382

;R389 start
ifdef NET_PC_SUPPORT
		extrn	Store_SYSID_to_Shadow:near
endif ;NET_PC_SUPPORT
;R389 end

;R329 - start
ifdef	Superio_Need_Do_Before_Boot
		extrn	Superio_Before_Boot:near
endif	;Superio_Need_Do_Before_Boot
;R329 - end

;R202 start
F000_call	MACRO	func_addr
		LOCAL	Ret_addr
		push	0e000h
		push	offset cs:Ret_addr
		push	offset F000_func_end
if ((.TYPE func_addr) and 10h)			;func_addr is register?
		push	func_addr		;Yes,direct push
else
		push	offset func_addr
endif
		FAR_JMP <OFFSET F000_VECT>,0F000H
Ret_addr:
		ENDM
;R202 end

;[]---------------------------[]
;
;   Stack init
;
;[]---------------------------[]

BIOS_STK	SEGMENT USE16 AT 0H
		ORG	400H
BIOSSTK_TOP	LABEL	WORD
		ORG	5B00H
POSTSTK_TOP	LABEL	WORD

BIOS_STK	ENDS

;[]---------------------------[]
;
;   Low memory init (1st 64k)
;
;[]---------------------------[]

G_RAM		SEGMENT USE16 AT 0

		ORG	04H*4
		INCLUDE SEG_0.INC

		ORG	400H
		INCLUDE G_RAM.INC

G_RAM		ENDS

		PAGE

		extrn	F000_func_end:Near	;128k
		extrn	F000_VECT:Near		;128k

		extrn	CPU_DISPLAY:Near		;R354
;R355		extrn	DISP_INTEL_S_CPU:Near		;R354
		extrn	Disp_Extra_CPU_Info:Near	;R355
		extrn	CONVERT_P6L2_CACHE:Near		;R354
IF	BIOS_SUPPORT_686				;R354
		extrn	P6_L2Cache_Control:near		;R354
ENDIF	;BIOS_SUPPORT_686				;R354

IF	BIOS_SUPPORT_586				;R355
		extrn	Try_Show_PRating:Near		;R355
		extrn	Check_K6_CPU:Near		;R437
ENDIF	;BIOS_SUPPORT_586				;R355

;R437		extrn	Check_K6_CPU:Near		;R356

if	BIOS_SUPPORT_586
		extrn	Prg_K6_Write_Allocate:Near	;R358
endif	;BIOS_SUPPORT_586

ifndef	NO_SYSTEM_CONFIG			;R379A
;R379 start
		extrn	SHOW_SYSTEM_CFG:near
		extrn	XCALL_PROC:near
ifndef	MULTI_LANGUAGE_SUPPORT				;R436
		extrn	RIGHT_SIDE:near
endif	;MULTI_LANGUAGE_SUPPORT				;R436
		extrn	CDROM_STR:near
		extrn	ARMD_STR:near
		extrn	IOMEGA_ZIP_STR:near
		extrn	NONE_STR:near
		extrn	MB_STR:near
		extrn	HDD_MODE_STR:near
;R379 end
endif	;NO_SYSTEM_CONFIG			;R379A

EGROUP		GROUP	ECODE
DGROUP		GROUP	FCODE				;R187
ECODE		SEGMENT USE16 PARA PUBLIC 'ECODE'
		ASSUME	CS:EGROUP,DS:G_RAM,ES:EGROUP

;R237 ifdef	SMBASE_USE_E000H					;R236A
;R237 		db	8000h dup(0ffh)				;R236A
;R237 endif;	SMBASE_USE_E000H					;R236A

;R236 ifndef	E_CODE_START_FROM_0				;R232
;R236		db	8000h dup(0ffh)
;R236 endif	;E_CODE_START_FROM_0				;R232

		public	POST_VECT
		public	POST_func_end
POST_VECT:
		PUBLIC	E000_VECT
E000_VECT:
		retn
POST_func_end:
		retf

;****************************************
;*					*
;*   POST ROUTINE JUMP TABLE / DATA	*
;*					*
;****************************************


;
; These are common POST routines and have RAM and stack
;
STD_POST_CODE	EQU	3

STD_POST_TESTS:
		DW	offset POST_3S
		DW	offset POST_4S
		DW	offset POST_5S
		DW	offset POST_6S
		DW	offset POST_7S
		DW	offset POST_8S
		DW	offset POST_9S
		DW	offset POST_10S
		DW	offset POST_11S
		DW	offset POST_12S
		DW	offset POST_13S
		DW	offset POST_14S
		DW	offset POST_15S
		DW	offset POST_16S
		DW	offset POST_17S
		DW	offset POST_18S
		DW	offset POST_19S
		DW	offset POST_20S
		DW	offset POST_21S
		DW	offset POST_22S
		DW	offset POST_23S
		DW	offset POST_24S
		DW	offset POST_25S
		DW	offset POST_26S
		DW	offset POST_27S
		DW	offset POST_28S
		DW	offset POST_29S
		DW	offset POST_30S
		DW	0

IF BUS_TYPE EQ EISA_BUS

EISA_POST_CODE	EQU	48

EISA_POST_TESTS:
		DW	0

ENDIF ;BUS_TYPE

		public	ISA_POST_CODE
ISA_POST_CODE	EQU	48

		public	ISA_Post_Tests
ISA_Post_Tests:
		DW	0

		public	COMMON_POST_CODE
		COMMON_POST_CODE EQU	48
COMMON_POST_CODE EQU	48

		public	COMMON_POST_TESTS
COMMON_POST_TESTS:
		DW	offset POST_48S
		DW	offset POST_49S
		DW	offset POST_50S
		DW	offset POST_51S
		DW	offset POST_52S
		DW	offset POST_53S
		DW	offset POST_54S
		DW	offset POST_55S
		DW	offset POST_56S
		DW	offset POST_57S
		DW	offset POST_58S
		DW	offset POST_59S
		DW	offset POST_60S
		DW	offset POST_61S
		DW	offset POST_62S
		DW	offset POST_63S
		DW	offset POST_64S
		DW	offset POST_65S
		DW	offset POST_66S
		DW	offset POST_67S
		DW	offset POST_68S
		DW	offset POST_69S
		DW	offset POST_70S
		DW	offset POST_71S
		DW	offset POST_72S
		DW	offset POST_73S
		DW	offset POST_74S
		DW	offset POST_75S
		DW	offset POST_76S
		DW	offset POST_77S
		DW	offset POST_78S
		DW	offset POST_79S
		DW	offset POST_80S
		DW	offset POST_81S
		DW	offset POST_82S
		DW	offset POST_83S
		DW	offset POST_84S
		DW	offset POST_85S
		DW	offset POST_86S
		DW	offset POST_87S
		DW	offset POST_88S
		DW	offset POST_89S
		DW	offset POST_90S
		DW	offset POST_91S
		DW	offset POST_92S
		DW	offset POST_93S
		DW	offset POST_94S
		DW	offset POST_95S
		DW	offset POST_96S
;R383 - start
ifdef	POST_98s_before_97s
		DW	offset POST_98S		
endif	;POST_98s_before_97s
;R383 - end
		DW	offset POST_97S
ifndef	POST_98s_before_97s		;R383
		DW	offset POST_98S
endif	;POST_98s_before_97s		;R383
		DW	offset POST_99S
		DW	0

;[]==============================================================[]
;
; HaltSystem:
;
;	Sits and loops forever while displaying the last POST
;	code.
;
;Saves: NONE
;
;Entry: BP	POST code to display
;
;Exit:	NEVER
;
;Author: Award
;Date:	 04/18/90
;
; Name | Date	    | Description
; ---------------------------------------------------------------
; TIM | 18-Apr-90   | Update to 4.0
;
;[]==============================================================[]

		PUBLIC	HALTSYSTEM
HALTSYSTEM	PROC	NEAR
		cli
		jmp	short $
HALTSYSTEM	ENDP

;[]==============================================================[]
;
;NORMAL_POST_TESTS:
;
;	Execute POST tests 4-26. Tests after post 7 will have
;	the RAM stack set up.
;
;
;Saves: NONE + NO STACK
;
;Entry: NONE
;Exit:	NONE
;
;Author: Award
;Date:	 04/18/90
;
; Name | Date	    | Description
; ---------------------------------------------------------------
; DC  | 17-May-90   | Fixed bugs in nested ROM_CALL
; TIM | 18-Apr-90   | Update to 4.0, modularize for EISA
;
;[]==============================================================[]

			public	NORMAL_POST_TESTS
NORMAL_POST_TESTS	PROC	NEAR

;
;	The last of the these POST routines starts the EISA/ISA
;	section of POST and thus this call should never return.
;	If it does, we issue a POST code and halt.
;

		mov	cx,STD_POST_CODE
		mov	di,offset STD_POST_TESTS
		call	Ram_Post_Tests

		jmp	HaltSystem

NORMAL_POST_TESTS ENDP

;[]==============================================================[]
;
;RAM_POST_TESTS:
;
;	Used to call a series of POST tests after there is RAM
;	initialized and a stack set up.
;
;
;Saves: NONE
;
;Entry: CS:DI	Array of POST routine pointers (0000h terminated)
;	CX	POST code to use
;
;Exit:	CX	Last POST code used + 1
;
;Author: Tim Lewis
;Date:	 04/18/90
;
; Name | Date	    | Description
; ---------------------------------------------------------------
; TIM | 18-Apr-90   | Initial revision
;
;[]==============================================================[]

		public	RAM_POST_TESTS
RAM_POST_TESTS	PROC	NEAR
;R434 - start
ifdef	Support_Keyboard_Clear_CMOS
		mov	al,Keyboard_Clear_CMOS_CMOS NMI_OFF
		call	F000_Get_Cmos
		push	ax			;save the CMOS value to AX first!
endif;	Support_Keyboard_Clear_CMOS
;R434 - end


ram_pt_1:
;R378 start
ifdef RPB_ENABLED                 ; RXX
;M01     cmp   cx,14                   ; RPB initialized in POST_14S
;M01     jle   normal_post_output
;M01     extrn rpb_post_code:near       
;M01     call  rpb_post_code           ; send post code to rpb terminal

;M01 - starts
		push	ax                      ; M01
		mov	ax,cx                   ; send post code in AX M01
		F000_call rpbf_post_code      ; send post code to rpb terminal
		pop	ax
;M01 - ends
normal_post_output:
endif ; RPB_ENABLED
;R378 end
		POST_CODE cx
;R434 - start
ifdef	Support_Keyboard_Clear_CMOS
		pop	ax			;get back the CMOS value to
		push	ax			;AX now and push back to stack

		cmp	al,OVERRIDE_VALUE	;if the "Keyboard_Clear_CMOS"
		jne	short Normal_POST	;was set, do below sepcial things!

    ;;if the current POST is 32h(50), restore the Password CMOS value now to
    ;;maintain the security function if CMOS is only cleared by Keyboard!
    ;;However, it only restore the Supervisor Password to CMOS.
		cmp	cx,32h
		jne	short Check_POST_78S

		mov	al,Keyboard_Clear_CMOS_PassW_CMOS NMI_OFF
		call	F000_Get_Cmos
		mov	byte ptr CMOS11[bp],al	;restore the security CMOS to stack
		mov	ah,al
		mov	al,CMOS11 NMI_OFF
		call	F000_Set_Cmos		;restore the security CMOS to CMOS

		mov	al,Keyboard_Clear_CMOS_Temp_PassW NMI_OFF
		call	F000_Get_Cmos
		mov	byte ptr CMOS1C[bp],al	;restore the Password content to stack
		mov	ah,al
		mov	al,CMOS1C NMI_OFF
		call	F000_Set_Cmos	 	;restore the Password content to CMOS

		mov	al,(Keyboard_Clear_CMOS_Temp_PassW+1) NMI_OFF
		call	F000_Get_Cmos
		mov	byte ptr (CMOS1C+1)[bp],al ;restore the Password content to stack
		mov	ah,al
		mov	al,(CMOS1C+1) NMI_OFF
		call	F000_Set_Cmos		;restore the Password content to CMOS

		jmp	short Normal_POST	;go on POSTing

    ;;if the current POST is 4Eh(78), skip it and go to do POST 4Fh(79) first
    ;;(checking Password POST routine in order to maintain the security)!
Check_POST_78S:
		cmp	cx,4Eh
		jne	short Check_POST_79S
		inc	cx			;increase the POST Code number
		POST_CODE cx			;send it out
		inc	di			;point to POST_79S entry point
		inc	di
;R434A - start
	ifndef	NO_EPA_LOGO
	  ifndef  Graphics_Post
		extrn	Clear_EPA_Area:near	;clear EPA Logo Area
		call	Clear_EPA_Area		;before POST_79S
	  endif;  Graphics_Post
	endif;	NO_EPA_LOGO
;R434A - end
		jmp	short Normal_POST

    ;;if the current POST is 4Fh(79), skip it and go to do POST 50h(80).
Check_POST_79S:
		cmp	cx,4Fh
		jne	short Check_POST_80S
		inc	cx			;increase the POST Code number
		POST_CODE cx			;send it out
		inc	di			;point to POST_80S entry point
		inc	di
		jmp	short Normal_POST

    ;;if the current POST is 50h(80), skip it and go back to do POST 4Eh(78)!
Check_POST_80S:
		cmp	cx,50h
		jne	short Normal_POST
		dec	cx			;adjust the POST Code number
		dec	cx			;
		POST_CODE cx			;send it out
		sub	di,4			;point back to POST_78S entry point
						;and go on POSTing!
Normal_POST:
endif;	Support_Keyboard_Clear_CMOS
;R434 - end

;R422A - start
 ifdef	SHOW_DOTs_EACH_POST
	;Display '.' before each POST for BIOS with only one custom
	;message display to indicate the system activity
		push	ds
		push	es
		push	si


		mov	ax,G_RAM
		mov	ds,ax
		ASSUME	ds:G_RAM

		mov	ax, offset IRET_Vect	;offset address
		cmp	word ptr ds:[Int10],ax	;INT 10H handler is
						;IRET ?
		jne	short NormalPOSTScreen	;no, it's normal POST

		mov	ax, 0B800H		;VGA display buffer		
		mov	es, ax			;setup segment

		mov	si, ds:[SYSTEM_FLAG+1]	;get cursor position
		inc	si
		inc	si			;next cusor position

		mov	word ptr es:[si+2*33], 072EH	;character to write
		mov	ds:[SYSTEM_FLAG+1], si	;save cursor position

NormalPOSTScreen:
		pop	si		
		pop	es
		pop	ds
 endif;	SHOW_DOTs_EACH_POST
;R422A - end

ifdef	CUSTOM_LCD_OUTPUT			;R421
                mov     al, cl                  ;R421
                call    Lcd_Display_Msg         ;R421
endif;	CUSTOM_LCD_OUTPUT
;R412 - start
ifdef	ALERTPACK_Support
		pushad
		call	Send_ALERTPACK_Post
		popad
endif;	ALERTPACK_Support
;R412 - end
		push	seg DGROUP		;R416 always point FS=DGROUP
		pop	fs			;R416 in POST stage
		mov	ax,cs:[di]
		inc	di
		inc	di

		or	ax,ax
		jz	short ram_pt_8

		push	di
		push	cx
;R426 - start
ifdef	OEM_POST_SUPPORT
		extrn OEM_Service_Roution_Post_Code:near
		call  OEM_Service_Roution_Post_Code  ; exectue OEM special function 
						     ;	code
endif	;OEM_POST_SUPPORT
;R426 - end
		call	ax
		pop	cx
		pop	di
		jc	short ram_pt_8

		inc	cx
;R434		jmp	short ram_pt_1
		jmp     ram_pt_1		;R434

ram_pt_8:
;R434 - start
ifdef	Support_Keyboard_Clear_CMOS
		pop	ax			;restore the stack pointer
endif;	Support_Keyboard_Clear_CMOS
;R434 - end

		ret
RAM_POST_TESTS	ENDP

;R412 - start
ifdef	ALERTPACK_Support
Send_ALERTPACK_Post	proc	near
		push	cx
		cmp	cl,63h			;is the last post?
		mov	al,03h			;no, enable the ALERTPACK
		jne	short @F
		mov	al,00h			;yes, disable the ALERTPACK
	@@:
		mov	cl,06h
	    	call	Set_ALERTPACK
		pop	ax
		mov	cl,0ah
	    	call	Set_ALERTPACK
		ret
Send_ALERTPACK_Post	endp

;[]==============================================================[]
;Input	: CL - register index
;Output : AX - Value read
;[]==============================================================[]
Set_ALERTPACK	proc	near

		push	ax
		push	cx

		mov	dx,SMBus_Port +04h
		mov	al,ALERTPACK_ID		;ALERTPACK write cmd
		out	dx,al
		NEWIODELAY
		NEWIODELAY

		call	Chk_SMBus_READY 

		pop	ax
		mov	dl,03h
		out	dx,al			;Index
		NEWIODELAY
		NEWIODELAY

		pop	ax
		mov	dl,05
		out	dx,al			;Data0
		NEWIODELAY
		NEWIODELAY

		mov	dl,02h
		mov	al,48h
		out	dx,al			;write data
		NEWIODELAY
		NEWIODELAY

		mov	cx,2000h
	@@:				
		newiodelay			
		loop	short @B

		call	Chk_SMBus_READY 

		ret
Set_ALERTPACK	endp

Chk_SMBus_READY	Proc	Near
		mov	dx,SMBus_Port + 0
		clc
		mov	cx,0100h
Chk_I2C_OK:
		in	al,dx		;get status
		or	al,al
		jz	short Clear_final

		test	al,04h		       
		jnz	short SMBus_Err	       

		test	al,01h		;busy ?
		jz	short Not_Smbusy
		call	WaitSmbus
Not_Smbusy:
		out 	dx,al
		loop	short Chk_I2C_OK
SMBus_Err:	
		out	dx,al				;R04
		NEWIODELAY				;R04
		in	al,dx		;get status	;R04
		NEWIODELAY				;R04
		test	al,04h				;R04
		jnz	short SMBus_Err			;R04
		stc
Clear_final:
		ret
Chk_SMBus_READY	Endp

WaitSmbus	proc	near			
		push	cx			
		mov	cx,100h
	@@:						
		loop	short @B		
		pop	cx			
		ret				
WaitSmbus	endp

endif;	ALERTPACK_Support
;R412 - end

;[]==============================================================[]
;
;POST_79S:
;
;	Check security and ask for password.
;
;Saves: NONE
;
;Entry: NONE
;Exit:	NONE
;
;[]==============================================================[]

		PUBLIC	POST_79S
POST_79S	PROC	NEAR



ifdef	PM_SUPPORT
;R258 - start
ifdef	MP_SUPPORT
;R337 ifdef	P6_BIOS_ONLY				;R333
;R337 		call	If_MP_PLUGGED	   
;R337 		jnc	short @F
;R337 endif	;P6_BIOS_ONLY				;R333

;R296 ;R288 - start
;R296 ifdef	MP_TBL_SELECTABLE
;R296 		mov	si,offset MP_Tbl_Item
;R296 		call	F000_GetItem_Value
;R296 		or	al,al			;MP enabled ?
;R296 		jnz	short Mp_Enabled
;R296 
;R296 	;destroy MP table due to only one CPU plugged
;R296 
;R296 		F000_CALL F000_Shadow_W		;F0000-FFFFF shadow R/W
;R296 
;R296 		push	0f000H			;get data segment at F000
;R296 		pop	ds
;R296 
;R296 		mov	si,offset MP_FP_Stru
;R296 		mov	byte ptr ds:[si],0	;destry MP signature
;R296 
;R296 		F000_CALL F000_Shadow_R		;F0000-FFFFF shadow RO
;R296 				
;R296 Mp_Enabled:
;R296 endif;	MP_TBL_SELECTABLE
;R296 ;R288 - end

endif;	MP_SUPPORT			   
;R258 - end


ifdef	E000_SMI_SUPPORT				;R342
		Call	PM_Init_SMBASE			;R342
		call	Ct_PMRAM_Use_SYSRAM		;R243
else	;E000_SMI_SUPPORT				;R342
		F000_call	Ct_PMRAM_Use_SYSRAM
endif	;E000_SMI_SUPPORT				;R342
		or	al,al
		jz	short @F

		mov	bx,G_RAM
		mov	ds,bx
		assume	DS:G_RAM

		mov	bx,SIZE_SYSRAM
		xor	ah,ah
		sub	bx,ax
		mov	SIZE_SYSRAM,bx

		shl	bx,6				; translate to segment
		mov	PMRAM_LOC,bx

	@@:
;R313AIFDEF	USB_SUPPORT	       				;R313
;R313A		call	usb_kbd				;R313
;R313AENDIF	;USB_SUPPORT					;R313
		ASSUME	DS:NOTHING

;R53		call	PM_INIT

;R403ifndef	EPA_LOGO_Use_Graphics				;R397
;R403ifndef FULL_SCREEN_LOGO			;R279A
ifndef	Graphics_Post				;R403
 ifndef	RESTORE_POSTSCN_FOR_ERROR		;R435
		test	byte ptr EQUIPMENT[bp],DT_MONO
		jnz	short @F
;R105 start
		mov	ax,1130h
		mov	bh,6
		push	bp
		int	10h
		mov	dx,bp
		pop	bp
		mov	bx,0e00h
		mov	cx,128*14
		mov	ax,es
		cmp	ax,STND_FONT_SEG[bp]
		jne	short @F
		cmp	dx,STND_FONT_OFF[bp]
		jne	short @F
		mov	bx,1000h
		mov	cx,128*16
@@:
;R105 end
		push	bp
		mov	ax,STND_FONT_SEG[bp]
		mov	es,ax
		mov	bp,STND_FONT_OFF[bp]
;R105		add	bp,128*14
;R414		add	bp,cx					;R105
		mov	ax,1100h
;R105		mov	bx,0e00h
;R414		mov	cx,122
;R414		mov	dx,80h		;start 80h
		mov	cx,251		;R414 reserve 5 char for award font
		xor	dx,dx		;R414 start from ASCII 0
		int	10h
		pop	bp
@@:
 endif;	RESTORE_POSTSCN_FOR_ERROR		;R435
endif;	Graphics_Post				;R403
;R403endif ;FULL_SCREEN_LOGO			;R279A
;R403endif;	EPA_LOGO_Use_Graphics		;R397
endif	;PM_SUPPORT

		push	word ptr CURSOR_X[bp]
		mov	al,02h
;R366A ;R366 - start
;R366A IFDEF	NoteBook_Power_Management
;R366A		Call	F000_Check_0V_Resume
;R366A		mov	al,1
;R366A		jnz	short @F
;R366A		mov	al,2
;R366A @@:
;R366A ENDIF	;NoteBook_Power_Management
;R366A ;R366 - end
;R350		F000_call	Verify_Password
		call	far ptr Fproc_Verify_Password	;R350
		pop	word ptr CURSOR_X[bp]

;R384 - start
 ifdef	FDD_ACCESS_BY_PASSWORD
  ifdef	Double_Password
	;now the ax contains supervisor hashed password

	test	byte ptr CMOS11[bp], 01h  	;booting need pass?
	jz	short NoSuperPassWord
	test	byte ptr CMOS11[bp], 02h    	;Super Password needed?
	jz	short NoSuperPassWord
	cmp	ax, CMOS1C[bp]			;super pass equal?
	je	short NoSuperPassWord		;no, it is user password
 	
	mov	si,offset FddAccess_Item	;get item CMOS value
	call	F000_GetItem_Value
	or	al,al				;FDD access for ALL ?
	jz	short NoSuperPassWord		;yes, don't disable FDD

	call	Disable_SuperIO_FddPort		;disable super I/O FDD port
;R402 start
	mov	ax,G_RAM
	mov	ds,ax
	and	word ptr ds:[HARDWARE],not 0c1h	;mask bit 0,6,7 to indicate none fdd drive
;R402 end
  NoSuperPassWord:
  endif;	Double_Password
 endif;	FDD_ACCESS_BY_PASSWORD
;R384 - end

;R434 - start
    ;;if the "Keyboard_Clear_CMOS" was set, skip to run the below program!
ifdef	Support_Keyboard_Clear_CMOS
		mov	al,Keyboard_Clear_CMOS_CMOS NMI_OFF
		call	F000_Get_Cmos
		cmp	al,OVERRIDE_VALUE
		je	short Is_Keyboard_Clear_CMOS
endif;	Support_Keyboard_Clear_CMOS
;R434 - end

ifndef	EPA_LOGO_Use_Graphics			;R397
ifndef No_Auto_Switch_to_Text		;R364
;R120		mov	ax,60dh
;R306		mov	ax,60ch 	;R120
		mov	bh,7
;R120		mov	cx,0c00h
;R306		mov	cx,0d00h	;R120
;R306 - starts
		mov	ah, 06h
		mov	al, 24
		sub	al, CURSOR_Y[bp]
		xor	cl, cl
		mov	ch, CURSOR_Y[bp]
;R306 - ends
		mov	dx,184fh
		int	10h
endif ;No_Auto_Switch_to_Text		;R364
endif;	EPA_LOGO_Use_Graphics			;R397
;R434 - start
ifdef	Support_Keyboard_Clear_CMOS
Is_Keyboard_Clear_CMOS:
endif;	Support_Keyboard_Clear_CMOS

		mov	ah,1			;restore the cursor type
		mov	cx,0607h		;and display it on screen
		int	10h			;(same as before enter pasword)
;R434 - end

		mov	dx,CURSOR_X[bp]
		cmp	dh,7
		jae	short @F
		mov	dh,7
@@:
		mov	ah,2
		xor	bh,bh
		int	10h

		clc
		ret
POST_79S	ENDP

;[]==============================================================[]
;
;POST_80S:
;
;	Write all of CMOS back to RAM
;
;Saves: NONE
;
;Entry: NONE
;Exit:	NONE
;
;[]==============================================================[]

		PUBLIC	POST_80S
POST_80S	PROC	NEAR

		mov	ax,G_RAM
		mov	es,ax

		and	es:[Init_err_flg],NOT IEF_SETUP_OK

ifdef	Bootblock_16K_Support					;R405
ifdef	Automatic_Load_Awdflash					;R405
ifNdef	No_Automatic_Load_Awdflash_InPOST			;R418
		and	es:[Init_err_flg],NOT IEF_AWDFLASH_OK	;R405
		and	es:[POST_FLAG],NOT AWD_Str_Show		;R405
endif	;No_Automatic_Load_Awdflash_InPOST			;R418
endif	;Automatic_Load_Awdflash				;R405
endif	;Bootblock_16K_Support					;R405

		mov	es:[Temp_BP],0

;R290 - start
;Set extended memory to 15Mb only if installed memory is more than 64Mb
;and running OS2 to patch OS2 can not report correct memory size for more
;than 64Mb.
		mov	si,offset OS_Select_Item
		call	F000_GetItem_Value
		or	al,al				;select OS2 ?
		jz	short Not_Above_64M

		cmp	dword ptr EXT_MEM_SIZE[bp],64*1024	;> 64Mb
		jbe	short Not_Above_64M

		mov	word ptr EXT_MEM_FOUND[bp],15*1024	;set 15Mb
Not_Above_64M:
;R290 - end

;R373-start
ifdef	Special_for_GIANTEC			
		mov	al,EQUIPMENT NMI_OFF		
		call	F000_Get_Cmos
		and	al,0F0h
		cmp	al,10h			; VGA : Absent ?
		jne	short @f
		and	byte ptr EQUIPMENT[bp],00001111b
		or	byte ptr EQUIPMENT[bp],00010000b
@@:
endif	;Special_for_GIANTEC
;R373-end

		F000_call	Save_All_Cmos

		clc
		ret
POST_80S	ENDP

;[]==============================================================[]
;
;POST_81S:
;
;	Enable parity, NMI, reset flags
;
;Saves: NONE
;
;Entry: NONE
;Exit:	NONE
;
;[]==============================================================[]
		PUBLIC	POST_81S
POST_81S	PROC	NEAR

		mov	ax,G_RAM
		mov	ds,ax
		assume	ds:G_RAM

		and	Init_Err_Flg, NOT IEF_IN_POST


comment %							;R173
;R119 - start
ifdef	IDE_32BIT_SUPPORT
		mov	si,offset IDE_transfer_item
		call	F000_GetItem_Value
		or	al,al
		jz	short @F

		or	POST_FLAG,IDE_32BIT_MODE;enable 32bit tranfer
@@:
endif;	IDE_32BIT_SUPPORT
;R119 - end
%								;R173
;R299A IFDEF	NoteBook_Power_Management			;R299
;R299A		mov	al,ds:NUMHDSKS				;R299
;R299A		mov	HDD_EXIST_Flag[bp],al			;R299
;R299A ENDIF	;NoteBook_Power_Management			;R299

;R397Aifdef	EPA_LOGO_Use_Graphics			;R397
;R397A		extrn	Switch_LOGO_To_Text:near	;R397
;R397A		call	Switch_LOGO_To_Text		;R397
;R397Aendif;	EPA_LOGO_Use_Graphics			;R397

ifdef	PNP_BIOS					;R210
		call	PNP_BootDev_Init		;R210
endif	;PNP_BIOS					;R210

		clc
		ret
POST_81S	ENDP

;R382 start
;=====================================================================
;Move_and_Clear_RAM_in_Prot:
;	Copy RAM data operate in protect mode
;Input : ESI=source address 
;	 EDI=target address
;	 ECX=count (unit is DWORD)
;	 CY =Clear source area data
;	 NC=Dont clear source area data
;Output: move data to target from souce and clear (or not) source area
;=====================================================================
Move_and_Clear_RAM_in_Prot:
		push	ds			;R382A
		push	es			;R382A
		pushf				;R382A
		cli				;R382A
		pushf				;save carry flag
		F000_call	A20_On		;R382A turn on a20 gate
		call	E000_Enter_Prot_mode
		mov	ax,ds
		mov	es,ax
		call	E000_Back_Real_Mode	;R415
		push	esi
		push	ecx
		cld
 		db	67h
 		rep	movsd			;move extend 128k data to 160000h
		pop	ecx
		pop	edi
		popf
		jnc	short @F
		xor	eax,eax
 		db	67h
 		rep	stosd			;clear 6000:0 for PCI ROM temp use
@@:
;R415		call	E000_Back_Real_Mode
		F000_call	A20_Off		;R382A turn off a20 gate
		popf				;R382A
		pop	es			;R382A
		pop	ds			;R382A
		ret

;R382 end

;[]==============================================================[]
;
;POST_82S:
;
;	Initialize option ROM's include Award modular table.
;
;Saves: NONE
;
;Entry: NONE
;Exit:	NONE
;
;[]==============================================================[]

		PUBLIC	POST_82S
POST_82S	PROC	NEAR
;R431 start
ifdef Replace_Int13_to_AHDSK
		mov	ax,G_RAM
		mov	ds,ax
		assume	ds:G_RAM
		mov	al,BootSel
ifdef CD_ROM
		cmp	al,7			;SCSI,A,C?
		je	short SCSI_First	;Yes,jump
		cmp	al,8			;SCSI,C,A?
		jne	short Not_SCSI_First	;Yes,jump
else ;CD_ROM
		cmp	al,5			;SCSI,A,C?
		je	short SCSI_First	;Yes,jump
		cmp	al,6			;SCSI,C,A?
		jne	short Not_SCSI_First	;Yes,jump
endif ;CD_ROM
SCSI_First:
		mov	ds:NUMHDSKS,0
		xor	ax,ax
		mov	es,ax
		mov	word ptr G_RAM:[13h*4],offset dgroup:DSK_VECT
Not_SCSI_First:
endif ;Replace_Int13_to_AHDSK
;R431 end
		push	bp

;R401 - start
ifdef	USB_SUPPORT				;R332
;R374A ifndef M1523B_USB  			;R374
  ifndef Dont_turn_cache_in_USB_Final_Init	;R365A
	;Disable internal cache			;R365 
		mov	al,FALSE		;R365 
		call	F000_Cpu_Cache		;R365 
  endif ;Dont_turn_cache_in_USB_Final_Init	;R365A
;R374A endif	;M1523B_USB  			;R374

ifndef	SMIHANDLE_IN_XGROUP	;R398
		call	Usb_Final_Init		;R332
;R398 - start
else	;SMIHANDLE_IN_XGROUP	
		Xcall	Usb_Final_Init		;R332
endif	;SMIHANDLE_IN_XGROUP	
;R398 - end

;R374A ifndef M1523B_USB   			;R374
  ifndef Dont_turn_cache_in_USB_Final_Init	;R365A
	;Restore internal cache			;R365 
		call	IntCache_Status 	;R365 
		jz	short CpuCache_Disable	;R365 
		mov	al,TRUE			;R365 
		call	F000_Cpu_Cache		;R365 
  CpuCache_Disable:				;R365
  endif ;Dont_turn_cache_in_USB_Final_Init	;R365A
;R374A endif	;M1523B_USB 			;R374
endif	;USB_SUPPORT				;R332
;R401 - end

;R389 start
ifdef NET_PC_SUPPORT
		call	E_F000_Shadow_W	
		CALL	Store_SYSID_to_Shadow
	;build SYSID BIOS Structure Table
	;      UUID Structure Format
	;      1394 ID Structure Format
		call	E_F000_Shadow_R
endif ;NET_PC_SUPPORT
;R389 end

;RXXX - starts
ifdef	PCI_BUS
;R165;duplicate another NCR ROM onto 7000:0
;R165		mov	si,0800h
;R165		mov	di,7000h
;R165		mov	cx,2000h
;R165 - starts
;R198;duplicate another SCSI ROM onto 68000h-77FFFh
;R198		mov	si,0000h
;R198		mov	di,6800h
;R198		mov	cx,8000h
;R165 - ends
;R198		F000_Call Move_Codes

;R198A ;R198 - starts
;R198A 
;R198A ;duplicate another SCSI ROM onto higher memory area
;R198A 
;R198A 		mov	si,0800h
;R198A 		mov	di,7000h
;R198A 		mov	al,1
;R198A 		mov	cx,32			;4k * 32 = 128k
;R198A ;R237 ifdef	SMBASE_USE_E000H			;R236
;R198A ;R237 		F000_Call Copy_ROM
;R198A ;R237 else	;SMBASE_USE_E000H			;R236
;R198A ;Rmm		Call Copy_ROM			;R236
;R198A 		F000_Call	Copy_ROM		;Rmm
;R198A ;R237 endif	;SMBASE_USE_E000H			;R236
;R198A ;R198 - ends

endif	;PCI_BUS
;RXXX - ends


;R111 - start
ifndef	PCI_BUS							;R266A
		pusha
		F000_CALL Ct_Disable_C8_To_DF_Shadow	;disable all adaptor
							;ROMs shadow
		popa
endif;	PCI_BUS							;R266A
;R111 - end


ifdef	DOUBLE_BYTE_LANGUAGE				;R436
		Call	Uninit_Int10h			;R436
		mov	ax,3				;R436
		int	10h				;R436
else	;DOUBLE_BYTE_LANGUAGE				;R436

;R403ifdef	EPA_LOGO_Use_Graphics			;R397A
ifdef	Graphics_Post					;R403
;R403A		extrn	Switch_LOGO_To_Text:near	;R397A
;R403A		call	Switch_LOGO_To_Text		;R397A
		test	byte ptr EQUIPMENT[bp],DT_MONO	;R403A
		jnz	short @F			;R403A
		cmp	byte ptr EPALOGO_FLAG[bp], 0ffh	;R403B;check clear screen
		je	short @F			;R403B
;R403B		test	byte ptr Post_Temp_Byte[bp],Text_POST;R403A
;R403B		jnz	short @F			;R403A
ifndef Dont_Switch_To_Text_Anyway	;R424
		mov	ax, 3h				;R403A
		int	10h				;R403A
endif ;Dont_Switch_To_Text_Anyway	;R424
		or	byte ptr Post_Temp_Byte[bp],Text_POST;R403A
	@@:						;R403A
endif;	Graphics_Post					;R403A
;R403endif;	EPA_LOGO_Use_Graphics			;R397A

endif	;DOUBLE_BYTE_LANGUAGE				;R436

ifdef	PCI_BUS 						;R382C
		F000_call	PciRom_Before_Init		;R382C
endif	;PCI_BUS 						;R382C

;R423A - start
ifdef	ACPI_Support
		cmp	dword ptr ACPI_TABLE_FLAG[bp],0
		jz	short No_ACPI_table
		mov	di,(ACPITBL_Expand_Address+1)*4;;;;;10h
		call	POST_decompress
		extrn	SetupACPI:near
		call	SetupACPI		;call to setup ACPI table
No_ACPI_table:
endif;	ACPI_Support
;R423A - end
;R382 start
		cmp	dword ptr EXT_MEM_SIZE[bp],1024		;R382B extent memory < 1MB
		jb	short @F				;R382B Yes,skip
		mov	esi,(dword ptr Xgroup_Segment shl 4)	;XGROUP segment
		mov	edi,150000h				;protect mode temp area
		mov	ecx,4000h				;size = 64k
		stc						;indicate clear source area
		call	Move_and_Clear_RAM_in_Prot		;move and clear them
@@:								;R382B
;R382 end
ifdef	PCI_BUS 						;R57
;R237 ifdef	SMBASE_USE_E000H			;R236
;R237 		F000_call	PciRom_Before_Init	;R57
;R237 else	;SMBASE_USE_E000H			;R236
;Rmm		call	PciRom_Before_Init	;R236
;R382A		F000_call	PciRom_Before_Init	;Rmm
;R237 endif	;SMBASE_USE_E000H			;R236
endif;	PCI_BUS 						;R57

;R159		lea	bx,Modular_Table ;128k
;128k		mov	bx,offset cs:Modular_Table ; just before cards
;R159		F000_call	C_Mod_Ck

ifndef	ISA_Init_after_PCI		;R404
ifndef	MICRO_STAR_ROM_DISK_Support	;R295
		mov	bx,0c800h
		mov	dx,0e000h
	ifdef	Special_ISA_ROM_Range			;R419
		extrn	Ct_Special_ISA_ROM_Range:near	;R419
		call	Ct_Special_ISA_ROM_Range	;R419
	endif	;Special_ISA_ROM_Range			;R419
		F000_call	R_Mod_Ck
;R295 - Start
else	;MICRO_STAR_ROM_DISK_Support
;By Micro_Star request:
;if HDD absent then follw normal operation
;else if ROM DISK present then starting address at D100H for skip ROM DISK
		mov	bx,0c800h
		mov	dx,0d000h
		F000_call	R_Mod_Ck

		mov	bx, 0D000h		;Assume scan from D000h
		push	ds
		push	G_RAM
		pop	ds
		cmp	byte ptr NUMHDSKS, 0;HDD exist?
		pop	ds
		je	short HDD_Absent

		push	ds
		push	es
		push	si
		push	edi

		mov	es, bx		;Scan D000:0 - D000:512
		xor	edi, edi
		push	cs
		pop	ds
Found_Loop:
		lea	si,ROM_DISK
		mov	cx, ROM_Disk_str_len
		rep	cmpsb
		jz	short Found_It
		ror	edi, 16
		inc	di
		mov	si, di
		ror	edi, 16
		mov	di, si
		cmp	di,4096
		jbe	short Found_Loop
Found_It:

		pop	edi
		pop	si
		pop	es
		pop	ds
		jne	short HDD_Absent	;ROM Disk Absent

		mov	bx, 0D100h		;Scan from D1000h
		jmp	short HDD_Absent
ROM_DISK:	db	'ROM Disk'
ROM_Disk_str_len	EQU	($ - offset ROM_Disk)
HDD_Absent:
		mov	dx, 0E000h		;Ending address
		F000_call	R_Mod_Ck
endif	;MICRO_STAR_ROM_DISK_Support
endif	;ISA_Init_after_PCI		;R404
;R295 - End

ifndef	PCI_BUS						;R240

		push	ds				;128k
		push	0f000h				;128k
		pop	ds				;128k
		lea	si,SYSTEM4_BYTE 		;128k
		test	byte ptr [si],ONBOARD_E_VIDEO	;128k
		pop	ds				;128k
;128k		test	cs:SYSTEM4_BYTE,ONBOARD_E_VIDEO
		jnz	short No_Onboard_E000h_3
		mov	bx,0e000h
		mov	dx,0e080h
		F000_call	R_Mod_Ck
No_Onboard_E000h_3:
endif;	PCI_BUS						;R240

		pop	bp					;R68
		push	bp					;R68

;R111 - start
		CALL	Try_Other_Shadow	;shadow adaptor ROM
;R111 - end

; M03 - start
ifdef RPB_ENABLED
  ; Need to have Preboot Manager snooping enabled before option
  ; ROM calls to handle option ROM setups which don't use INT 10h
  ; video calls.
  F000_call rpb_f000_is_running     ; check if interface enabled
  jc    short rpb_continue_post
  call  rpb_install_late_services   ; install video snooping
rpb_continue_post:
endif
; M03 - end

ifndef	LATER_CT_ROM_SCAN					;R300
		F000_call	Ct_Option_Rom_Scan
endif;	LATER_CT_ROM_SCAN					;R300

ifdef	PCI_BUS 						;R57
;Set post stack to f000h to get more space for adaptec/7870 to use
;R79A		push	fs		;save FS		;R79
;R79A		mov	fs,sp		;save SP		;R79
;R79A		mov	ax,0f000h				;R79
;R79A		mov	sp,ax		;set new SP		;R79

;R237 ifdef	SMBASE_USE_E000H			;R236
;R237 		F000_call	PciRom_After_Init	;R57
;R237 else	;SMBASE_USE_E000H			;R236
;Rmm		call	PciRom_After_Init	;R236
		F000_call	PciRom_After_Init	;Rmm
;R237 endif	;SMBASE_USE_E000H			;R236

;R210;R183 - starts
;R210ifdef	PNP_BIOS
;R210		call	PNP_BootDev_Init
;R210		call	PNP_OptROM_Init
;R210endif	;PNP_BIOS
;R210;R183 - ends

;R79A		mov	sp,fs		;restore SP		;R79
;R79A		pop	fs		;restore FS		;R79
endif;	PCI_BUS 						;R57

;R404 start
ifdef	ISA_Init_after_PCI
		mov	bx,0d800h
		mov	dx,0d880h
	ifdef	Special_ISA_ROM_Range			;R419
		extrn	Ct_Special_ISA_ROM_Range:near	;R419
		call	Ct_Special_ISA_ROM_Range	;R419
	endif	;Special_ISA_ROM_Range			;R419
		F000_call	R_Mod_Ck
endif	;ISA_Init_after_PCI
;R404 end
ifdef	LATER_CT_ROM_SCAN					;R300
		F000_call	Ct_Option_Rom_Scan		;R300
endif;	LATER_CT_ROM_SCAN					;R300

;R382 start
		cmp	dword ptr EXT_MEM_SIZE[bp],1024		;R382B extent memory < 1MB
		jb	short @F				;R382B Yes,skip
		mov	esi,150000h				;protect mode temp area
		mov	edi,(dword ptr Xgroup_Segment shl 4)	;XGROUP segment
		mov	ecx,4000h				;size = 64k
		stc						;indicate clear source area
		call	Move_and_Clear_RAM_in_Prot		;move and clear them
@@:								;R382B
;R382 end

; M03 - start
ifdef RPB_ENABLED
  F000_call rpb_f000_is_running     ; check if interface enabled
  jc    short rpb_cont2_post
  call  rpb_disable_late_services   ; disable till we boot
rpb_cont2_post:
endif
; M03 - end

Post_82s_Exit:
		pop	bp

;R296 - start
;R369ifdef	MP_SUPPORT
;R369
;R369;R296A		call	Build_PciIrq_MpTable
;R369
;R369ifdef	MP_TBL_SELECTABLE
;R369
;R369		call	If_MP_PLUGGED	   	;single CPU plugged ?
;R369		jnc	short Not_OneCpu	;no, more than one
;R369
;R369		mov	si,offset MP_Tbl_Item
;R369		call	F000_GetItem_Value
;R369		or	al,al			;MP enabled ?
;R369		jz	short Mp_Disabled
;R369endif;	MP_TBL_SELECTABLE
;R369
;R369Not_OneCpu:	
;R369		call	CheckSum_Mp_Table
;R369
;R369Mp_Disabled:
;R369
;R369endif;	MP_SUPPORT			   
;R296 - end


;R118 - start
;
;	Enable parity and NMI
;
ifndef	NO_PARITY_ITEM					;R340
		mov	si,offset Parity_Item
		call	F000_GetItem_Value
else;	NO_PARITY_ITEM					;R340A
		xor	al,al		;disable parity ;R340A
endif;	NO_PARITY_ITEM					;R340A
		push	ax
		F000_call	Ct_Parity_Control	;chipset's parity control
		pop	ax
		or	al,al			;parity enabled?
		jz	short @F

		F000_call	Enable_Parity
@@:
;R340A endif;	NO_PARITY_ITEM				;R340

		mov	al,0fh NMI_ON		; enable nmi
		call	F000_Get_Cmos
;R118 - end

;R370 - start
;R401ifdef	USB_SUPPORT				;R332
;R401 ifndef M1523B_USB				;R374
;R401  ifndef Dont_turn_cache_in_USB_Final_Init	;R365A
;R401	;Disable internal cache			;R365 
;R401		mov	al,FALSE		;R365 
;R401		call	F000_Cpu_Cache		;R365 
;R401  endif ;Dont_turn_cache_in_USB_Final_Init	;R365A
;R401 endif	;M1523B_USB				;R374
;R401
;R401ifndef	SMIHANDLE_IN_XGROUP	;R398
;R401		call	Usb_Final_Init		;R332
;R401;R398 - start
;R401else	;SMIHANDLE_IN_XGROUP	
;R401		Xcall	Usb_Final_Init		;R332
;R401endif	;SMIHANDLE_IN_XGROUP	
;R401;R398 - end
;R401
;R401 ifndef M1523B_USB				;R374
;R401  ifndef Dont_turn_cache_in_USB_Final_Init	;R365A
;R401	;Restore internal cache			;R365 
;R401		call	IntCache_Status 	;R365 
;R401		jz	short CpuCache_Disable	;R365 
;R401		mov	al,TRUE			;R365 
;R401		call	F000_Cpu_Cache		;R365 
;R401  CpuCache_Disable:				;R365
;R401  endif ;Dont_turn_cache_in_USB_Final_Init	;R365A
;R401 endif	;M1523B_USB				;R374
;R401endif	;USB_SUPPORT				;R332
;R370 - end

;R53 start
ifdef	PM_SUPPORT
ifdef	MP_SUPPORT						;R141
;R337 ifdef	P6_BIOS_ONLY				;R333
;R337 		call	If_MP_PLUGGED				;R258
;R337 		jnc	short @F				;R258
;R337 endif	;P6_BIOS_ONLY				;R333
;R258		xor	ax,ax					;R141
;R258		mov	es,ax					;R141
;R258		cmp	byte ptr es:[0500H],0AAH		;R141
;R258		je	short @F				;R141
endif;	MP_SUPPORT						;R141
		call	PM_INIT
@@:								;R141
endif	;PM_SUPPORT
;R53 end

;R252 - start
;Enable IRQ 12 for mouse hot plug
;R393		call	Check_PS2_Mouse_Support		;PS2 mosue support?
;R393		jz	short No_Ps2_Support
;R393 - start
;R393A		mov	ah,0c0h
;R393A		int	15h			;Get system config. in es:bx
;R393A		test	byte ptr es:[bx+5],04H	;PS2 mouse plugged ?
;R393A - start
		push	ds
		push	si

		push	0f000h
		pop	ds
		lea	si,SYSTEM1_BYTE
		test	byte ptr ds:[si],04H	;PS2 mouse present ?
		pop	si
		pop	ds
;R393A - end
		jz	short No_Ps2_Support
;R393 - end
	;enable IRQ 12 for PS2 mouse		
		cli
		in	al,B8259+1
		and	al,NOT 10H    		; re-enable IRQ 12
		out	B8259+1,al
		NEWIODELAY
No_Ps2_Support:
;R252 - end

;R308 - start
;R308A IRQ9_ENABLED	=	0
;R308A ifdef	FORCE_ENABLE_IRQ9	
;R308A IRQ9_ENABLED	=	1
;R308A endif;	FORCE_ENABLE_IRQ9
;R308A ifdef	PCI_RESET_SUPPORT	;enable IRQ 9 if PCI reset function is enabled
;R308A IRQ9_ENABLED	=	1
;R308A endif;	PCI_RESET_SUPPORT	
IRQ9_ENABLED	=	1		;R308A Force enable IRQ9 during wormboot
ifdef	FORCE_DISABLE_IRQ9		;R308A if define 'FORCE_DISABLE_IRQ9'
IRQ9_ENABLED	=	0		;R308A ,disable IRQ9 during wormboot
endif;	FORCE_DISABLE_IRQ9		;R308A

if	IRQ9_ENABLED
		cli
		in	al,B8259 + 1
		and	al,NOT 02H		;enable IRQ 9 interrupt
		out	B8259+1,al
		NEWIODELAY
endif;	IRQ9_ENABLED
;R308 - end

ifndef	DONT_UNMASK_IRQ						;R317A
;R317 - start
NOISE_IRQ	EQU	8	;for IRQ 11
;Some M/B have noise on IRQ 11 that cause system can not suspend
;BIOS have to issue a hardware interrupt to clear the pending IRQ 11
;where NOISE_IRQ describe IRQ number to do unmask testing
;for example : NOISE_IRQ  EQU  08H means IRQ 11 with noise.

		in	al,B8259 + 1
		NEWIODELAY

ifdef	PATCH_GENERIC_EXE	 				;R321
;Unmask IRQ 8 for GENERIC.EXE to work				;R321
		and	al,NOT 01H		;unmask IRQ 8	;R321
		out	B8259+1,al				;R321
endif;	PATCH_GENERIC_EXE					;R321

		test	al,NOISE_IRQ   		;IRQ 11 already unmasked
		jz	short Irq11_Enabled

		push	ax			;save mask

		and	al,NOT NOISE_IRQ   	;unmask IRQ 11
		out	B8259+1,al
		NEWIODELAY

		sti

		mov	cx,G_RAM
		mov	ds,cx
		assume	ds:G_RAM

	;wait for IRQ 0 to generate a hardware interrupt
		mov	cx,ds:LOW_8254_CNT
Wait_Int:
		cmp	cx,ds:LOW_8254_CNT
		je	short Wait_Int

		pop	ax			;restore mask
		cli
		out	B8259+1,al
		NEWIODELAY
Irq11_Enabled:

;R317 - end
endif;	DONT_UNMASK_IRQ						;R317A

;R308 ;R222 - start
;R308 ifdef	FORCE_ENABLE_IRQ9     				;R231
;R308 ;Enable IRQ 9
;R308 		cli
;R308 		in	al,B8259 + 1
;R308 		and	al,NOT 02H		;enable IRQ 9 interrupt
;R308 		out	B8259+1,al
;R308 		NEWIODELAY
;R308 endif;	FORCE_ENABLE_IRQ9     				;R231
;R308 ;R222 - end

;R423A ;R423 - start
;R423A ifdef	ACPI_Support
;R423A 		cmp	dword ptr ACPI_TABLE_FLAG[bp],0
;R423A 		jz	short No_ACPI_table
;R423A 		mov	di,10h
;R423A 		call	POST_decompress
;R423A 		extrn	SetupACPI:near
;R423A 		call	SetupACPI		;call to setup ACPI table
;R423A No_ACPI_table:
;R423A endif;	ACPI_Support
;R423A ;R423 - end
		ALIGN	4
		clc
		ret
POST_82S	ENDP

;[]==============================================================[]
;
;POST_83S:
;
;	Init time value in 40: area.
;
;Saves: NONE
;
;Entry: NONE
;Exit:	NONE
;
;[]==============================================================[]

		PUBLIC	POST_83S
POST_83S	PROC	NEAR

ifndef	PNP_BIOS					;R183
		call	Cp_Install		;R128
endif	;PNPBIOS					;R183

;R183ifdef	PNP_BIOS					;R133
;R183		call	PNP_BootDev_Init	;R133
;R183		call	PNP_OptROM_Init 	;R133
;R183endif	;PNP_BIOS					;R133

;R329;R99 - start
;R329		mov	ax,G_RAM
;R329		mov	ds,ax
;R329		assume	ds:G_RAM
;R329;R99 - end
;R329
;R329		mov	ah,0ah NMI_OFF		; used in on and off loops
;R329IFNDEF	NO_WAIT_RTC_UPDATE_ON			;R103
;R329		mov	bh,20			; very long delay, since failure
;R329						; of clock is very unlikely
;R329ck_updateon:
;R329		mov	al,ah
;R329		call	F000_Get_Cmos
;R329
;R329		test	al,80h			; check bit 7, update in progress?
;R329		jnz	short clkon		; yes, go to next loop
;R329
;R329		loop	short ck_updateon	; wait loop, cx should still be 0
;R329
;R329		dec	bh			; bh outer loop
;R329		jnz	short ck_updateon	;
;R329;128k		jmp	short clk_err		; timeout
;R329		jmp	clk_err 	;128k
;R329ENDIF	;NO_WAIT_RTC_UPDATE_ON			;R103
;R329
;R329clkon:		xor	cx,cx			; clear cx
;R329		mov	bh,40			; another long delay
;R329ck_updateoff:
;R329		mov	al,ah
;R329		call	F000_Get_Cmos
;R329
;R329		test	al,80h			; check bit 7, update in progress
;R329		jz	short read_hrs		; no, we now have a lot of time to read
;R329
;R329		loop	short ck_updateoff	; wrap cx
;R329
;R329		dec	bh
;R329		jnz	short ck_updateoff	; bh to 0
;R329;128k		jmp	short clk_err		; double timeout
;R329		jmp	clk_err 	;128k
;R329
;R329;	read time from cmos clock
;R329
;R329read_hrs:
;R329		xor	ah,ah			; clear
;R329		mov	al,04h NMI_OFF
;R329		call	F000_Get_Cmos		; get hours
;R329		cmp	al,23h			; see if within limits
;R329		ja	clk_err ;128k
;R329;128k		ja	short clk_err
;R329
;R329		F000_call	BCD_To_Binary
;R329		cbw
;R329		mov	dx,ax			; multipy by 64k+7
;R329		mov	bl,7
;R329		mul	bl
;R329
;R329		push	dx
;R329		push	ax
;R329		mov	al,02h NMI_OFF
;R329		call	F000_Get_Cmos		; get minutes
;R329
;R329		cmp	al,59h
;R329		ja	short clk_err_stk
;R329
;R329		F000_call	BCD_To_Binary
;R329		mov	bl,al
;R329		mov	ax,1092 		; number of 8254 ints per minute
;R329		xor	bh,bh
;R329		mul	bx
;R329
;R329		mov	cx,ax
;R329		mov	al,00h NMI_OFF
;R329		call	F000_Get_Cmos		; get seconds
;R329
;R329		F000_call	Bcd_To_Binary
;R329		xor	ah,ah
;R329		mov	bl,18
;R329		mul	bl
;R329
;R329		pop	bx			; recoup hours lo
;R329		pop	dx			; recoup hours hi
;R329		add	bx,cx			; add in minutes cnt
;R329		adc	dx,0
;R329		add	bx,ax			; add in seconds cnt
;R329		adc	dx,0
;R329
;R329		cli
;R329		mov	Hi_8254_Cnt,dx
;R329		mov	Low_8254_Cnt,bx
;R329		mov	Ovrflw_8254,0
;R329		sti
;R329		jmp	short clksetdone
;R329
;R329clk_err_stk:
;R329		pop	dx
;R329		pop	dx
;R329clk_err:
;R329		mov	al,0ah NMI_OFF		; set register a to its default
;R329		mov	ah,26h
;R329		call	F000_Set_Cmos
;R329
;R329clksetdone:

ifdef	HPM_Support					;R394C
		Xcall	Get_HDD_Information		;R394C
endif	;HPM_Support					;R394C

		PUBLIC	POST_84S
POST_84S	LABEL	NEAR
		PUBLIC	POST_85S
POST_85S	LABEL	NEAR
		PUBLIC	POST_86S
POST_86S	LABEL	NEAR
		PUBLIC	POST_87S
POST_87S	LABEL	NEAR
		PUBLIC	POST_88S
POST_88S	LABEL	NEAR
		PUBLIC	POST_89S
POST_89S	LABEL	NEAR
		PUBLIC	POST_90S
POST_90S	LABEL	NEAR
		PUBLIC	POST_91S
POST_91S	LABEL	NEAR
		PUBLIC	POST_92S
POST_92S	LABEL	NEAR
		PUBLIC	POST_93S
POST_93S	LABEL	NEAR
		PUBLIC	POST_94S
POST_94S	LABEL	NEAR
		PUBLIC	POST_95S
POST_95S	LABEL	NEAR

		clc
		ret

;
;;		PUBLIC	POST_96S
;;POST_96S	LABEL	NEAR
;
;[]==============================================================[]
;
;POST_96S:
;
;	store boot partition of head & cylinder
;
;Saves: NONE
;
;Entry: NONE
;Exit:	NONE
;
;Note:	 boot_sector_buffer offset 0 is store driver C (80h).
;	 boot_sector_buffer offset 1 is store boot_sector head.
;	 boot_sector_buffer offset 2 is store boot_sector cylinder number - low 8 bits.
;	 boot_sector_buffer offset 3 is store boot_sector sector number - bits 0-5.
;								   bits 6-7 are high 2 cylinder bits
;
;[]==============================================================[]
;

		PUBLIC	POST_96S
POST_96S	PROC	NEAR

		mov	ax,G_RAM				;R336D
		mov	ds,ax					;R336D
		assume	ds:G_RAM				;R336D
;R431 start
ifdef Replace_Int13_to_AHDSK
		call	E_F000_Shadow_W
		push	0f000h
		pop	es
		assume	es:dgroup
		mov	word ptr es:[Int13_original_address+2],0ffffh
;R431B		mov	al,BootSel
		mov	dl,BootSel			;R431B
		mov	al,ds:NUMHDSKS			;R431B
		mov	ah,es:[IDE_Drive_Max_Num]	;R431A
		sub	ah,80h				;R431A
ifdef CD_ROM
;R431B		cmp	al,7			;SCSI,A,C?
		cmp	dl,7			;R431B ;SCSI,A,C?
		je	short SCSI_First0	;Yes,jump
;R431B		cmp	al,8			;SCSI,C,A?
		cmp	dl,8			;R431B ;SCSI,C,A?
;R431C		jne	short Rep_org_Int13	;No,jump
		jne	short IDE_First		;R431C No,jump
else ;CD_ROM
;R431B		cmp	al,5			;SCSI,A,C?
		cmp	dl,5			;R431B ;SCSI,A,C?
		je	short SCSI_First0	;Yes,jump
;R431B		cmp	al,6			;SCSI,C,A?
		cmp	dl,6			;R431B ;SCSI,C,A?
;R431C		jne	short Rep_org_Int13	;No,jump
;R431D		jne	short Rep_org_Int13	;R431C ;No,jump
		jne	short IDE_First		;R431D No,jump
endif ;CD_ROM
SCSI_First0:
;R431B		mov	al,ds:NUMHDSKS
;R431A		mov	ah,es:[IDE_Drive_Max_Num]
;R431A		sub	ah,80h
		add	ds:NUMHDSKS,ah
		or	al,al
		jz	short Rep_org_Int13
		add	al,80h
		mov	es:[SCSI_Drive_Max_Num],al
		cmp	word ptr G_RAM:[13h*4+2],0f000h	;int 13h segment at 0F000h segment
		jne	short Int13_replaced		;Yes,dont replace
Rep_org_Int13:
		or	ah,ah
		je	short @F
		mov	ax,offset dgroup:hrdskio	;replace new int 13h address
		mov	G_RAM:[13h*4],ax
		mov	G_RAM:[13h*4+2],0f000h
		jmp	short @F
;R431C start
IDE_First:
		sub	al,ah				;Have any SCSI HDD?
		jz	short @F			;if none then skip
		add	al,80h				;match drive letter
		mov	es:[SCSI_Drive_Max_Num],al	;store it
;R431E		jmp	short Int13_replaced1
		jmp	short @F			;R431E
;R431C end
Int13_replaced:
		or	ah,ah
		jz	short @F
		cmp	al,80h				;if none any SCSI HDD
		jbe	short @F			;don't replace int 13
		or	byte ptr [CDROM_ALLOCATE],Enable_SCSI_Boot	;R441
Int13_replaced1:					;R431C
		mov	ax,G_RAM:[13h*4+2]		;get int 13h segment
		mov	word ptr es:[Int13_original_address+2],ax	;save old int 13h address
		mov	ax,G_RAM:[13h*4]
		mov	word ptr es:[Int13_original_address],ax
		mov	ax,offset dgroup:hrdskio	;replace new int 13h address
		mov	G_RAM:[13h*4],ax
		mov	word ptr G_RAM:[13h*4+2],0f000h
		cmp	word ptr G_RAM:[40h*4+2],0f000h
		jne	short @F
		mov	word ptr G_RAM:[40h*4],offset dgroup:DSK_VECT
@@:
		call	E_F000_Shadow_R
endif ;Replace_Int13_to_AHDSK
;R431 end
ifdef POST96_RESET_HDD_CTLR					;R367
;R345 start
		test	byte ptr ds:[ATAPI_Byte],00000100b	;check LS-120 exist?
		jnz	short No_CDROM_Exist
;R345 end
;R343 start
		mov	dx,1f6h				;assume primary channel
		mov	ah,CDROM_Exist_Flag[bp]
		mov	cl,PM_CDROM
		test	ah,PM_CDROM+PS_CDROM
		jnz	short Select_Drive
Secondary_Check:
		sub	dl,80h				;assume secondary channel
		mov	cl,SM_CDROM
		test	ah,SM_CDROM+SS_CDROM
		jz	short No_CDROM_Exist
Select_Drive:

ifndef POST96_DONT_RESET_HDD_CTLR	;R361
		add	dh,2		;DX = 3f6h/376h
		mov	al,4
		out	dx,al
		newiodelay
		mov	ch,21h
		align	4
@@:
		dec	ch
		jnz	short @B
		xor	al,al
		out	dx,al
		newiodelay
		sub	dh,2		;DX = 1f6h/176h
endif ;POST96_DONT_RESET_HDD_CTLR	;R361

		mov	al,0a0h				;assume master drive
		test	ah,cl
		jnz	short Out_data
		mov	al,0b0h				;set slave drive
Out_data:
		out	dx,al
		cmp	cl,PM_CDROM
		je	short Secondary_Check
No_CDROM_Exist:
;R343 end
endif ;POST96_RESET_HDD_CTLR					;R367
;R328 start
;----- always must be read for SCM flash memory PCMCIA card -----
;R328B		cmp	byte ptr [NUMHDSKS],0	;R328A
;R328B		je	short No_IDE_Device	;R328A
;R328B start
		push	es
		push	0f000h
		pop	es
		assume	es:dgroup

		cmp	byte ptr es:[IDE_drive_Max_num], 80h	; ? have't HD
		pop	es
		je	short No_IDE_Device			; yes
;R328B end
		mov	ax,201h 	;read partition table to 2000h:0
		mov	bx,2000h
		mov	es,bx
		xor	bx,bx
		mov	cx,1
		mov	dx,80h
		int	13h
No_IDE_Device:					;R328A
;----------------------------------------------------------------
;R328 end
		cmp	byte ptr HDD_EXIST_Flag[bp],0		;R299B
		je	None_any_HDD_drive			;R299B
;R336D		mov	ax,G_RAM
;R336D		mov	ds,ax
;R336D		assume	ds:G_RAM
;R101		test	byte ptr VIRUS_FLAG,VIRUS_DETECT

ifndef	Trend_AntiVirus						;R408
		test	byte ptr POST_FLAG,VIRUS_DETECT 	;R101
		jz	short No_Virus_Warn

;R328		mov	ax,201h 	;read partition table to 2000h:0
;R328		mov	bx,2000h
;R328		mov	es,bx
;R328		xor	bx,bx
;R328		mov	cx,1
;R328		mov	dx,80h
;R328		int	13h
		mov	bx,1beh 	;search boot partition from offset [1beh]
		mov	si,[boot_sector_addr]
		mov	ax,[boot_sector_addr+2]
		mov	ds,ax
		mov	cx,4
Search_Loop:
		cmp	byte ptr es:[bx],80h		;is boot partition
		jz	short Boot_Found		;yes,jump to Boot_Found
		add	bh,10h				;No,search next
		loop	short Search_Loop
		mov	word ptr [si],0 		;not found store 0
		mov	word ptr [si+2],0
		jmp	short Search_Ret
Boot_Found:						;Boot Partition found
		mov	dx,es:[bx]
		mov	[si],dx
		mov	dx,es:[bx+2]
		mov	[si+2],dx
Search_Ret:
		xor	di,di				;clear ram buffer (512 bytes) to 0
		mov	cx,256
		xor	ax,ax
		rep	stosw
No_Virus_Warn:
endif;	Trend_AntiVirus						;R408

;R276 start
ifdef	IDE_MODE_3_SUPPORT
HDD_32BIT_DETECT	EQU	1
endif	;IDE_MODE_3_SUPPORT
ifdef	NEW_IDE_MODE_3
HDD_32BIT_DETECT	EQU	1
endif	;NEW_IDE_MODE_3
ifdef HDD_32BIT_DETECT

ifdef	IDE_32BIT_BY_SETUP
		mov	si,offset IDE_transfer_item
		call	F000_GetItem_Value
		or	al,al				;32bit enabled ?
;R173A		jz	short Forbid_32Bit		;no, skip test
;R173B		jz	Forbid_32Bit			;no, skip test;R173A
		jz	None_any_HDD_drive		;R173B
endif;	IDE_32BIT_BY_SETUP	
ifdef	Always_Disable_IDE_32BIT_Mode			;R440
		jmp	None_any_HDD_drive		;R440
endif;	Always_Disable_IDE_32BIT_Mode			;R440

Next_drive:
;R304;----- 32 bits access test only for master drive each channel
;R304;----- So we must test master drive first
;R304		mov	si,IDE_CH0_32BIT_MODE		;si = channel 0 32 bits flag
;R304		cmp	dl,80h				;Is channel 0 master?
;R304		je	short Test_32Bit		;Yes,jump test 32 bits access
;R304		mov	si,IDE_CH1_32BIT_MODE		;si = channel 1 32 bits flag
;R304		test	byte ptr ds:POST_FLAG,DRIVE1_ABSENT	;channel 0 slave is absent?
;R304		jz	short @F			;If present then jump
;R304		cmp	dl,81h				;Is channel 1 master?
;R304		je	short Test_32Bit		;Yes,jump test 32 bits access
;R304		jmp	short Forbid_32Bit		;No,skip test
;R304@@:
;R304		cmp	dl,82h				;Is channel 1 master?
;R304		jne	short Forbid_32Bit		;No,skip test
;R304;-------------------------------------------------------------
;R304 start
		call	Get_HDD_Drive_Port1		;R387
;R387		mov	cl,dl
;R387		sub	cl,80h
;R387		shl	cl,1
;R387		mov	ah,HDD_Drive_Port
;R387		shr	ah,cl
		mov	si,IDE_CH0_32BIT_MODE		;si = channel 0 32 bits flag
;R304A		test	cl,1
		test	ah,2				;R304A
		jz	short @F
		mov	si,IDE_CH1_32BIT_MODE		;si = channel 1 32 bits flag
@@:
;R304 end
Test_32Bit:
HDD_TEMP_RAM_SEG	equ	2000h
;R304 start
		mov	ax,si				;al = channel 32 bits flag
		not	al
		and	POST_FLAG,al			;Disable 32 bits access
;R304 end
		mov	ax,201h
		mov	bx,HDD_TEMP_RAM_SEG+20h
		mov	es,bx
		xor	bx,bx
		mov	cx,1
		xor	dh,dh
		int	13h
		mov	ax,si				;al = channel 32 bits flag
		or	POST_FLAG,al			;Force 32 bits access
		mov	ax,201h				;read function
		mov	bx,HDD_TEMP_RAM_SEG		;     :
		mov	es,bx				;     :
		xor	bx,bx				;     :
		mov	cx,1				;     :
		xor	dh,dh				;     :
		int	13h				;Issue Int 13h function
		mov	ax,si				;al = channel 32 bits flag
		not	al				;Disable 32 bits flag
		and	POST_FLAG,al			;Force 16 bits access
;----- If no partition table or value is same in whole table (new HDD)
;----- then skip this test
		cmp	word ptr es:[bx+1feh],0aa55h	;Have partition mark
		jne	short Forbid_32Bit		;No,jump
		mov	di,2
		mov	ax,es:[bx]
@@:
		cmp	ax,es:[bx+di]
		jne	short @F
		add	di,2
		cmp	di,200h
		jb	short @B
		jmp	short Forbid_32Bit
;-----------------------------------------------------------------------
@@:
;----- Compare 16 bits read value and 32 bits read value is same?
		mov	eax,es:[bx]
		cmp	eax,es:[bx+200h]
		jne	short Forbid_32Bit
		add	bx,4
		cmp	bx,200h
		jb	short @B
		mov	ax,si
		or	POST_FLAG,al			;compare complete set 32 bits access
;-----------------------------------------------------------------
Forbid_32Bit:
		inc	dl			; set for next drive
;R299B		mov	al,NumHDSKS
		mov	al,HDD_EXIST_Flag[bp]	;R299B
		add	al,80h
		cmp	dl,al
		jb	Next_drive
endif ;HDD_32BIT_DETECT
;R276 end
None_any_HDD_drive:				;R299B
;R336B start
;R387ifdef Replace_Int13_to_AHDSK
		call	E_F000_Shadow_W			;R381
;R381		F000_CALL	F000_Shadow_W
		push	0f000h
		pop	es
		assume	es:dgroup
;R387 - start
		mov	ax,G_RAM
		mov	ds,ax			;ds=40h

   		xor	dx,dx
		mov	al,IDE_Exist_FLag[bp]
FDPTE_next:
		sar 	al,1  
		push	ax			
		jnc	short NO_IDE_Exist1
		mov	si,dx
		mov	al,byte ptr IDE_0_Specific_Flag[bp+si]
		push	ax

		mov	al,IDE_CH0_32BIT_MODE		;si = channel 0 32 bits flag
		test	ah,2
		jz	short @F
		mov	al,IDE_CH1_32BIT_MODE		;si = channel 1 32 bits flag
@@:
		mov	bx,dx
		shl	bl,4
		mov	si,offset DGROUP:FDPTE_Drive0
		add	si,bx				;get FDPT address	
		test	post_flag,al
		pop	ax			;al=IDE_0_Specific_Flag
		jz	short No_32bit_Tarns
		test	al,ATAPIDev
		jnz	short No_32bit_Tarns

		mov	bx,0ah
		or	byte ptr DGROUP:[si+bx],80h	;set 32bittransfer flag
No_32bit_Tarns:
		call	FDPTE_Cksm
		mov	bx,0fh
		mov	byte ptr DGROUP:[si+bx],al	;store checksum

;--------------Get_FDPTE_addr---------
NO_IDE_Exist1:
		pop	ax
		inc	dl			; set for next drive
		cmp	dl,04h			;
		jb	short FDPTE_next

;R431ifdef Replace_Int13_to_AHDSK			
;R431;R387 - end
;R431		mov	word ptr es:[Int13_original_address+2],0ffffh
;R431;R336E start
;R431		mov	al,ds:NUMHDSKS
;R431		sub	al,es:[IDE_Drive_Max_Num]
;R431		mov	es:[SCSI_Drive_Max_Num],al
;R431		cmp	al,80h				;if none any SCSI HDD
;R431		je	short @F			;don't replace int 13
;R431;R336E end
;R431		cmp	word ptr G_RAM:[13h*4+2],0f000h		;int 13h segment at 0F000h segment
;R431		je	short @F				;Yes,dont replace
;R431;R346 start
;R431		mov	ah,8
;R431		mov	dl,80h
;R431		int	13h
;R431		cmp	IDE_HDD0_CYL_SEC[bp],cx
;R431		jne	short @F
;R431		cmp	IDE_HDD0_HEAD[bp],dh
;R431		jne	short @F
;R431;R346 end
;R431		mov	ax,G_RAM:[13h*4+2]			;get int 13h segment
;R431		mov	word ptr es:[Int13_original_address+2],ax	;save old int 13h address
;R431		mov	ax,G_RAM:[13h*4]
;R431		mov	word ptr es:[Int13_original_address],ax
;R431		mov	ax,offset dgroup:hrdskio		;replace new int 13h address
;R431		mov	G_RAM:[13h*4],ax
;R431		mov	word ptr G_RAM:[13h*4+2],0f000h
;R431;R336C start
;R431		cmp	word ptr G_RAM:[40h*4+2],0f000h
;R431		jne	short @F
;R431		mov	word ptr G_RAM:[40h*4],offset dgroup:DSK_VECT
;R431;R336C end
;R431@@:
;R431;R336E		mov	al,ds:NUMHDSKS
;R431;R336E		sub	al,es:[IDE_Drive_Max_Num]
;R431;R336E		mov	es:[SCSI_Drive_Max_Num],al
;R431endif ;Replace_Int13_to_AHDSK				;R387
		call	E_F000_Shadow_R			;R381
;R381		F000_CALL	F000_Shadow_R
;R387endif ;Replace_Int13_to_AHDSK
;R336B end

POST_96S	ENDP
;

		clc
		ret
POST_83S	ENDP
;R387 start
;--------------
;     		Get_HDD_Drive_Port1
;Input:	 dl = drive number 80,81,..	
;	HDD_Drive_port 	 bit1,3,5,7 ==>	0 = channel-0
;			           	1 = channel-1
;	        	 bit0,2,4,6 ==>	0 = master
;		        	 	1 = slave					
;Output: ah = real drive port	
;--------------

Get_HDD_Drive_Port1:
		mov	cl,dl			;dl is drive number
		sub	cl,80h
		shl	cl,1			
		mov	ah,HDD_Drive_Port	;get HDD port information
		shr	ah,cl			
		and	ah,03h			;One drive use two bits
		ret
		
FDPTE_Cksm:	;Checksum,2's complement of the sum of bytes 0-14
		mov	cx,15
		xor	al,al
		xor	bx,bx
@@:
		add	al,byte ptr DGROUP:[si+bx]
		inc	bx
		loop	@B
		neg 	al
		ret
;R387 end

;[]==============================================================[]
;
;  POST_97S:
;
;	Final Init - for last microsecond details before boot
;
;ENTRY: NONE
; EXIT: NONE
;
;[]==============================================================[]
		PUBLIC	POST_97S
POST_97S	PROC	NEAR

;R411 start
ifdef	Trend_AntiVirus
	;Don't decompress ChipAway ROM if user disable it in CMOS setup
		mov	ax,G_RAM
		mov	ds,ax
		assume	ds:G_RAM
		test	byte ptr POST_FLAG,VIRUS_DETECT ;ChipAway enabled?
		jz	short Not_Trend		;no , disabled.

		mov	di,(VRS_Expand_Address+1)*4;;;;;(07h+1)*4		;Cbrom /vrs number ID
		call	POST_decompress		;Decompress to 4000:0
Not_trend:
endif	;Trend_AntiVirus
;R411 end

;R168A		mov	ax,1202h		;R168
;R168A		mov	bl,30h			;R168
;R168A		int	10h			;R168

;R168A		mov	ax,3			;R168
;R168A		int	10h			;clear screen ;R168

		push	es			;128k
		push	0f000h			;128k
		pop	es			;128k
;R187		lea	si,A20_Byte		;128k
;R187		test	byte ptr es:[si],80h	;128k
		assume	es:DGROUP			;R187
		test	byte ptr DGROUP:A20_Byte,80h	;R187
		assume	es:NOTHING			;R187

		mov	ax,G_RAM
		mov	ds,ax
		assume	ds:G_RAM

;128k		test	cs:byte ptr A20_Byte,80h
		jnz	short @F

		or	Init_Err_Flg, IEF_IN_POST
		push	ds
		call	Try_Actual_Cache  ;kkk
		pop	ds
		and	Init_Err_Flg, NOT IEF_IN_POST
@@:

ifdef	Turbo_Pin_Handler				;R112A
;R112A ifndef	No_Turbo_Pin_Handler				;R112

		lea	si,Settings			;128k
		test	byte ptr es:[si],SPD_SW_DISABLE ;128k
;128k		test	cs:[Settings],SPD_SW_DISABLE
		jnz	short P97_1
		lea	si,SYSTEM_BYTE		;128k
		test	byte ptr es:[si],80h	;128k
;128k		test	byte ptr cs:SYSTEM_BYTE,80h	;turbo switch enabled?
		jz	short P97_1

		lea	si,TB_SW_Input_Item	;128k
;128k		mov	si,offset cs:TB_SW_Input_Item
		call	F000_GetItem_Value
		mov	ah,0
		test	al,1			;turbo switch input enabled?
		jz	short TB_SW_Disable	;no, it is disabled!
		or	ah,1
TB_SW_Disable:
		or	ds:[FDD_VERIFY_CMD_FLAG],ah

		mov	ah,00010000b			;assume Pin 31
		lea	si,SYSTEM_BYTE		;128k
		test	byte ptr es:[si],10h	;128k
;128k		test	byte ptr cs:SYSTEM_BYTE,10h
		jnz	short @F

		mov	ah,00000100B			;assume Pin 29
		test	byte ptr es:[si],40h	;128k
;128k		test	byte ptr cs:SYSTEM_BYTE,40h
		jz	short @F
		mov	ah,00001000B			;use Pin 30
@@:
		mov	ds:[Turbo_Pin_Status],ah

;R112A endif	;No_Turbo_Pin_Handler			;R112
endif	;Turbo_Pin_Handler				;R112A

P97_1:

ifndef	HIDE_STD_ITEMS						;R297
 ifndef	NO_SPEED_ITEM						;R390
		mov	si,offset BootSpeed_Item
		call	F000_GetItem_Value
 endif;	NO_SPEED_ITEM						;R390
else;	HIDE_STD_ITEMS						;R297
		mov	al,1		;always high speed	;R297
endif;	HIDE_STD_ITEMS						;R297
		F000_call	SetSpeed
@@:

		F000_CALL	CT_FINAL_INIT
			;CT_FINAL_INIT needs to CLEAR carry if pass
			; or set it if fail!!

;R394 - Start
;R394Aifdef	HPM_Support
;R394A		pushad
;R394A		mov	bx, offset HPM_32bit_Entry
;R394A		mov	ah, 84h			;end post call
;R394A		call	Post_Init_HPM
;R394A		popad
;R394Aendif	;HPM_Support
;R394 - End

;R391ifdef	PM_SUPPORT						;R84
	ifdef	ONBOARD_PCI_VGA					;R386
		cmp	byte ptr PCI_VGA_INFO[bp],(ONBOARD_PCI_VGA) SHL 3 ;R386
		jne	short @f				;R386
	endif	;ONBOARD_PCI_VGA				;R386
	ifdef	LCD_CRT_OPTION					;R298
		Call	Switch_Display				;R298
	endif	;LCD_CRT_OPTION					;R298
	ifdef	TV_OUT_SUPPORT					;R363
		Call	TV_Out_Display				;R363
	endif	;TV_OUT_SUPPORT					;R363
@@:								;R386
ifdef	PM_SUPPORT						;R391
ifdef	E000_SMI_SUPPORT					;R342
		CALL	Ct_PM_Final_Init			;R342
else	;E000_SMI_SUPPORT					;R342
		F000_CALL	Ct_PM_Final_Init		;R84
endif	;E000_SMI_SUPPORT					;R342
;R409	ifdef	Notebook_Power_Management			;R171
	if	STD_Function		EQ	1		;R409
		call	Notebook_Resume 			;R171
	endif	;STD_Function		EQ	1		;R409
;R409	endif	;Notebook_Power_Management			;R171
endif	;PM_SUPPORT						;R84

;R285 start
ifdef	CD_ROM
;R331		mov	si,offset BootSeq_Item
;R331		F000_call	GetItem_Cmos
		mov	al,byte ptr G_RAM:[BootSel]	;R331

		cmp	al,2
		jb	short @F
;R307		call	AUTO_CDROM_DETECT
;R307 start
		cmp	byte ptr NumHDSKS,0
		jne	short @F
		call	Reset_INT13
;R307 end
@@:
endif	;CD_ROM
;R285 end
;R168		mov	ax,1202h
;R168		mov	bl,30h
;R168		int	10h

		mov	ax,1202h		;R168A
		mov	bl,30h			;R168A
		int	10h			;R168A

;R364 ifndef	NO_SYSTEM_CONFIG					;R65
;R168		mov	ax,3
;R168		int	10h			;clear screen

;R422 - start
 ifdef	CUSTOM_POST_MSG_SUPPORT
	;restore INT 10H for clearing screen to boot
		mov	ax,G_RAM
		mov	es,ax
		ASSUME	ES:G_RAM
		mov	esi,dword ptr es:[TEMP_BP+2]	;get original vector
		mov	es:[int10],esi			;restore INT 10H
 endif;	CUSTOM_POST_MSG_SUPPORT
;R422 - end

ifndef Dont_Switch_To_Text_Anyway	;R424
		mov	ax,3			;R168A
;R436 - starts
ifdef	DOUBLE_BYTE_LANGUAGE
		test	byte ptr DISP_MODE[bp], IS_DOUBLE_BYTE
		jz	short @F
		Call	init_Int10h
		mov	ax,12h
@@:
endif	;DOUBLE_BYTE_LANGUAGE
;R436 - ends
		int	10h			;R168A
endif ;Dont_Switch_To_Text_Anyway	;R424
;R364 start
ifdef	NO_SYSTEM_CONFIG
		mov	word ptr CURSOR_X[bp],0	;initial cursor to left up corner
else	;NO_SYSTEM_CONFIG
;R364 end
;R379		call	Show_System_Cfg
;R432 -start
ifdef	Support_SumScr_Item				
		mov	si,offset SumScr_Item
		call	F000_GetItem_Value
                or      al,al
                jz      Hide_System_Cfg
endif	;Support_SumScr_Item				
;R432 -end
		Xcall	Show_System_Cfg		;R379
endif;	NO_SYSTEM_CONFIG					;R65
;R236		F000_call	Cursor_On	;R192
		call	F000_Cursor_On		;R236

ifdef	Support_SumScr_Item			;R432	
Hide_System_Cfg:				;R432
endif	;Support_SumScr_Item			;R432	
		pop	es		;128k

;R83 - starts
;R83A		mov	ax,0C3C3h	;lock Cyrix registers
;R83A		out	22h,al
;R83A		in	al,23h
;R83A		or	al,1
;R83A		xchg	ah,al
;R83A		out	22h,al
;R83A		xchg	ah,al
;R83A		out	23h,al
;R83 - ends

if	BIOS_SUPPORT_586
ifndef	M6117_CPU 					;R371A
		call	Prg_K6_Write_Allocate		;R358
endif	;M6117_CPU 					;R371A
endif	;BIOS_SUPPORT_586

		call	Prg_P6_USWC			;R360
;R378 start
ifdef RPB_ENABLED                   ; RXX
ifdef RPB_POSTMENU_ENABLED
;M01  extrn rpb_reinit:near
;M01  call  rpb_reinit                  ; re=initialize rpb serial port
  F000_call  rpbf_reinit	  ; re=initialize rpb serial port	;M01
  F000_Call  rpb_post_menu	  ; show RPB Menu
endif ; RPB_POSTMENU_ENABLED
endif ; RPB_ENABLED
;R378 end

;R394Cifdef	HPM_Support					;R394B
;R394C		Xcall	Get_HDD_Information		;R394B
;R394Cendif	;HPM_Support					;R394B

		clc	;No final init so this always passes
		RET

POST_97S	ENDP

;[]==============================================================[]
;
;  POST_98S:
;
;	Force keyboard NUM-LOCK on...
;
;ENTRY: NONE
; EXIT: NONE
;
;[]==============================================================[]
		PUBLIC	POST_98S
POST_98S	PROC	NEAR

;Set Dalight saving mode
		mov	ah,0bh + 80h
		mov	al,ah
		call	F000_Get_Cmos
		and	al,NOT 01h		;assume daylight disabled
		push	ax
		mov	si,offset DayLight_Item
		call	F000_GetItem_Value
		or	al,al
		pop	ax
		jz	short @F
		or	al,01h			;enable daylight saving mode
		xchg	ah,al
		call	F000_Set_Cmos
@@:


;	Force NUM-LOCK on 101-key keyboard.
		mov	ax,G_RAM
		mov	ds,ax
		assume	ds:G_RAM

ifndef	SPECIAL_KB_PATCH					;R216
		mov	byte ptr ds:[Kb_Flag_3],READ_ID

		mov	al,KB_RDID				; send read ID to keyboard
		call	E000_Kb_Out			;R335
;R335		F000_call	Kb_Out

		sti						; enable interrupt to occur
		mov	cx,3000
		xor	bx,bx
		call	Wait_Refresh1
endif;	SPECIAL_KB_PATCH					;R216

		call	Reset_NUMLK_LED				;R417

;	Force NUM-LOCK on 101-key keyboard.
;[]---------------------------------------------------------------------[]
;Set NumLock status according setup
		mov	si,offset NumLock_Item
		call	F000_GetItem_Value
		or	al,al
		jz	short @F			;Numlock On
		mov	al,NUM_LK
		call	UPDATE_LED_REG		; al -> to keyboard
@@:
;[]---------------------------------------------------------------------[]

ifdef	SPECIAL_KB_PATCH					;R216
		sti						; enable interrupt to occur
		mov	cx,3000
		xor	bx,bx
		call	Wait_Refresh1
endif;	SPECIAL_KB_PATCH					;R216

		mov	byte ptr ds:[Kb_Flag_3],READ_ID

		mov	al,KB_RDID				; send read ID to keyboard
		call	E000_Kb_Out			;R335
;R335		F000_call	Kb_Out
		sti						; enable interrupt to occur
;R216		mov	cx,3000
		mov	cx,6000 				;R216
		xor	bx,bx
		call	Wait_Refresh1

ifndef	HIDE_STD_ITEMS						;R297
;[]---------------------------------------------------------------------[]
;Set Typematic rate according setup
		mov	si,offset TypeRate_Item
		call	F000_GetItem_Value
		or	al,al
		jz	short No_Rate

		mov	si,offset TypeSpeed_Item
		call	F000_GetItem_Value
		mov	bl,al
		xor	bh,bh
		mov	si,offset TypeRate_Table
		add	si,bx
		mov	bl,cs:[si]		;typematic rate

		mov	si,offset TypeDelay_Item
		call	F000_GetItem_Value
		mov	bh,al

		call	Update_Repeat_Rate

No_Rate:
;[]---------------------------------------------------------------------[]
endif;	HIDE_STD_ITEMS						;R297

ifdef	ALWAYS_101_key_keyboard_SUPPORT			;R430
		or	ds:[KB_FLAG_3], 10h		;R430;101/102 key keyboard installed
endif;	ALWAYS_101_key_keyboard_SUPPORT			;R430
		and	ds:[KB_FLAG_3],NOT (FORCE_NUM+READ_ID)	; clear bits
		cli
		clc
		ret
POST_98S	ENDP

ifndef	HIDE_STD_ITEMS						;R297
;	Typematic Rate (make codes/second)
;
;	bit	rate	bit	rate	bit	rate
;	00000	30	00001	26.7	00010	24
;	00011	21.8	00100	20	00101	18.5
;	00110	17.1	00111	16	01000	15
;	01001	13.3	01010	12	01011	10.9
;	01100	10	01101	9.2	01110	8.6
;	01111	8	10000	7.5	10001	6.7
;	10010	6	10011	5.5	10100	5
;	10101	4.5	10110	4.3	10111	4
;	11000	3.7	11001	3.3	11010	3
;	11011	2.7	11100	2.5	11101	2.3
;	11110	2.1	11111	2
;
;	Repeat Delay (milliseconds)
;
;	bit	delay	bit	delay	bit	delay	bit	delay
;	00	250	01	500	10	750	11	1000
;
;	bl=typematic rate (0 - 1FH) - value checked
;	bh=repeat delay (0 - 3H) - value checked

TypeRate_Table:
		db	00010010b		;6 chars/sec
		db	00001111b		;8 chars/sec
		db	00001100b		;10 chars/sec
		db	00001010b		;12 chars/sec
		db	00001000b		;15 chars/sec
		db	00000100b		;20 chars/sec
		db	00000010b		;24 chars/sec
		db	00000000b		;30 chars/sec

UPDATE_REPEAT_RATE PROC NEAR
		push	cx
UP_RATE_DO:	CLI
		MOV	AL,0F3H 		; typematic rate command
		call	E000_Kb_Out			;R335
;R335		F000_call	Kb_Out
		MOV	CL,5
		MOV	AL,BH			; get delay
		SHL	AL,CL			; move to bits 5-6
		OR	AL,BL			; get rate command
		PUSH	AX			; preserve rate for return
		call	E000_Kb_Out			;R335
;R335		F000_call	Kb_Out
		POP	AX			; recover rate for return.
		STI

UP_RATE_RET:	pop	cx			; restore regs
		ret
UPDATE_REPEAT_RATE ENDP
endif;	HIDE_STD_ITEMS						;R297

		PUBLIC	UPDATE_LED_REG
UPDATE_LED_REG	PROC NEAR

		push	ds			; save reg
		mov	bx,G_RAM		; set data seg
		mov	ds,bx
		ASSUME	DS:G_RAM

		or	SHFT_STAT,al

		CLI
		MOV	AL,SHFT_STAT
		AND	AL,70H			; get the state of the led keys
		shr	al,4

		MOV	AH,KB_FLAG_2
		AND	AH,7			; get the actual led settings

		CMP	AL,AH			; check to see if the leds are right
		JE	short @F		; NO CHANGE NEEDED

		AND	KB_FLAG_2,0F8H		; update kb_flag_2 for new leds
		OR	KB_FLAG_2,AL		; with value from current led state

		PUSH	AX			; save led settings from al
		MOV	AL,LED_CMD		; SEND LED COMMAND
		call	E000_Kb_Out			;R335
;R335		F000_call	Kb_Out
		POP	AX			; get led settings
;R281		JNE	short @F		; jump if there is an error

		call	E000_Kb_Out			;R335
;R335		F000_call	Kb_Out
@@:
		pop	ds
		STI				; ENABLE INT AND RETURN
		RET

UPDATE_LED_REG	ENDP

;R417 - start
Reset_NUMLK_LED	proc	near
		CLI
		and	SHFT_STAT,NOT NUM_LK	;turn off Num-Lock LED

		MOV	AL,SHFT_STAT
		AND	AL,70H			; get the state of the led keys
		shr	al,4

		MOV	AH,KB_FLAG_2
		AND	AH,7			; get the actual led settings

		AND	KB_FLAG_2,0F8H		; update kb_flag_2 for new leds
		OR	KB_FLAG_2,AL		; with value from current led state

		PUSH	AX			; save led settings from al
		MOV	AL,LED_CMD		; SEND LED COMMAND
		call	E000_Kb_Out
		POP	AX			; get led settings

		call	E000_Kb_Out
		STI				; ENABLE INT AND RETURN
		ret
Reset_NUMLK_LED	endp
;R417 - end

;[]==============================================================[]
;
;POST_99S:
;
;	Set up low stack and boot.
;
;Saves: NONE
;
;Entry: NONE
;Exit:	NONE
;
;[]==============================================================[]

		PUBLIC	POST_99S
POST_99S	PROC	NEAR

;R369 - start
ifdef	MP_SUPPORT				
		call	MP_Final_Init		
endif;	MP_SUPPORT				
;R369 - end

ifndef	M6117_CPU 				;R371
		xor	al,al
		F000_call	Restore_Cyrix_Reg
endif	;M6117_CPU 				;R371

;R56 - start
ifdef	PM_SUPPORT
;Send D2 command follow with dummy code 80h for PM to check power down
		mov	al,0d2h
		call	F000_Out_8042

		mov	al,80h
		out	DATA8042,al
endif;	PM_SUPPORT
;R56 - end

;R370ifdef	USB_SUPPORT				;R332
;R370	;Disable internal cache			;R365
;R370		mov	al,FALSE		;R365
;R370		call	F000_Cpu_Cache		;R365
;R370
;R370		call	Usb_Final_Init		;R332
;R370
;R370	;Restore internal cache			;R365
;R370		call	IntCache_Status 	;R365
;R370		jz	short CpuCache_Disable	;R365
;R370		mov	al,TRUE			;R365
;R370		call	F000_Cpu_Cache		;R365
;R370CpuCache_Disable:				;R365
;R370endif	;USB_SUPPORT				;R332

;R227 - start
ifdef	PNP_BIOS				
ifndef	M6117_CPU 				;R371
		cmp	byte ptr bulk_flash_type[bp],-1	;R399
		je	short @F		;R399	
		call	PNP_Final_Init		
@@:						;R399		
		call	PNP_IPL_Init		
endif	;M6117_CPU 				;R371
endif	;PNP_BIOS				
;R227 - end

		call	Valid_Century		;R341

;R341		mov	ax,G_RAM
;R341		mov	ds,ax
;R341		assume	ds:G_RAM

;R329 start
		mov	ax,G_RAM
		mov	ds,ax
		assume	ds:G_RAM

		mov	ah,0ah NMI_OFF		; used in on and off loops
IFNDEF	NO_WAIT_RTC_UPDATE_ON
		mov	bh,20			; very long delay, since failure
						; of clock is very unlikely
ck_updateon:
		mov	al,ah
		call	F000_Get_Cmos

		test	al,80h			; check bit 7, update in progress?
		jnz	short clkon		; yes, go to next loop

		loop	short ck_updateon	; wait loop, cx should still be 0

		dec	bh			; bh outer loop
		jnz	short ck_updateon	;
		jmp	clk_err
ENDIF	;NO_WAIT_RTC_UPDATE_ON

clkon:		xor	cx,cx			; clear cx
		mov	bh,40			; another long delay
ck_updateoff:
		mov	al,ah
		call	F000_Get_Cmos

		test	al,80h			; check bit 7, update in progress
		jz	short read_hrs		; no, we now have a lot of time to read

		loop	short ck_updateoff	; wrap cx

		dec	bh
		jnz	short ck_updateoff	; bh to 0
		jmp	clk_err

;	read time from cmos clock

read_hrs:
		xor	ah,ah			; clear
		mov	al,04h NMI_OFF
		call	F000_Get_Cmos		; get hours
		cmp	al,23h			; see if within limits
		ja	clk_err

		F000_call	BCD_To_Binary
		cbw
		mov	dx,ax			; multipy by 64k+7
		mov	bl,7
		mul	bl

		push	dx
		push	ax
		mov	al,02h NMI_OFF
		call	F000_Get_Cmos		; get minutes

		cmp	al,59h
		ja	short clk_err_stk

		F000_call	BCD_To_Binary
		mov	bl,al
		mov	ax,1092 		; number of 8254 ints per minute
		xor	bh,bh
		mul	bx

		mov	cx,ax
		mov	al,00h NMI_OFF
		call	F000_Get_Cmos		; get seconds

		F000_call	Bcd_To_Binary
		xor	ah,ah
		mov	bl,18
		mul	bl

		pop	bx			; recoup hours lo
		pop	dx			; recoup hours hi
		add	bx,cx			; add in minutes cnt
		adc	dx,0
		add	bx,ax			; add in seconds cnt
		adc	dx,0

		cli
		mov	Hi_8254_Cnt,dx
		mov	Low_8254_Cnt,bx
		mov	Ovrflw_8254,0
		sti
		jmp	short clksetdone

clk_err_stk:
		pop	dx
		pop	dx
clk_err:
		mov	al,0ah NMI_OFF		; set register a to its default
		mov	ah,26h
		call	F000_Set_Cmos

clksetdone:
;R329 end

		MOV	G_RAM:[USER_REBOOT],0	; RESET
;R368A	      	and	G_RAM:[INIT_ERR_FLG],not FLASH_IN_POST	;R368

ifndef	DOUBLE_BYTE_LANGUAGE				;R436
		mov	ax,BIOS_STK
		mov	ss,AX
		assume	ss:BIOS_STK
		mov	sp,OFFSET BIOSSTK_TOP
endif	;DOUBLE_BYTE_LANGUAGE				;R436

; clear any pending keystroke and kb queue buffer

		mov	word ptr ds:[Ptr_Kbd_Buf_Hd],offset Buf_For_Kbd-400h
		mov	word ptr ds:[Ptr_Kbd_Buf_Tl],offset Buf_For_Kbd-400h
		in	al,DATA8042

		sti

;R227 ifdef	PNP_BIOS					;R133
;R227 		call	PNP_Final_Init		;R133
;R227 		call	PNP_IPL_Init		;R133
;R227 endif	;PNP_BIOS					;R133
;R172 - start

ifndef	DOUBLE_BYTE_LANGUAGE				;R436
; Clear garbage in base memory except BIOS data
		cli
		cld
;R411		mov	dx, ds:[SIZE_SYSRAM]	;base memory size
;R411		mov	cl, 6
;R411		shl	dx, cl			;translate to segment address
;R411		sub	dx, 1000h		;top 64K segment
;R411 start
		mov	dx,280h			;tranditional size
		sub	dx,ds:[SIZE_SYSRAM]	;actual base memory size
		mov	ax,dx			;R411A
		and	dl,3fh			;R411A clear word count for first segment
		and	ax,not 3fh		;R411A first segment distance
		shl	ax,6			;R411A set to times of 1000h
		shl	dx,9			;word number
		mov	cx,8000h		;top clear size
		sub	cx,dx			;dont clear used memory
		mov	dx,9000h		;first clear address
		sub	dh,ah			;R411A set correctly first segment
		cld
;R411 end
		xor	ax, ax
		xor	di, di
Clear_DRAM_Loop:
		mov	es, dx
;R411		mov	cx, 8000h		;64k word
		rep	stosw
		mov	cx, 8000h		;R411 64k word
		cmp	dx, 0050h		;don't destroy BIOS data
		jbe	short Clear_DRAM_Exit
;R177 - start
		cmp	dh,60H			;next segment is 5000H ?
		jne	short Not_5000H
		sub	dh,10H			;yes , skip it
Not_5000H:
;R177 - end
;R411 start
ifdef	Trend_AntiVirus
		cmp	dh,50H			;next segment is 5000H ?
		jne	short Not_4000H
		sub	dh,10H			;yes , skip it
Not_4000H:
endif	;Trend_AntiVirus
;R411 end
		sub	dx, 1000h		;next 64k segment
		jb	short @f
		cmp	dx, 0050h		;don't destroy BIOS data
		jae	short Clear_DRAM_Loop
@@:
		mov	dx, 0050h		;don't destroy BIOS data
		jmp	short Clear_DRAM_Loop
Clear_DRAM_Exit:
endif	;DOUBLE_BYTE_LANGUAGE			;R436

;R385 start
ifdef	Flash_2M_support
		pushf				;R385A
		cli				;R385A
		F000_call	A20_On		; turn on a20 gate
		call	E000_Enter_Prot_mode
		mov	ax,ds
		mov	es,ax
		mov	edi,160000h
		mov	ecx,8000h
		xor	eax,eax
 		db	67h
 		rep	stosd			;clear 160000h-170000h for 2M BIOS combine ROM
@@:
		call	E000_Back_Real_Mode
		F000_call	A20_Off		; turn off a20 gate
		popf				;R385A
endif	;Flash_2M_support
;R385 end
;R195 start
;R285 ifdef	CD_ROM
;R285 ;R277 start
;R285 		mov	si,offset BootSeq_Item
;R285 		F000_call	GetItem_Cmos
;R285 		cmp	al,2
;R285 		jb	short @F
;R285 ;R277 end
;R285 		call	AUTO_CDROM_DETECT
;R285 @@:								;R277
;R285 endif	;CD_ROM
;R195 end
		sti
;R172 - end
;R180 - start
ifdef	FLUSH_CACHE_BEFORE_BOOT
		WBINVD
endif	;FLUSH_CACHE_BEFORE_BOOT
;R180 - end

;R221		POST_CODE 0ffh
;R221		int	19h
;R314 - Start
ifdef	Beep_Before_Boot
		extrn	Snd_Spkr:Near
		mov	bl,1
		F000_call	Snd_Spkr
endif	;Beep_Before_Boot
;R314 - End
;R334A;R334 start
;R334Aifdef	CD_ROM
;R334A		F000_CALL	F000_Shadow_W
;R334A		push	0f000h
;R334A		pop	es
;R334A		mov	word ptr es:[Int13_original_address+2],0ffffh
;R334A		cmp	word ptr G_RAM:[13h*4+2],0f000h		;int 13h segment at 0F000h segment
;R334A		je	short @F				;Yes,dont replace
;R334A		mov	ax,G_RAM:[13h*4+2]			;get int 13h segment
;R334A		mov	word ptr es:[Int13_original_address+2],ax	;save old int 13h address
;R334A		mov	ax,G_RAM:[13h*4]
;R334A		mov	word ptr es:[Int13_original_address],ax
;R334A		mov	ax,offset dgroup:hrdskio		;replace new int 13h address
;R334A		mov	G_RAM:[13h*4],ax
;R334A		mov	word ptr G_RAM:[13h*4+2],0f000h
;R334A@@:
;R334A		F000_CALL	F000_Shadow_R
;R334Aendif	;CD_ROM
;R334A;R334 end
;R336B;R336 start
;R336Bifdef Replace_Int13_to_AHDSK
;R336B		F000_CALL	F000_Shadow_W
;R336B		push	0f000h
;R336B		pop	es
;R336B		mov	word ptr es:[Int13_original_address+2],0ffffh
;R336B		cmp	word ptr G_RAM:[13h*4+2],0f000h		;int 13h segment at 0F000h segment
;R336B		je	short @F				;Yes,dont replace
;R336B		mov	ax,G_RAM:[13h*4+2]			;get int 13h segment
;R336B		mov	word ptr es:[Int13_original_address+2],ax	;save old int 13h address
;R336B		mov	ax,G_RAM:[13h*4]
;R336B		mov	word ptr es:[Int13_original_address],ax
;R336B		mov	ax,offset dgroup:hrdskio		;replace new int 13h address
;R336B		mov	G_RAM:[13h*4],ax
;R336B		mov	word ptr G_RAM:[13h*4+2],0f000h
;R336B@@:
;R336B		mov	al,ds:NUMHDSKS
;R336B		sub	al,es:[IDE_Drive_Max_Num]
;R336B		mov	es:[SCSI_Drive_Max_Num],al
;R336B		F000_CALL	F000_Shadow_R
;R336Bendif ;Replace_Int13_to_AHDSK
;R336B;R336 end

;R375 - start
ifdef	PCI_BUS
		call	Build_MsPciIrq		;build PCI/IRQ routing table
endif;	PCI_BUS
;R375 - end

;R394A - Start
ifdef	HPM_Support
		pushad
		push	es			;R394B
		mov	ax, PM_RAM_SEGMENT	;R394B
		mov	es, ax			;R394B
		mov	ecx, dword ptr es:[0]	;R394B
		pop	es			;R394B
		mov	bx, offset HPM_32bit_Entry
		mov	ah, 84h			;end post call
		call	Post_Init_HPM
		popad
endif	;HPM_Support
;R394A - End

;R426A - start
ifdef	OEM_POST_SUPPORT
		mov	cx, 0FFH		     ;POST code 0FFH
		call  OEM_Service_Roution_Post_Code  ; exectue OEM special function 
						     ;	code
endif	;OEM_POST_SUPPORT
;R426A - end

;R329 - start
ifdef	Superio_Need_Do_Before_Boot
		xcall	Superio_Before_Boot
endif	;Superio_Need_Do_Before_Boot
;R329 - end

		FAR_JMP <offset Preint_19>,0F000H	;R221
POST_99S	ENDP

;R341 - starts
;------------------------------
;  if ( Year > 80 )
;     set century = 19
;  else
;     set century = 20
;------------------------------
		Public	Valid_Century
Valid_Century	Proc	Near

ifndef	NO_Y2K_CHECK				;R438
		pusha
		pushf
		mov	al,09h			;Is year >= 80 ?
		call	Get_Rtc_Byte
		jc	short Year19xx
		cmp	al,80h
		mov	ax,1932h		;R392No, Set century = 1900 !
;R392		jae	short Year19xx
		jae	short @F		;R392
		mov	ax,2032h		;No, Set century = 2000 !
	@@:					;R392
		call	F000_Set_Cmos
Year19xx:
		popf
		popa
endif	;NO_Y2K_CHECK				;R438

		ret

Valid_Century	Endp

;------------------------------------------------
;Input	:	AL = CMOS index to get
;Output	:	CF : RTC is under update process
;		NC : AL = RTC value
;------------------------------------------------
		Public	Get_Rtc_Byte
Get_Rtc_Byte	Proc	Near
ifndef	NO_CHECK_UPDATE_BIT
		pusha
		call	Check_Upd
		popa
		jc	short @F
endif	;NO_CHECK_UPDATE_BIT
		call	F000_Get_Cmos
		clc
	@@:
		ret
Get_Rtc_Byte	Endp

;------------------------------------------------
;Input	:	AL = CMOS index to set
;		AH = Value to set to RTC
;Output	:	None
;------------------------------------------------
		Public	Set_Rtc_Byte
Set_Rtc_Byte	Proc	Near

ifndef	NO_CHECK_UPDATE_BIT
		pusha
		call	Check_Upd
		popa
		jc	short @F
endif	;NO_CHECK_UPDATE_BIT
		call	F000_Set_Cmos
	@@:
		ret
Set_Rtc_Byte	Endp

		Public	Check_Upd
Check_Upd	Proc	Near

		xor	cx,cx
	@@:
		mov	al,0ah NMI_OFF
		call	F000_Get_Cmos
		test	al,80h			;in update?
		jz	short @F
		loop	short @B
		stc
		ret
	@@:
		clc
		ret

Check_Upd	Endp
;R341 - ends

;R379Show_System_Cfg Proc	Near
;R379		push	ds
;R379		push	es
;R379		mov	ax,G_RAM
;R379		mov	es,ax
;R379		assume	es:G_RAM
;R379
;R379		push	cs
;R379		pop	ds
;R379
;R379;--------------- Show Border ----------------------------------
;R379
;R379		mov	word ptr Color_Offset[bp],offset Mono_Style
;R379		mov	si,offset SYSTEM_CONFIG_MSG
;R379		call	Disp_Str_In_BIOS
;R379
;R379;128K start
;R379;--------------- Show CPU_Type ---------------------
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+1) shl 8) + (LEFT_SIDE+20)
;R379		push	0F000h
;R379		pop	ds
;R379;R272		F000_call	CPU_Display
;R379;R272		call	Disp_Str_In_BIOS
;R379		call	CPU_Display		;R272
;R379		call	Disp_Str_In_POST	;R272
;R379;R355		call	Disp_Intel_S_CPU
;R379;R355 - starts
;R379		call	Disp_Extra_CPU_Info
;R379IF	BIOS_SUPPORT_586
;R379ifdef	DISP_MHZ_FOR_AMD_CYRIX
;R379;R355A		cmp	byte ptr CPU_LEVEL[bp], LEVEL_586
;R379;R355A		jne	short _11OLK
;R379;R355A		cmp	byte ptr CPU_BRAND[bp], CPU_BRAND_INTEL
;R379;R355A		je	short _11OLK
;R379;R355A		call	Check_K6_CPU			;R356
;R379;R355A		je	short _11OLK			;R356
;R379;R355A		mov	al,"-"
;R379;R355A		call	F000_Display_Char
;R379		mov	di, 1				;show '-'	;R355A
;R379		call	Try_Show_PRating
;R379	_11OLK:
;R379endif	;DISP_MHZ_FOR_AMD_CYRIX
;R379ENDIF	;BIOS_SUPPORT_586
;R379;R355 - ends
;R379
;R379;-------------- Show Math Coprocessor --------------
;R379
;R379		push	cs
;R379		pop	ds
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+2) shl 8) + (LEFT_SIDE+20)
;R379		mov	si,offset Not_Install_Str
;R379		test	byte ptr FIXED_DISK_STEP[bp],01h
;R379		jz	short @F
;R379		mov	si,offset Install_Str
;R379	@@:
;R379		call	Disp_Str_In_BIOS
;R379
;R379;---------------- Show CPU Clock ----------------------
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+3) shl 8) + (LEFT_SIDE+20)
;R379
;R379;R355 - starts
;R379IF	BIOS_SUPPORT_586
;R379ifndef	DISP_MHZ_FOR_AMD_CYRIX
;R379;R355A		cmp	byte ptr CPU_LEVEL[bp], LEVEL_586
;R379;R355A		jne	short No_Show_P_Rating
;R379;R355A		cmp	byte ptr CPU_BRAND[bp], CPU_BRAND_INTEL
;R379;R355A		je	short No_Show_P_Rating
;R379;R355A		call	Check_K6_CPU			;R356
;R379;R355A		je	short No_Show_P_Rating		;R356
;R379;R355A		call	Try_Show_PRating
;R379;R355A		jmp	short End_Sys_Clk
;R379;R355A - starts
;R379		xor	di, di			;do not show '-'
;R379 		call	Try_Show_PRating	;show p-rating for K5 & M1
;R379		jnc	short End_Sys_Clk	;show p-rating successfully
;R379;R355A - ends
;R379	No_Show_P_Rating:
;R379endif	;DISP_MHZ_FOR_AMD_CYRIX
;R379ENDIF	;BIOS_SUPPORT_586
;R379;R355 - ends
;R379
;R379		call	SysCfg_CPU_Clock1	;128K		     
;R379
;R379	End_Sys_Clk:						;R355
;R379;---------------- Show Floppy Drive A ----------------------
;R379ifndef	Support_1_FDD					;R377
;R379ifndef	SWAP_FDD_SHOW						;R320
;R379;R294 start
;R379		test	byte ptr FLOPPY_TYPE[bp],00001111b
;R379		jz	short @F
;R379		mov	si,offset SwapFloppy_Item
;R379		call	F000_GetItem_Value
;R379		or	al,al
;R379		jz	short @F
;R379		rol	byte ptr FLOPPY_TYPE[bp],4
;R379@@:
;R379;R294 end
;R379endif;	SWAP_FDD_SHOW						;R320
;R379endif	;Support_1_FDD					;R377
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+5) shl 8) + (LEFT_SIDE+20)
;R379		mov	bx,offset DRIVE_A_ITEM
;R379		call	Show_CMOS_Str
;R379
;R379;---------------- Floppy Drive B ----------------------
;R379
;R379ifndef	Support_1_FDD					;R264
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+6) shl 8) + (LEFT_SIDE+20)
;R379		mov	bx,offset DRIVE_B_ITEM
;R379		call	Show_CMOS_Str
;R379endif	;Support_1_FDD					;R264
;R379
;R379;---------------- Show Hard Drive C ----------------------
;R379
;R379		F000_call	Tran_HDD_User_Type	;R138
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+7) shl 8) + (LEFT_SIDE+20)
;R379;R302;R285 start
;R379;R302ifdef	CD_ROM
;R379;R303		mov	al,es:[CDROM_EMUL_HEAD]
;R379;R303		test	al,0ch
;R379;R303		jz	short @F
;R379;R303		and	al,3
;R379;R303		cmp	al,0
;R379;R303		jne	short @F
;R379		test	byte ptr CDROM_Exist_Flag[bp],PM_CDROM	;R303
;R379		jz	short @F				;R303
;R379		xor	di,di
;R379		call	Display_CDROM
;R379		jmp	short Show_DriveD
;R379@@:
;R379;R302endif	;CD_ROM
;R379;R302;R285 end
;R379;R325 start
;R379		test	byte ptr FIXED_ERROR[bp],HDD_Drive0_Err
;R379		jz	short @F
;R379		call	Display_None
;R379		jmp	short Show_DriveD
;R379@@:
;R379;R325 end
;R379		mov	bx,offset HDDC_ITEM
;R379		mov	al,CMOS12[bp]
;R379		and	al,0f0h
;R379		cmp	al,0f0h
;R379		je	short @F
;R379		shr	al,4
;R379		mov	CMOS19[bp],al
;R379	@@:
;R379ifdef	NEW_IDE_MODE_3				;R154
;R379		xor	di,di			;R154
;R379endif	;NEW_IDE_MODE_3 			;R154
;R379		mov	al,es:[HDD_MODE_FLAG]	;R213
;R379		and	al,3			;R213 get drive C mode (LBA or Normal ...)
;R379		call	SYSCFG_HDD
;R379
;R379;---------------- Show Hard Drive D ----------------------
;R379Show_DriveD:					;R285
;R379
;R379ifndef	IDE_PRIMARY_ONLY			;R224
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+8) shl 8) + (LEFT_SIDE+20)
;R379;R302;R285 start
;R379;R302ifdef	CD_ROM
;R379;R303		mov	al,es:[CDROM_EMUL_HEAD]
;R379;R303		test	al,0ch
;R379;R303		jz	short @F
;R379;R303		and	al,3
;R379;R303		cmp	al,1
;R379;R303		jne	short @F
;R379		test	byte ptr CDROM_Exist_Flag[bp],PS_CDROM	;R303
;R379		jz	short @F				;R303
;R379		mov	di,1
;R379		call	Display_CDROM
;R379		jmp	short Show_DriveE
;R379@@:
;R379;R302endif	;CD_ROM
;R379;R302;R285 end
;R379;R325 start
;R379		test	byte ptr FIXED_ERROR[bp],HDD_Drive1_Err
;R379		jz	short @F
;R379		call	Display_None
;R379		jmp	short Show_DriveE
;R379@@:
;R379;R325 end
;R379		mov	bx,offset HDDD_ITEM
;R379		mov	al,CMOS12[bp]
;R379		and	al,0fh
;R379		cmp	al,0fh
;R379		je	short @F
;R379		mov	CMOS1A[bp],al
;R379	@@:
;R379;R302 ifdef	NEW_IDE_MODE_3				;R154
;R379		mov	di,1			;R154
;R379;R302 endif	;NEW_IDE_MODE_3 			;R154
;R379		mov	al,es:[HDD_MODE_FLAG]	;R213
;R379		shr	al,2			;R213
;R379		and	al,3			;R213 get drive D mode (LBA or Normal ...)
;R379		call	SYSCFG_HDD
;R379endif	;IDE_PRIMARY_ONLY			;R224
;R379Show_DriveE:					;R285A
;R379;R102 - starts
;R379ifdef	Support_4_IDE
;R379
;R379;---------------- Show Hard Drive E ----------------------
;R379;R285A Show_DriveE:					;R285
;R379
;R379;R224 - start
;R379ifdef	IDE_PRIMARY_ONLY
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+8) shl 8) + (LEFT_SIDE+20)
;R379else	;IDE_PRIMARY_ONLY
;R379;R224 - end
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+9) shl 8) + (LEFT_SIDE+20)
;R379endif	;IDE_PRIMARY_ONLY			;R224
;R379;R302;R285 start
;R379;R302ifdef	CD_ROM
;R379;R303		mov	al,es:[CDROM_EMUL_HEAD]
;R379;R303		test	al,0ch
;R379;R303		jz	short @F
;R379;R303		and	al,3
;R379;R303		cmp	al,2
;R379;R303		jne	short @F
;R379		test	byte ptr CDROM_Exist_Flag[bp],SM_CDROM	;R303
;R379		jz	short @F				;R303
;R379		mov	di,2
;R379		call	Display_CDROM
;R379		jmp	short Show_DriveF
;R379@@:
;R379;R302endif	;CD_ROM
;R379;R302;R285 end
;R379;R325 start
;R379		test	byte ptr FIXED_ERROR[bp],HDD_Drive2_Err
;R379		jz	short @F
;R379		call	Display_None
;R379		jmp	short Show_DriveF
;R379@@:
;R379;R325 end
;R379		mov	bx,offset HDDE_ITEM
;R379;R302 ifdef	NEW_IDE_MODE_3				;R154
;R379		mov	di,2			;R154
;R379;R302 endif	;NEW_IDE_MODE_3 			;R154
;R379		mov	al,es:[HDD_MODE_FLAG]	;R213
;R379		shr	al,4			;R213
;R379		and	al,3			;R213 get drive E mode (LBA or Normal ...)
;R379		call	SYSCFG_HDD
;R379
;R379;---------------- Show Hard Drive F ----------------------
;R379Show_DriveF:					;R285
;R379
;R379ifndef	IDE_PRIMARY_ONLY			;R224
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+10) shl 8) + (LEFT_SIDE+20)
;R379;R302;R285 start
;R379;R302ifdef	CD_ROM
;R379;R303		mov	al,es:[CDROM_EMUL_HEAD]
;R379;R303		test	al,0ch
;R379;R303		jz	short @F
;R379;R303		and	al,3
;R379;R303		cmp	al,3
;R379;R303		jne	short @F
;R379		test	byte ptr CDROM_Exist_Flag[bp],SS_CDROM	;R303
;R379		jz	short @F				;R303
;R379		mov	di,3
;R379		call	Display_CDROM
;R379		jmp	short Show_Drive_End
;R379@@:
;R379;R302endif	;CD_ROM
;R379;R302;R285 end
;R379;R325 start
;R379		test	byte ptr FIXED_ERROR[bp],HDD_Drive3_Err
;R379		jz	short @F
;R379		call	Display_None
;R379		jmp	short Show_Drive_End
;R379@@:
;R379;R325 end
;R379		mov	bx,offset HDDF_ITEM
;R379;R302 ifdef	NEW_IDE_MODE_3				;R154
;R379		mov	di,3			;R154
;R379;R302 endif	;NEW_IDE_MODE_3 			;R154
;R379		mov	al,es:[HDD_MODE_FLAG]	;R213
;R379		shr	al,6			;R213
;R379		and	al,3			;R213 get drive F mode (LBA or Normal ...)
;R379		call	SYSCFG_HDD
;R379Show_Drive_End:					;R285
;R379
;R379endif	;IDE_PRIMARY_ONLY			;R224
;R379endif	;Support_4_IDE
;R379;R102 - ends
;R379
;R379;---------------- Show Base Memory --------------------
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+1) shl 8) + (RIGHT_SIDE+20)
;R379		xor	eax,eax
;R379		mov	ax,CMOS15[bp]	;BASE_MEMORY[bp]
;R379		call	short SYSCFG_Mem
;R379
;R379;---------------- Show Extended Memory --------------------
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+2) shl 8) + (RIGHT_SIDE+20)
;R379		mov	eax,EXT_MEM_SIZE[bp]
;R379		call	SYSCFG_Mem
;R379
;R379;---------------- Show Cache Size --------------------------
;R379
;R379;R226		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+3) shl 8) + (RIGHT_SIDE+21)
;R379
;R379;R226 - starts
;R379ifdef	Skip_Cache_Size_If_None
;R379		F000_call	Get_Cache_Size
;R379		or	al,al
;R379		jz	short SYSCFG_Cache_Mem_Exit
;R379endif	;Skip_Cache_Size_If_None
;R379
;R379		push	cs
;R379		pop	ds
;R379		mov	si, offset Cache_Mem_Size_Str
;R379		call	Disp_Str_In_BIOS
;R379;R226 - ends
;R379
;R379;R97 - starts
;R379		mov	si,offset ExtCache_Item
;R379		call	F000_GetItem_Value
;R379		or	al,al
;R379		jz	short Disp_Cache_None
;R379;R97 - ends
;R379
;R379;R289 - start
;R379;Get L2 cache size by execute CPUID (0fh,0A2h) for P6
;R379; bit 3-0 = 42H : 256k
;R379;	    43H : 512k
;R379		mov	al,byte ptr FIXED_DISK_STEP[bp]
;R379		and	al,CPU_TYPE_MASK
;R379		cmp	al,TYPE_P6	      	;P6 CPU ?
;R379		jne	short Not_P6_CPU
;R379
;R379		mov	eax,2			;read cache isze
;R379		db	0Fh,0A2h		;OP code: CPUID
;R379
;R379		call	Convert_P6L2_Cache	;convert cache size
;R379
;R379;R311		mov	al,5			;assume 256K
;R379;R311		cmp	dl,42h			;256k ?
;R379;R311	   	je	short Show_L2_Size
;R379;R311
;R379;R311		mov	al,6			;set 512k
;R379;R311		cmp	dl,43h			;512k ?
;R379;R311	   	je	short Show_L2_Size
;R379;R311		
;R379;R311		xor	al,al			;No L2 cache
;R379	   	jmp	short Show_L2_Size
;R379Not_P6_CPU:
;R379;R289 - end
;R379
;R379		F000_call	Get_Cache_Size
;R379
;R379Show_L2_Size:						;R289
;R379
;R379		or	al,al
;R379		jnz	short @F
;R379Disp_Cache_None:					;R97
;R379;R376		add	byte ptr CURSOR_X[bp],2
;R379		add	byte ptr CURSOR_X[bp],3		;R376
;R379		call	Display_None
;R379		jmp	short SYSCFG_Cache_Mem_Exit
;R379	@@:
;R379		add	byte ptr CURSOR_X[bp],1		;R376
;R379		mov	cl,al
;R379		dec	cl
;R379		mov	ax,16
;R379		shl	ax,cl
;R379		F000_call	Disp_Word_Int5
;R379		mov	al,'K'
;R379		call	F000_Display_Char
;R379
;R379SYSCFG_Cache_Mem_Exit:
;R379
;R379;R311 - start
;R379ifdef	MP_SUPPORT
;R379ifdef	P6_BIOS_ONLY	
;R379
;R379;Display secondary CPU's L2 cache size if dual CPUs are plugged
;R379
;R379		call	If_MP_PLUGGED 		;2 CPUs installed ?
;R379		jc	short SYSCFG_Cache_Mem_Exit1;no, no display
;R379
;R379		mov	al,'/'
;R379		call	F000_Display_Char
;R379		
;R379		push	es
;R379		xor	ax,ax					
;R379		mov	es,ax					
;R379		mov	dl,byte ptr es:[0502H]		;get cache size	
;R379		pop	es
;R379		
;R379		call	Convert_P6L2_Cache	;convert cache size
;R379
;R379		or	al,al
;R379		jnz	short @F
;R379
;R379		call	Display_None
;R379		jmp	short SYSCFG_Cache_Mem_Exit1
;R379	@@:
;R379		mov	cl,al
;R379		dec	cl
;R379		mov	ax,16
;R379		shl	ax,cl
;R379		F000_call	Disp_Word_Int5
;R379		mov	al,'K'
;R379		call	F000_Display_Char
;R379
;R379SYSCFG_Cache_Mem_Exit1:
;R379
;R379endif;	P6_BIOS_ONLY	
;R379endif;	MP_SUPPORT
;R379;R311 - end
;R379
;R379;---------------- Show Display Type ----------------------
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+5) shl 8) + (RIGHT_SIDE+20)
;R379		mov	bx,offset Video_Item
;R379		call	Show_CMOS_Str
;R379
;R379;---------------- Show Serial Ports -----------------------
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+6) shl 8) + (RIGHT_SIDE+20)
;R379		mov	si,offset G_RAM:COMM_PORT_ADDRS
;R379		mov	di,offset G_RAM:PRNTR_PORT_ADDRS
;R379		call	SYSCFG_Ports
;R379
;R379;---------------- Show Parallel Ports -----------------------
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+7) shl 8) + (RIGHT_SIDE+20)
;R379		mov	si,offset G_RAM:PRNTR_PORT_ADDRS
;R379		mov	di,offset G_RAM:EXT_SEGMENT
;R379		call	SYSCFG_Ports
;R379
;R379;-------------- Show OEM dependent message ----------------------
;R379
;R379;R102 - starts
;R379ifdef	Support_4_IDE
;R379;R224 - start
;R379ifdef	IDE_PRIMARY_ONLY
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+11) shl 8) + (RIGHT_SIDE+20)
;R379else	;IDE_PRIMARY_ONLY
;R379;R224 - end
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+13) shl 8) + (RIGHT_SIDE+20)
;R379endif	;IDE_PRIMARY_ONLY			;R224
;R379else	;Support_4_IDE
;R379;R102 - ends
;R379
;R379		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+11) shl 8) + (RIGHT_SIDE+20)
;R379
;R379endif	;Support_4_IDE				;R102
;R379
;R379IFDEF	NoteBook_Power_Management		;R171
;R379		call	Show_PM_Config		;R171
;R379ENDIF	;NoteBook_Power_Management		;R171
;R379
;R379		F000_CALL Ct_Show_Config
;R379
;R379ifndef	No_Show_PCI_Device			;R301A
;R379ifdef	PCI_BUS					;R301
;R379		push	0f000H				;R324
;R379		pop	ds				;R324
;R379		lea	si,SYSTEM1_BYTE			;R324
;R379		test	byte ptr [si],02H		;R324	;display PCI dev.
;R379		jnz	short No_PciDisplay		;R324
;R379
;R379		call	Show_PCI_Device		;R301
;R379
;R379No_PciDisplay:						;R324
;R379endif	;PCI_BUS				;R301
;R379endif	;No_Show_PCI_Device			;R301A
;R379
;R379;-------------- End of showing System Configuration ----------------------
;R379
;R379		call	F000_Vcrlf
;R379;128K end
;R379;R192		F000_call	Cursor_On
;R379
;R379		pop	es
;R379		pop	ds
;R379		ret
;R379Show_System_Cfg Endp

;R354 ;Function : return cache size in AL for display
;R354 ;Input    : DL - CPU register value to indicate cache size
;R354 ;Output   : AL - cache size for BIOS to display
;R354 ;           AL -  0 = 0K, 1=16K , 2=32K , 3=64K , 4=128K , 5=256K
;R354 ;	          6 =512K, 7=1024K ,etc...
;R354 Convert_P6L2_Cache	proc	near
;R354 		mov	al,5			;assume 256K
;R354 		cmp	dl,42h			;256k ?
;R354 	   	je	short Mark_L2_Size
;R354 
;R354 		mov	al,6			;set 512k
;R354 		cmp	dl,43h			;512k ?
;R354 	   	je	short Mark_L2_Size
;R354 
;R354 ;R348 - start
;R354 		mov	al,4			;assume 128K
;R354 		cmp	dl,41h			;128k ?
;R354 	   	je	short Mark_L2_Size	;yes
;R354 ;R348 - end
;R354 
;R354 		xor	al,al			;No L2 cache
;R354 Mark_L2_Size:
;R354 		ret
;R354 Convert_P6L2_Cache	endp


;R379ifndef	No_Show_PCI_Device			;R301A
;R379;R301 - Start
;R379ifdef	PCI_BUS
;R379Show_PCI_Device	proc	near
;R379		push	ds
;R379		pushad
;R379
;R379		push	cs
;R379		pop	ds
;R379
;R379;R301B		mov	byte ptr CURSOR_X[bp], 0
;R379;R301B - Start
;R379;R301E		mov	dx, 0E00h		;ROW=14, COL=0
;R379;R301E		call	Set_Cursor_Pos
;R379		mov	byte ptr CURSOR_X[bp], 0	;R301E
;R379		inc	byte ptr CURSOR_Y[bp]		;R301E
;R379
;R379		mov	si,offset DEV
;R379		call	F000_Display_String
;R379
;R379;R301E		mov	dx, 0F00h		;ROW=15, COL=0
;R379;R301E		call	Set_Cursor_Pos
;R379		mov	byte ptr CURSOR_X[bp], 0	;R301E
;R379		inc	byte ptr CURSOR_Y[bp]		;R301E
;R379
;R379		and	Post_Temp_Byte[BP], NOT 80h;Init flag for VGA found
;R379;R301B - End
;R379
;R379		xor	si, si			;First Device
;R379		xor	bh, bh			;Start from Bus 0
;R379Next_Bus:
;R379
;R379		xor	bl, bl			;Start from Device 0
;R379;R301B Disp_PCI_Loop:
;R379Disp_PCI_Device:					;R301B
;R379		push	bx			;Save Bus&Slot No.
;R379		shl	bl, 3			;Device Number in upper 5 bits
;R379
;R379;R301B - Start
;R379		mov	di, 0Ch			;Get PCI Device header type
;R379		call	Get_PCI_CFG
;R379		shr	eax, 16			;AL=add. 0E=Heater type
;R379		xor	ch, ch			;Assume last func=0
;R379		test	al, 80h
;R379		jz	short Single_Func
;R379
;R379		mov	ch, 07			;Device is multi func.
;R379Single_Func:
;R379
;R379		xor	cl, cl			;Start from Function 0
;R379Next_Func:
;R379		cmp	cl, ch			;Last function encountered
;R379		ja	Next_Dev		;Yes, above last function
;R379
;R379		push	cx
;R379		and	bl, not 07h
;R379		or	bl, cl
;R379;R301B - End
;R379
;R379		mov	di, 4			;Get PCI Device command reg.
;R379		call	Get_PCI_CFG
;R379		test	al, 03h			;PCI Device disabled?
;R379;R301B		jz	Next_DEV		;Disabled
;R379		jz	Skip_Show_PCI		;R301B
;R379
;R379		mov	di, 8			;Get Clase Code
;R379		call	Get_PCI_CFG
;R379;R316 - starts
;R379		ror	eax, 16
;R379		cmp	ax, 0001h		;compatible VGA?
;R379		je	short _uha4		;yes
;R379		ror	eax, 16
;R379;R316 - ends
;R379		rol	eax, 8
;R379		cmp	al, 06h			;Bridge Device?
;R379;R301B		je	Next_DEV		;Skip Bridge Device
;R379;R372		je	Skip_Show_PCI		;R301B
;R379		jne	short not_host_bridge 	;R372
;R379		push	eax			;R372
;R379		rol	eax, 8			;R372
;R379		cmp	al, 07h			;R372
;R379		pop	eax			;R372
;R379		jne	Skip_Show_PCI		;R372
;R379not_host_bridge:  				;R372
;R379
;R379;R301B - Start
;R379		cmp	al, 03h			;Display control?
;R379		jne	short Not_Vga
;R379	_uha4:							;R316
;R379		test	byte ptr Post_Temp_Byte[BP], 80h
;R379		jnz	Skip_Show_PCI
;R379
;R379		or	byte ptr Post_Temp_Byte[BP], 80h;Display controlere 
;R379							;   found
;R379Not_Vga:
;R379;R301B - End
;R379
;R379;R318 - Start
;R379		mov	di, 08h
;R379		call	Get_PCI_CFG		;Get Class Code
;R379		cmp	al, 0FFh		;No Device?
;R379		je	Skip_Show_PCI		;R301B
;R379;R318 - End
;R379
;R379		xor	di, di
;R379		call	Get_PCI_CFG		;Get Vendor&Device ID
;R379		cmp	ax, 0FFFFh		;No Device?
;R379;R301B		je	Next_DEV		;No Device, Skip
;R379		je	Skip_Show_PCI		;R301B
;R379
;R379		or	si, si			;First Device be showed
;R379		jnz	short No_Show_PCI_Field	;No
;R379
;R379		pushad				;R301C
;R379
;R379		mov	si,offset PCI_Field	;Show table head at first
;R379		pusha				;   PCI device
;R379		call	F000_Display_String
;R379		popa
;R379
;R379;R301B - Start
;R379;R301E		mov	si, (offset PCI_Border)+1
;R379;R301E		F000_CALL	VBORDER
;R379		mov	byte ptr CURSOR_X[bp], 0	;R301E
;R379		inc	byte ptr CURSOR_Y[bp]		;R301E
;R379		mov	al,196				;R301E
;R379		mov	cx,80				;R301E
;R379	@@:						;R301E
;R379		call	F000_Display_Char		;R301E
;R379		loop	short @B			;R301E
;R379
;R379		call	Get_Cursor_Pos
;R379		inc	dh
;R379		xor	dl, dl
;R379		call	Set_Cursor_Pos
;R379;R301B - End
;R379
;R379		popad				;R301C
;R379No_Show_PCI_Field:
;R379
;R379		pop	si			;Get Func No		;R301B
;R379		pop	di			;Get current Bus No and
;R379		push	di			;  Device No
;R379		push	si			;Save Func No		;R301B
;R379
;R379		push	eax			;Save Vendor&Device ID
;R379
;R379;R301B		mov	byte ptr CURSOR_X[bp], 2
;R379		mov	byte ptr CURSOR_X[bp], 2			;R301B
;R379;R301B		inc	byte ptr CURSOR_Y[bp]
;R379
;R379		mov	ax, di
;R379		xchg	ah, al
;R379;R301B		pusha
;R379		call	F000_DISP_BYTE_INT2	;Display Bus No
;R379;R301B		popa
;R379
;R379		mov	byte ptr CURSOR_X[bp], 11
;R379
;R379		xchg	ah, al
;R379;R301B		pusha
;R379		call	F000_DISP_BYTE_INT2	;Display Device No
;R379;R301B		popa
;R379
;R379;R301B - Start
;R379		mov	byte ptr CURSOR_X[bp], 21
;R379		mov	al, bl
;R379		and	al, 07
;R379		call	F000_DISP_BYTE_INT2	;Function No
;R379;R301B - End
;R379
;R379		pop	eax 			;Restore Vendor&Device ID
;R379
;R379		pusha
;R379;R301B		mov	byte ptr CURSOR_X[bp], 23
;R379		mov	byte ptr CURSOR_X[bp], 31		;R301B
;R379		F000_call	DISP_WORD_HEX4	;Display Vendor ID
;R379		popa
;R379
;R379		shr	eax, 16
;R379		pusha
;R379;R301B		mov	byte ptr CURSOR_X[bp], 35
;R379		mov	byte ptr CURSOR_X[bp], 43		;R301B
;R379		F000_call	DISP_WORD_HEX4	;Display Device ID
;R379		popa
;R379
;R379;R310 -  Start
;R379		mov	di, 8
;R379		call	Get_PCI_CFG		;Get Class Code
;R379		shr	eax, 16
;R379;R316 - starts
;R379		cmp	ax, 0001h		;compatible VGA ?
;R379		jne	short _uy7a		;no !
;R379		mov	ax, 0300h
;R379_uy7a:
;R379;R316 - ends
;R379		mov	si, ax
;R379		mov	al, ah
;R379;R310 - End
;R379
;R379;R310		mov	di, 8
;R379;R310		call	Get_PCI_CFG		;Get Class Code
;R379;R310		shr	eax, 24
;R379
;R379;R301D - start
;R379		cmp	al,MAX_CLS_NO		;check if valid class code
;R379		jbe	short Good_ClsCode	;yes, show it
;R379		xor	al,al			;no, set unknown device
;R379Good_ClsCode:
;R379;R301D - end
;R379
;R379;R310 - Start
;R379		cmp	si, 0101h
;R379		mov	si, offset IDE_DEV
;R379		je	short Show_Dev
;R379;R310 - End
;R379
;R379		xor	ah, ah
;R379		shl	ax, 1
;R379		push	bx
;R379		mov	bx, ax
;R379		mov	si, word ptr cs:[DEV_TBL+BX]
;R379		pop	bx
;R379Show_Dev:						;R310
;R379
;R379;R357 - start
;R379		cmp	si, offset DEV0C
;R379		jne	short Not_DEV0C
;R379		pusha
;R379		mov	di, 08h
;R379		call	Get_PCI_CFG		;Get Class Code
;R379		shr	eax,16			;Get Sub-Class Code
;R379		cmp	al,05h			;Is ACPI?
;R379		popa
;R379		jne	short Not_DEV0C		;No, skip
;R379		mov	si, offset DEV0C05
;R379Not_DEV0C:
;R379;R357 - end
;R379;R372 - start
;R379		cmp	si, offset DEV06
;R379		jne	short Not_DEV06
;R379		pusha
;R379		mov	di, 08h
;R379		call	Get_PCI_CFG		;Get Class Code
;R379		shr	eax,16			;Get Sub-Class Code
;R379		cmp	al,07h			;Is Cardbus?
;R379		popa
;R379		jne	short Not_DEV06		;No, skip
;R379		mov	si, offset DEV0607
;R379Not_DEV06:
;R379;R372 - end
;R379		pusha
;R379;R301B		mov	byte ptr CURSOR_X[bp], 45
;R379		mov	byte ptr CURSOR_X[bp], 52	;R301B
;R379		call	F000_Display_String
;R379		popa
;R379
;R379		pusha
;R379;R310 - Start
;R379		mov	byte ptr CURSOR_X[bp], 76	;R310
;R379		cmp	si, offset IDE_DEV
;R379		mov	al, 14
;R379		je	short Show_IRQ
;R379;R310 - End
;R379
;R379;R301B		mov	byte ptr CURSOR_X[bp], 70
;R379;R310		mov	byte ptr CURSOR_X[bp], 77	;R301B
;R379		mov	di, 3ch
;R379		call	Get_PCI_CFG		;Get Interrupt Line
;R379		or	al, al
;R379		jz	short IRQ_NA
;R379
;R379		cmp	al, 0fh
;R379		ja	short IRQ_NA
;R379
;R379Show_IRQ:						;R310
;R379
;R379		call	F000_DISP_BYTE_INT2	;Display Slot No
;R379
;R379		jmp	short End_IRQ_Show
;R379IRQ_NA:
;R379		mov	si, offset NA_Str
;R379		call	F000_Display_String
;R379End_IRQ_Show:
;R379		call	Get_Cursor_Pos		;R301B
;R379
;R379ifdef	NO_SHOW_IDE_DEVICE			;R315
;R379		cmp	si, offset IDE_DEV	;R315
;R379		je	short NO_SHOW_IDE_DEV	;R315
;R379endif;	NO_SHOW_IDE_DEVICE			;R315
;R379
;R379		inc	dh			;R301B
;R379NO_SHOW_IDE_DEV:				;R315
;R379		xor	dl, dl			;R301B
;R379		call	Set_Cursor_Pos		;R301B
;R379
;R379		popa
;R379
;R379Skip_Show_PCI:					;R301B
;R379		pop	cx			;R301B
;R379		inc	cl			;R301B
;R379		jmp	Next_Func		;R301B
;R379
;R379Next_Dev:
;R379		pop	bx			;Restore Bus&Device
;R379
;R379		inc	bl
;R379		cmp	bl, 32
;R379;R301B		jb	Disp_PCI_Loop
;R379		jb	Disp_PCI_Device		;R301B
;R379
;R379ifndef	NO_MULTI_PCI_SUPPORT			
;R379;R301B - Start
;R379;R351		F000_CALL	Find_P2P
;R379;R351		jc	short No_P2P
;R379;R351
;R379;R351;R301B - End
;R379;R351
;R379;R351		inc	bh
;R379;R351		cmp	bh, 32
;R379;R351		jb	Next_Bus
;R379;R351No_P2P:
;R379endif	;NO_MULTI_PCI_SUPPORT			
;R379
;R379;R351 - starts
;R379ifndef	NO_MULTI_PCI_SUPPORT			
;R379	ifdef	CONFIG_MECHANISM_1			
;R379		inc	bh
;R379		call	far ptr fProc_Qualify_PciBus
;R379		jnc	Next_Bus
;R379	endif	;CONFIG_MECHANISM_1
;R379endif	;NO_MULTI_PCI_SUPPORT			
;R379;R351 - ends
;R379
;R379		call	Get_Cursor_Pos		;R301B
;R379		inc	dh			;R301B
;R379		xor	dl, dl			;R301B
;R379		call	Set_Cursor_Pos		;R301B
;R379
;R379		popad
;R379		pop	ds
;R379
;R379		ret
;R379Show_PCI_Device	endp
;R379
;R379;R301B - Start
;R379;Input:	DH - Row
;R379;	DL - Column
;R379;Output:None
;R379;Description:Set the cursor position, if Row=23 then scroll up screen and 
;R379;	     Row=22
;R379Set_Cursor_Pos:
;R379		pusha
;R379		cmp	dh, 23
;R379		jb	short No_Scroll
;R379
;R379		push	dx
;R379
;R379		mov	ax, 0601h	;Screen scroll up
;R379;R301E		xor	bh, bh
;R379		mov	bh, ATTRIBUTE[bp]	;R301F
;R379		mov	cx, (0 shl 8)  + 0
;R379		mov	dx, (24 shl 8) + 79
;R379		int	10h
;R379
;R379		pop	dx
;R379		dec	dh
;R379No_Scroll:
;R379		mov	word ptr CURSOR_X[bp], dx
;R379
;R379		mov	ah, 02h		;Set Crusor position
;R379		xor	bh, bh
;R379		int	10h
;R379
;R379		popa
;R379		ret
;R379
;R379;Input :Nnone
;R379;Output:DH - Row
;R379;	DL - Column
;R379;Description:Get the cursor position
;R379Get_Cursor_Pos:
;R379		pusha
;R379
;R379		mov	ah, 03h
;R379		xor	bh, bh
;R379		int	10h
;R379
;R379		ror	edx, 16
;R379
;R379		popa
;R379
;R379		ror	edx, 16
;R379		ret
;R379;R301B - End
;R379
;R379F000_Disp_Byte_INT2:
;R379		pusha
;R379		F000_CALL	Disp_Byte_INT2
;R379		popa
;R379		ret
;R379
;R379Get_PCI_CFG:
;R379		push	ecx
;R379		push	bx
;R379		push	di
;R379
;R379		mov	ax, 0b10ah
;R379		int	1ah
;R379
;R379		mov	eax, ecx
;R379		pop	di
;R379		pop	bx
;R379		pop	ecx
;R379		ret
;R379
;R379PCI_Field:
;R379;R301B db "Bus No.  Device No.  Vendor ID   Device ID   Device Class            IRQ", 0
;R379db "Bus No. Device No. Func No. Vendor ID   Device ID   Device Class           IRQ", 0;R301B
;R379;R301E PCI_Border:	BORDER1 <,0,16,79,16,0>		;R301B
;R379
;R379DEV_TBL:
;R379		dw	offset DEV00
;R379		dw	offset DEV01
;R379		dw	offset DEV02
;R379		dw	offset DEV03
;R379		dw	offset DEV04
;R379		dw	offset DEV05
;R379		dw	offset DEV06
;R379		dw	offset DEV07
;R379		dw	offset DEV08
;R379		dw	offset DEV09
;R379		dw	offset DEV0A
;R379		dw	offset DEV0B
;R379		dw	offset DEV0C
;R379MAX_CLS_NO	EQU	($ - offset DEV_TBL)/2 - 1		;R301D
;R379
;R379DEV:		db	"PCI device listing.....", 0		;R301B
;R379DEV00:		db	"Unknown PCI Device",0
;R379DEV01:		db	"Mass Storage Controller",0
;R379DEV02:		db	"Network Controller",0
;R379DEV03:		db	"Display Controller",0
;R379DEV04:		db	"Multimedia Device",0
;R379DEV05:		db	"Memory Montroller",0
;R379DEV06:		db	"Bridge Device",0
;R379DEV07:		db	"Simple COMM. Controller",0
;R379DEV08:		db	"Base System Peripherals", 0
;R379DEV09:		db	"Input Device",0
;R379DEV0A:		db	"Docking Stations",0
;R379DEV0B:		db	"Processors", 0
;R379DEV0C:		db	"Serial Bus Controller",0
;R379IDE_DEV		db	"IDE Controller",0			;310
;R379NA_Str		db	"NA",0
;R379DEV0C05		db	"SMBus Controller",0			;R357
;R379;R301 - End
;R379;R372 - start
;R379DEV0607		db	"PCI/CardBus bridge",0
;R379;R372 - end
;R379endif	;PCI_BUS
;R379endif	;No_Show_PCI_Device			;R301A

;128k - start

;R379Not_Install_Str db	'Not Installed',0
;R379Install_Str	db	'Installed',0
;R379None_Str	db	'None',0
;R379CDROM_Str	db	'CDROM',0			;R285
;R379ARMD_Str	db	'LS-120',0			;R345
;R379IOMEGA_ZIP_Str	db	'ZIP-100',0			;R362
;R379MB_Str		db	'MB',0
;R379;R213ifdef Post_Auto_IDE_Detect 			;R120
;R379;R213Auto_Str	db	'Auto Type ',0                  ;R120
;R379;R213endif ;Post_Auto_IDE_Detect			;R120
;R379;R213User_Str	db	'User '
;R379comment %						;R219
;R379User_Str	db	'CHS ',0                        ;R213
;R379User_Str_Len	EQU	$ - offset User_Str		;R213
;R379		db	'LBA ',0                        ;R213
;R379		db	'LRG ',0                        ;R213
;R379%							;R219
;R379
;R379;R302A ifdef	NEW_IDE_MODE_3					;R154
;R379;R213HDD_Mode_Str	db	'Mode',0                ;R154
;R379HDD_Mode_Str	db	',Mode',0                       ;R213
;R379ifdef	Ultra_DMA33_support				;R347
;R379HDD_UDMA_Str	db	',UDMA',0                       ;R347
;R379endif	;Ultra_DMA33_support				;R347
;R379;R302A else	;NEW_IDE_MODE_3 				;R154
;R379;R302A Type_Str	db	'Type ',0
;R379;R302A endif	;NEW_IDE_MODE_3 				;R154
;R379
;R379		LEFT_SIDE	EQU	2
;R379		RIGHT_SIDE	EQU	42
;R379		SYSTEM_Y	EQU	2
;R379		PERI_Y		EQU	SYSTEM_Y+4
;R379System_Config_Msg:
;R379		POS	<,30,0>
;R379		db	V_WARN,'Award Software, Inc.'
;R379		POS	<,29,1>
;R379		db	V_WARN,'System Configurations'
;R379
;R379ifdef	Support_4_IDE					;R102
;R379ifdef	IDE_PRIMARY_ONLY				;R224
;R379		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+9,1>	;R224
;R379else	;IDE_PRIMARY_ONLY				;R224
;R379		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+11,1>	;R102
;R379endif	;IDE_PRIMARY_ONLY				;R224
;R379else	;Support_4_IDE					;R102
;R379		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+9,1>
;R379endif	;Support_4_IDE					;R102
;R379
;R379		BORDER1 <,1,PERI_Y,78,PERI_Y,0>
;R379		POS	<,0,PERI_Y>
;R379		db	'Ç'
;R379		POS	<,79,PERI_Y>
;R379		db	'¶'
;R379
;R379		POS	<,LEFT_SIDE,SYSTEM_Y+1>
;R379		db	'CPU Type'
;R379		ADDX	<,10>
;R379		db	':'
;R379
;R379		POS	<,LEFT_SIDE,SYSTEM_Y+2>
;R379		db	'Co-Processor'
;R379		ADDX	<,6>
;R379		db	':'
;R379
;R379ifndef	NO_CPU_CLOCK_DISPLAY				;R278
;R379		POS	<,LEFT_SIDE,SYSTEM_Y+3>
;R379		db	'CPU Clock'
;R379		ADDX	<,9>
;R379		db	':'
;R379endif;	NO_CPU_CLOCK_DISPLAY				;R278
;R379
;R379		POS	<,RIGHT_SIDE,SYSTEM_Y+1>
;R379		db	'Base Memory'
;R379		ADDX	<,7>
;R379		db	':'
;R379
;R379		POS	<,RIGHT_SIDE,SYSTEM_Y+2>
;R379		db	'Extended Memory'
;R379		ADDX	<,3>
;R379		db	':'
;R379
;R379;R226		POS	<,RIGHT_SIDE,SYSTEM_Y+3>
;R379;R226		db	'Cache Memory'
;R379;R226		ADDX	<,6>
;R379;R226		db	':'
;R379
;R379		POS	<,LEFT_SIDE,PERI_Y+1>
;R379		db	'Diskette Drive  A :'
;R379
;R379ifndef	Support_1_FDD					;R264
;R379		POS	<,LEFT_SIDE,PERI_Y+2>
;R379		db	'Diskette Drive  B :'
;R379endif	;Support_1_FDD					;R264
;R379
;R379ifdef	Support_4_IDE				;R129
;R379		POS	<,LEFT_SIDE,PERI_Y+3>	;R129
;R379		db	'Pri. Master  Disk :'   ;R129
;R379
;R379ifdef	IDE_PRIMARY_ONLY			;R224
;R379		POS	<,LEFT_SIDE,PERI_Y+4>	;R224
;R379		db	'Sec. Master  Disk :'   ;R224
;R379else	;IDE_PRIMARY_ONLY			;R224
;R379		POS	<,LEFT_SIDE,PERI_Y+4>	;R129
;R379		db	'Pri. Slave   Disk :'   ;R129
;R379
;R379		POS	<,LEFT_SIDE,PERI_Y+5>	;R129
;R379		db	'Sec. Master  Disk :'   ;R129
;R379
;R379		POS	<,LEFT_SIDE,PERI_Y+6>	;R129
;R379		db	'Sec. Slave   Disk :'   ;R129
;R379endif	;IDE_PRIMARY_ONLY			;R224
;R379
;R379else;	Support_4_IDE				;R129
;R379		POS	<,LEFT_SIDE,PERI_Y+3>
;R379		db	'Hard Disk Drive C :'
;R379
;R379ifndef	IDE_PRIMARY_ONLY			;R224
;R379		POS	<,LEFT_SIDE,PERI_Y+4>
;R379		db	'Hard Disk Drive D :'
;R379endif	;IDE_PRIMARY_ONLY			;R224
;R379endif;	Support_4_IDE				;R129
;R379
;R379;R129 ;R102 - starts
;R379;R129 ifdef	Support_4_IDE
;R379;R129		POS	<,LEFT_SIDE,PERI_Y+5>
;R379;R129		db	'Hard Disk Drive E :'
;R379
;R379;R129		POS	<,LEFT_SIDE,PERI_Y+6>
;R379;R129		db	'Hard Disk Drive F :'
;R379;R129 endif;	Support_4_IDE
;R379;R129 ;R102 - end
;R379
;R379		POS	<,RIGHT_SIDE,PERI_Y+1>
;R379		db	'Display Type'
;R379		ADDX	<,6>
;R379		db	':'
;R379
;R379		POS	<,RIGHT_SIDE,PERI_Y+2>
;R379		db	'Serial Port(s)'
;R379		ADDX	<,4>
;R379		db	':'
;R379
;R379		POS	<,RIGHT_SIDE,PERI_Y+3>
;R379		db	'Parallel Port(s)  :'
;R379		db	0
;R379
;R379;R226 - starts
;R379Cache_Mem_Size_Str:
;R379		POS	<,RIGHT_SIDE,SYSTEM_Y+3>
;R379		db	'Cache Memory'
;R379		ADDX	<,6>
;R379		db	':  '
;R379		db	0
;R379;R226 - ends
;R379
;R379Show_CMOS_Num:
;R379
;R379		mov	byte ptr USE_ITEMSTAT_BUF[bp],1
;R379		F000_call Read_Item_Value
;R379		mov	ax,dx
;R379		call	di
;R379		ret
;R379
;R379Show_CMOS_Str:
;R379		push	0F000h
;R379		pop	ds
;R379		mov	byte ptr USE_ITEMSTAT_BUF[bp],1
;R379		F000_call  Read_Item_Value
;R379		F000_call  Get_VarString_Offset ;get string to show
;R379		call	Disp_Str_In_BIOS
;R379		ret
;R379SYSCFG_Ports:
;R379		mov	ax,es:[si]
;R379		or	ax,ax
;R379		jz	Display_None	;128k
;R379
;R379SYSCFG_Ports_1:
;R379		mov	ax,es:[si]
;R379		inc	si
;R379		inc	si
;R379		or	ax,ax
;R379		jz	short @F
;R379		pusha
;R379		F000_call AX_To_HEX3
;R379		F000_call SHOW_Six_Digit
;R379		inc	byte ptr CURSOR_X[bp]
;R379		popa
;R379		cmp	si,di
;R379		jb	short SYSCFG_Ports_1
;R379	@@:
;R379		ret
;R379
;R379SYSCFG_Mem:
;R379		F000_call Disp_Dword_Int6
;R379		mov	al,'K'
;R379		call	F000_Display_Char
;R379		ret
;R379
;R379		public	SysCfg_CPU_Clock1
;R379SysCfg_CPU_Clock1:
;R379
;R379ifndef	NO_CPU_CLOCK_DISPLAY				;R278
;R379		push	ds
;R379		push	cs
;R379		pop	ds
;R379;R90		call	Get_Mhz_String
;R379;R90		call	Disp_Str_In_BIOS
;R379
;R379;R90 - starts
;R379;R344		xor	ah,ah
;R379;R344		mov	al,CPU_INT_CLOCK[bp]
;R379		mov	ax,CPU_INT_CLOCK[bp]	;R344
;R379
;R379;R205 - start
;R379;Show 133Mhz if 132Mhz detected
;R379		cmp	al,132
;R379		jne	short Not_132
;R379		mov	al,133
;R379Not_132:
;R379;R205 - end
;R379
;R379		push	ax
;R379		F000_call	AX_To_DEC3
;R379		pop	ax
;R379		cmp	ax,100
;R379		jae	short @F
;R379		sub	byte ptr CURSOR_X[bp],1
;R379	@@:
;R379		F000_call	Show_SIX_DIGIT
;R379;R90 - ends
;R379
;R379		mov	si,offset Str_Mhz
;R379		call	Disp_Str_In_BIOS
;R379		pop	ds
;R379endif;	NO_CPU_CLOCK_DISPLAY				;R278
;R379		ret
;R379
;R379;R302;R285 start
;R379;R302ifdef	CD_ROM
;R379Display_CDROM:
;R379		push	ds
;R379		push	cs
;R379		pop	ds
;R379		mov	si,offset CDROM_Str
;R379;R345 start
;R379;R359		mov	al,es:[ATAPI_Byte]
;R379		movzx	ax,byte ptr es:[ATAPI_Byte]	;R359
;R379		test	al,00000100b		;test ARMD exist?
;R379		jz	short @F
;R379;R359 start
;R379		test	al,00110000b		;R359A have 2 LS120/ZIP100 drive?
;R379		jz	short Only_check_first	;R359A
;R379		push	ax
;R379		shr	al,4
;R379		and	al,3
;R379		cmp	ax,di
;R379		pop	ax
;R379		mov	ah,80h	;R362
;R379		je	short Get_ARMD_Str
;R379Only_check_first:					;R359A
;R379;R359 end
;R379;R359		and	ax,3
;R379		and	al,3				;R359
;R379		xor	ah,ah	;R362
;R379		cmp	ax,di
;R379		jne	short @F
;R379		mov	ah,40h	;R362
;R379Get_ARMD_Str:						;R359
;R379		mov	si,offset ARMD_Str
;R379;R362 start
;R379		test	byte ptr es:[ATAPI_Byte],ah
;R379		jz	short @F
;R379		lea	si,IOMEGA_ZIP_Str
;R379;R362 end
;R379@@:
;R379;R345 end
;R379		call	Disp_Str_In_BIOS
;R379
;R379		call	Show_PIO_UDMA			;R347
;R379;R302 start
;R379;R347		mov	si,offset HDD_Mode_Str	
;R379;R347		call	Disp_Str_In_BIOS	
;R379;R347		add	di,HDD_0_MODE		
;R379;R347		mov	al,[bp+di]		
;R379;R347		F000_call	AX_To_DEC2
;R379;R347		F000_call	Show_SIX_DIGIT
;R379;R302 end
;R379		pop	ds
;R379		ret
;R379;R302endif	;CD_ROM
;R379;R302;R285 end
;R379Display_None:
;R379		push	ds
;R379		push	cs
;R379		pop	ds
;R379		mov	si,offset None_Str
;R379		call	Disp_Str_In_BIOS
;R379		pop	ds
;R379		ret
;R379
;R379SYSCFG_HDD:
;R379		F000_call Read_Item_Value
;R379		or	dl,dl
;R379		jz	Display_None
;R379		cmp	dl,46				;R207A
;R379		jb	short @F			;R207A
;R379;R207 start
;R379		push	di
;R379		push	dx				;R211
;R379		F000_call	Get_HDD_CMOS_Info
;R379		cmp	word ptr [bp+di+0],0		;CYLINDER
;R379		pop	dx				;R211
;R379		pop	di
;R379		je	short Display_None
;R379;R207 end
;R379@@:							;R207A
;R379
;R379		push	cs
;R379		pop	ds
;R379
;R379;R213 start
;R379;R219		mov	si,offset User_Str
;R379;R219		mov	cl,User_Str_Len
;R379;R219		mul	cl
;R379;R219		add	si,ax
;R379;R219		call	Disp_Str_In_BIOS
;R379		mov	ch,al				;R219
;R379		F000_call	Disp_Access_mode	;R219
;R379;R213 end
;R379		call	Show_PIO_UDMA		;R347
;R379ifdef	NEW_IDE_MODE_3				;R154
;R379;R347		mov	si,offset HDD_Mode_Str	;R154
;R379;R347		call	Disp_Str_In_BIOS	;R154
;R379;R347		add	di,HDD_0_MODE		;R154
;R379;R347		mov	al,[bp+di]		;R154
;R379;R213else	;NEW_IDE_MODE_3 			;R154
;R379;R213		cmp	dl,47
;R379;R213		jbe	short @F
;R379;R213
;R379;R213		mov	si,offset User_Str
;R379;R213		call	Disp_Str_In_BIOS
;R379;R213		jmp	short SHOW_HDD_SIZE
;R379;R213	@@:
;R379;R213;R120 start
;R379;R213		mov	byte ptr Post_Auto_type[bp],46
;R379;R213ifdef Post_Auto_IDE_Detect
;R379;R213		jne	short @F
;R379;R213		mov	si,offset Auto_Str
;R379;R213		call	Disp_Str_In_BIOS
;R379;R213		jmp	short SHOW_HDD_SIZE
;R379;R213@@:
;R379;R213endif ;Post_Auto_IDE_Detect
;R379;R213;R120 end
;R379;R213		push	dx
;R379;R213		mov	si,offset Type_Str
;R379;R213		call	Disp_Str_In_BIOS
;R379;R213		pop	ax
;R379;R213endif	;NEW_IDE_MODE_3 			;R154
;R379;R347		F000_call	AX_To_DEC2
;R379;R347		F000_call	Show_SIX_DIGIT
;R379endif	;NEW_IDE_MODE_3 				;R213
;R379
;R379SHOW_HDD_SIZE:
;R379		mov	al,','
;R379		call	F000_Display_Char
;R379;R330		F000_call Transfer_Hdd_Parms
;R379;R330 start
;R379;-------------------
;R379;calculate HDD size
;R379;-------------------
;R379		F000_call	Get_HDD_CMOS_Info
;R379;R353 start
;R379		push	ds
;R379		push	bx
;R379		jnz	short Get_User_Type
;R379		movzx	ax,byte ptr [bp+si]		;Hdd type no.
;R379		dec	al
;R379		shl	ax,4
;R379		mov	bx,offset HDISK_PARMS
;R379		add	bx,ax
;R379		push	seg Dgroup
;R379		pop	ds
;R379		movzx	ax,byte ptr [bx+2]		;heads
;R379		movzx	cx,byte ptr [bx+14]		;sectors
;R379		mov	bx,[bx]				;cylinders
;R379		jmp	short Disp_HDD_Size
;R379Get_User_Type:
;R379		movzx	ax,byte ptr [bp+di+2]		;heads
;R379		movzx	cx,byte ptr [bp+di+7]		;sectors
;R379		mov	bx,[bp+di+0]			;cylinders
;R379Disp_HDD_Size:
;R379		shl	cx,2
;R379		mul	cx
;R379		mul	bx
;R379		pop	bx
;R379		pop	ds
;R379;R353 end
;R379;R353		xor	ah,ah
;R379;R353		mov	al,[bp+di+2]		;heads
;R379;R353		xor	ch,ch
;R379;R353		mov	cl,[bp+di+7]		;sectors
;R379;R353		shl	cx,2
;R379;R353		mul	cx
;R379;R353		mul	word ptr [bp+di+0]	;cylinders
;R379		mov	cx,15625/2
;R379		div	cx
;R379		mov	HDDSIZE[bp],ax
;R379;R330 end
;R379		F000_call Disp_Word_Int5
;R379		mov	si,offset MB_Str
;R379		call	Disp_Str_In_BIOS
;R379		ret
;R379
;R379;R349 start
;R379ifdef	NEW_IDE_MODE_3
;R379IdeMode_Item:
;R379		dw      offset DGROUP:IdeA_Mode_Item
;R379		dw      offset DGROUP:IdeB_Mode_Item
;R379		dw      offset DGROUP:IdeC_Mode_Item
;R379		dw      offset DGROUP:IdeD_Mode_Item
;R379endif	;NEW_IDE_MODE_3
;R379;R349 end
;R379;R347 start
;R379Show_PIO_UDMA:
;R379ifdef	NEW_IDE_MODE_3
;R379ifdef	Ultra_DMA33_support
;R379		cmp	byte ptr HDD_0_UltraDMA[bp+di],0ffh
;R379		je	short @F
;R379		mov	si,offset HDD_UDMA_Str
;R379		call	Disp_Str_In_BIOS
;R379		add	di,HDD_0_UltraDMA
;R379		jmp	short Show_Mode			;R349
;R379;R349		mov	al,[bp+di]
;R379;R349		F000_call	AX_To_DEC2
;R379;R349		F000_call	Show_SIX_DIGIT
;R379@@:
;R379endif	;Ultra_DMA33_support
;R379		mov	si,offset HDD_Mode_Str
;R379		call	Disp_Str_In_BIOS
;R379;R349 start
;R379		mov     si,di
;R379		shl	si,1
;R379		add	si,offset cs:IdeMode_Item
;R379		mov     si,cs:[si]
;R379		call	F000_GetItem_Value
;R379		sub	al,1				;auto ?
;R379		jnc	short Mode_Not_Auto
;R379;R349 end
;R379		add	di,HDD_0_MODE
;R379Show_Mode:						;R349
;R379		mov	al,[bp+di]
;R379Mode_Not_Auto:						;R349
;R379		F000_call	AX_To_DEC2
;R379		F000_call	Show_SIX_DIGIT
;R379endif	;NEW_IDE_MODE_3
;R379		ret
;R379;R347 end
;R379;128k - end
;R379
;R379Str_Mhz 	db	'MHz',0
;128K		LEFT_SIDE	EQU	2
;128K		RIGHT_SIDE	EQU	42
;128K		SYSTEM_Y	EQU	2
;128K		PERI_Y		EQU	SYSTEM_Y+4
;128K
;128K		PUBLIC	SYSTEM_CONFIG_MSG
;128KSYSTEM_CONFIG_MSG:
;128K		POS	<,30,0>
;128K		db	V_WARN,'Award Software, Inc.'
;128K		POS	<,29,1>
;128K		db	V_WARN,'System Configurations'
;128K		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+9,1>
;128K		BORDER1 <,1,PERI_Y,78,PERI_Y,0>
;128K		POS	<,0,PERI_Y>
;128K		db	'Ç'
;128K		POS	<,79,PERI_Y>
;128K		db	'¶'
;128K
;128K		POS	<,LEFT_SIDE,SYSTEM_Y+1>
;128K		db	'CPU Type          : '
;128K		CALLROUTINE <,offset SYSCFG_CPU_Type>
;128K
;128K		POS	<,LEFT_SIDE,SYSTEM_Y+2>
;128K		db	'Co-Processor      : '
;128K		CALLROUTINE <,offset SYSCFG_387>
;128K
;128K		POS	<,LEFT_SIDE,SYSTEM_Y+3>
;128K		CALLROUTINE <,offset SYSCFG_CPU_CLOCK>
;128K
;128K		POS	<,RIGHT_SIDE,SYSTEM_Y+1>
;128K		db	'Base Memory       :'
;128K		CALLROUTINE <,offset SYSCFG_Base_Mem>
;128K
;128K		POS	<,RIGHT_SIDE,SYSTEM_Y+2>
;128K		db	'Extended Memory   :'
;128K		CALLROUTINE <,offset SYSCFG_Ext_Mem>
;128K
;128K		POS	<,RIGHT_SIDE,SYSTEM_Y+3>
;128K		CALLROUTINE <,offset SYSCFG_Cache_Mem>
;128K
;128K		POS	<,LEFT_SIDE,PERI_Y+1>
;128K		db	'Diskette Drive  A : '
;128K		CALLROUTINE <,offset SYSCFG_DRIVE_A>
;128K
;128K		POS	<,LEFT_SIDE,PERI_Y+2>
;128K		db	'Diskette Drive  B : '
;128K		CALLROUTINE <,offset SYSCFG_DRIVE_B>
;128K
;128K		POS	<,LEFT_SIDE,PERI_Y+3>
;128K		db	'Hard Disk Drive C : '
;128K		CALLROUTINE <,offset SYSCFG_DRIVE_C>
;128K
;128K		POS	<,LEFT_SIDE,PERI_Y+4>
;128K		db	'Hard Disk Drive D : '
;128K		CALLROUTINE <,offset SYSCFG_DRIVE_D>
;128K
;128K		POS	<,RIGHT_SIDE,PERI_Y+1>
;128K		db	'Display Type      : '
;128K		CALLROUTINE <,offset SYSCFG_Disp_Type>
;128K
;128K		POS	<,RIGHT_SIDE,PERI_Y+2>
;128K		db	'Serial Port(s)    : '
;128K		CALLROUTINE <,offset SYSCFG_Serials>
;128K
;128K		POS	<,RIGHT_SIDE,PERI_Y+3>
;128K		db	'Parallel Port(s)  : '
;128K		CALLROUTINE <,offset SYSCFG_Parallels>
;128K
;128K		POS	<,0,SYSTEM_Y+10>
;128K
;128K		CALLROUTINE <,offset Ct_Show_Config>
;128K		ADDY	<,1>		;carriage
;128K		POS	<,0,>		;return
;128K
;128K		db	0
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSysCfg_CPU_Type	Proc	Near
;128K		F000_call	CPU_Display
;128K		call	Disp_Str_In_BIOS
;128K		call	Disp_Intel_S_CPU		;R54
;128K		ret
;128KSysCfg_CPU_Type	Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSYSCFG_387 Proc	Near
;128K		mov	si,offset Not_Install_Str
;128K		test	byte ptr FIXED_DISK_STEP[bp],01h
;128K		jz	short @F
;128K		mov	si,offset Install_Str
;128K	@@:
;128K		call	Disp_Str_In_BIOS
;128K		ret
;128K
;128KSYSCFG_387 Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSysCfg_Clock_Msg	db	'CPU Clock         : ',0
;128KSysCfg_CPU_Clock	Proc	Near
;128K		mov	al,cs:[0EB07h]
;128K		and	al,0Ch
;128K		cmp	al,08h
;128K		jne	short SysCfg_CPU_Clock_Exit
;128K		mov	si,offset SysCfg_Clock_Msg
;128K		call	Disp_Str_In_BIOS
;128K
;128KSysCfg_CPU_Clock1:
;128K
;128K		push	ds	;128k
;128K		push	cs	;128k
;128K		pop	ds	;128k
;128K		call	Get_Mhz_String
;128K		call	Disp_Str_In_BIOS
;128K		mov	si,offset Str_Mhz
;128K		call	Disp_Str_In_BIOS
;128K		pop	ds	;128k
;128K
;128KSysCfg_CPU_Clock_Exit:
;128K
;128K		ret
;128KSysCfg_CPU_Clock	Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSYSCFG_Base_Mem		Proc	Near
;128K			xor	eax,eax
;128K			mov	ax,CMOS15[bp]	;BASE_MEMORY[bp]
;128K			jmp	short SYSCFG_Mem
;128KSYSCFG_Base_Mem		Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSYSCFG_Ext_Mem		Proc	Near
;128K			mov	eax,EXT_MEM_SIZE[bp]
;128KSYSCFG_Mem:
;128K			F000_call	Disp_Dword_Int6
;128K			mov	al,'K'
;128K			call	F000_Display_Char
;128K			ret
;128KSYSCFG_Ext_Mem		Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSysCfg_Cache_Msg	db	'Cache Memory      : ',0
;128KSYSCFG_Cache_Mem	Proc	Near
;128K
;128K		mov	al,cs:[0EB10h]
;128K		and	al,0Ch
;128K		cmp	al,08h
;128K		jne	short SYSCFG_Cache_Mem_Exit
;128K		mov	si,offset SysCfg_Cache_Msg
;128K		call	Disp_Str_In_BIOS
;128K		F000_call	Get_Cache_Size
;128K		or	al,al
;128K
;128K		jnz	short @F
;128K		mov	al,' '
;128K		call	F000_Display_Char
;128K		mov	al,' '
;128K		call	F000_Display_Char
;128K		jmp	short Display_None
;128K	@@:
;128K		mov	cl,al
;128K		dec	cl
;128K		mov	ax,16
;128K		shl	ax,cl
;128K		F000_call	Disp_Word_Int5
;128K		mov	al,'K'
;128K		call	F000_Display_Char
;128K
;128KSYSCFG_Cache_Mem_Exit:
;128K
;128K		ret
;128KSYSCFG_Cache_Mem	Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSYSCFG_DRIVE_A:
;128K		mov	bx,offset DRIVE_A_ITEM
;128K		jmp	Show_CMOS_Str
;128K
;128KSYSCFG_DRIVE_B:
;128K		mov	bx,offset DRIVE_B_ITEM
;128K		jmp	Show_CMOS_Str
;128K
;128KSYSCFG_DRIVE_C:
;128K		mov	bx,offset HDDC_ITEM
;128K		mov	al,CMOS12[bp]
;128K		and	al,0f0h
;128K		cmp	al,0f0h
;128K		je	short @F
;128K		shr	al,4
;128K		mov	CMOS19[bp],al
;128K	@@:
;128K		jmp	short SYSCFG_HDD
;128K
;128KSYSCFG_DRIVE_D:
;128K		mov	bx,offset HDDD_ITEM
;128K		mov	al,CMOS12[bp]
;128K		and	al,0fh
;128K		cmp	al,0fh
;128K		je	short SYSCFG_HDD
;128K		mov	CMOS1A[bp],al
;128KSYSCFG_HDD:
;128K		test	word ptr es:[10h],00C0h
;128K		jz	short Display_None
;128K		F000_call	Read_Item_Value
;128K		or	dl,dl
;128K		jnz	short @F
;128KDisplay_None:
;128K		mov	si,offset None_Str
;128K		call	Disp_Str_In_BIOS
;128K		ret
;128K	@@:
;128K		cmp	dx,47
;128K		jbe	short @F
;128K		mov	si,offset User_Str
;128K		call	Disp_Str_In_BIOS
;128K		jmp	short SHOW_HDD_SIZE
;128K	@@:
;128K		push	dx
;128K		mov	si,offset Type_Str
;128K		call	Disp_Str_In_BIOS
;128K		pop	ax
;128K		F000_call	AX_To_DEC2
;128K		F000_call	Show_SIX_DIGIT
;128K
;128KSHOW_HDD_SIZE:
;128K		mov	al,','
;128K		call	F000_Display_Char
;128K		F000_call	Transfer_Hdd_Parms
;128K		F000_call	Disp_Word_Int5
;128K		mov	si,offset MB_Str
;128K		call	Disp_Str_In_BIOS
;128K		ret
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSYSCFG_Disp_Type	Proc	Near
;128K			mov	bx,offset Video_Item
;128K			jmp	Show_CMOS_Str
;128KSYSCFG_Disp_Type	Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSYSCFG_Serials		Proc	Near
;128K		mov	si,offset G_RAM:COMM_PORT_ADDRS
;128K		mov	di,offset G_RAM:PRNTR_PORT_ADDRS
;128K		jmp	short SYSCFG_Ports
;128KSYSCFG_Serials		Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KSYSCFG_Parallels	Proc	Near
;128K		mov	si,offset G_RAM:PRNTR_PORT_ADDRS
;128K		mov	di,offset G_RAM:EXT_SEGMENT
;128KSYSCFG_Ports:
;128K		mov	ax,es:[si]
;128K		or	ax,ax
;128K		jz	short Display_None
;128KSYSCFG_Ports_1:
;128K		mov	ax,es:[si]
;128K		inc	si
;128K		inc	si
;128K		or	ax,ax
;128K		jz	short @F
;128K		pusha
;128K		F000_call	AX_To_HEX3
;128K		F000_call	SHOW_Six_Digit
;128K		mov	al,' '
;128K		call	F000_Display_Char
;128K		popa
;128K		cmp	si,di
;128K		jb	short SYSCFG_Ports_1
;128K	@@:
;128K		ret
;128KSYSCFG_Parallels	Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KShow_CMOS_Num	Proc	Near
;128K		mov	byte ptr USE_ITEMSTAT_BUF[bp],1
;128K		F000_call	Read_Item_Value
;128K		mov	ax,dx
;128K		call	di
;128K		ret
;128KShow_CMOS_Num	Endp
;128K
;128K;[]=========================================================================[]
;128K;[]=========================================================================[]
;128KShow_CMOS_Str	Proc	Near
;128K		mov	byte ptr USE_ITEMSTAT_BUF[bp],1
;128K		F000_call	Read_Item_Value
;128K		F000_call	Get_VarString_Offset	;get string to show
;128K		call	Disp_Str_In_BIOS
;128K		ret
;128KShow_CMOS_Str	Endp
;128K
;128KNot_Install_Str	db	'Not Installed',0
;128KInstall_Str	db	'Installed',0
;128KNone_Str	db	'None',0
;128KMB_Str		db	'MB',0
;128KUser_Str	db	'User '
;128KType_Str	db	'Type ',0

;R272 start
;R354 ;=============================================================================
;R354 ;FUNC:	CPU_DISPLAY
;R354 ;
;R354 ;DESC:	Returns the length and description string for the CPU.
;R354 ;
;R354 ;IN:	NONE
;R354 ;OUT:	CS:SI	String pointer
;R354 ;
;R354 ;SAVES:	DX
;R354 ;=============================================================================
;R354 		PUBLIC	CPU_DISPLAY
;R354 CPU_DISPLAY	PROC	Near
;R354 
;R354 		mov	al,FIXED_DISK_STEP[bp]
;R354 		and	al,CPU_TYPE_MASK
;R354 
;R354 IF	BIOS_SUPPORT_486
;R354 		mov	si,offset TI_486dx4_str		;assume TI CPU !
;R354 		cmp	al,TYPE_CYRIX_DX4		;cyrix DX 4 ?
;R354 		jne	short Not_CyDx4
;R354 	;read DIR 0 value , it is Ti486DX4 if value is 81H
;R354 		push	ax
;R354 		mov	al,0FEh
;R354 		out	22h,al
;R354 		in	al,23h
;R354 		cmp	al,81h				;TI 486DX4 CPU ?
;R354 		pop	ax
;R354 		je	short Cpu_Str_Ok		;yes
;R354 Not_CyDx4:
;R354 endif	;BIOS_SUPPORT_486
;R354 
;R354 		cmp	al,NUM_OF_CPU_TYPE
;R354 		mov	si,offset Unknown_Str
;R354 		ja	short @F
;R354 		movzx	si,al
;R354 		mov	si,word ptr cs:CPU_TYPE_STRS[si]
;R354 	@@:
;R354 		cmp	al,TYPE_486DX2
;R354 		jne	short @F
;R354 		test	byte ptr FIXED_DISK_STEP[bp],COPROCESSOR
;R354 		jz	short @F
;R354 		mov	si,offset cpu_486dx2_str
;R354 	@@:
;R354 		cmp	al,TYPE_M7_2
;R354 		jne	short @F
;R354 
;R354 		mov	al,0FFh
;R354 		out	22h,al
;R354 		in	al,23h
;R354 		test	al,80h			;TI CPU ?
;R354 		jz	short @F		;No
;R354 		mov	si,offset TI_486dx2_str
;R354 	@@:
;R354 Cpu_Str_Ok:
;R354 
;R354 ;R291 - start
;R354 IF	BIOS_SUPPORT_486
;R354 ;display "P90" for 160Mhz and "P75" for 133Mhz AMD X5 CPUs
;R354 	    	cmp	si,offset Cpu_AmdDX5_Str	;AMD X5 ?
;R354 		jne	short Not_Amd_X5Cpu
;R354 
;R354 		cmp	byte ptr CPU_INT_CLOCK[bp],160	;160Mhz ?
;R354 		jne	short Not_Amd_X5Cpu
;R354 
;R354 		mov	si,offset Cpu_AmdDX5_160_Str	;show P90 for 160Mhz
;R354 		
;R354 Not_Amd_X5Cpu:
;R354 ;R292 - start
;R354 	    	cmp	si,offset Cpu_AMD486DX4Plus_Str	;Enhanced Am486DX4 ?
;R354 		jne	short Not_Amd_150_Cpu
;R354 
;R354 		cmp	byte ptr CPU_INT_CLOCK[bp],150	;150Mhz ?
;R354 		jne	short Not_Amd_150_Cpu
;R354 
;R354 		mov	si,offset Cpu_AmdDX5_150_Str	;show P75+ for 150Mhz
;R354 Not_Amd_150_Cpu:
;R354 ;R292 - end
;R354 endif;	BIOS_SUPPORT_486
;R354 ;R291 - end
;R354 
;R354 		ret
;R354 
;R354 CPU_TYPE_STRS:
;R354 		dw	offset cpu_386dx_str
;R354 		dw	offset cpu_386sx_str
;R354 		dw	offset cpu_386sl_str
;R354 		dw	offset cpu_486dx_str
;R354 		dw	offset cpu_486sx_str
;R354 		dw	offset cpu_486sx2_str
;R354 		dw	offset cpu_Cx486slc_str
;R354 		dw	offset cpu_Cx486dlc_str
;R354 		dw	offset cpu_ibm386slc_str
;R354 		dw	offset cpu_ibm486slc2_str
;R354 		dw	offset Cpu_P24t_str
;R354 		dw	offset Cpu_486s_Str
;R354 		dw	offset Cpu_486s2_Str
;R354 		dw	offset Cpu_586_Str
;R354 		dw	offset Cpu_486dxS_Str
;R354 		dw	offset Cpu_486sxS_Str
;R354 		dw	offset Cpu_486dx2S_Str
;R354 		dw	offset cpu_ibm486dlc3_str
;R354 		dw	offset Cpu_M7_Str
;R354 		dw	offset Cpu_M7_2_Str
;R354 		dw	offset Cpu_Cx486slc2_Str
;R354 		dw	offset Cpu_P24c_Str
;R354 		dw	offset Cpu_TI486SXL_Str
;R354 		dw	offset Cpu_TI486SXL2_Str
;R354 		dw	offset Cpu_U5_Str
;R354 		dw	offset Cpu_AMD486_Str
;R354 		dw	offset Cpu_P54c_Str
;R354 		dw	offset Cpu_TI486SXLC_Str
;R354 		dw	offset Cpu_TI486SXLC2_Str
;R354 		dw	offset Cpu_AMD486DX2_Str
;R354 		dw	offset Cpu_P24D_Str
;R354 		dw	offset Cpu_AMD486DX4_Str
;R354 		dw	offset Cpu_M1_Str
;R354 		dw	offset Cpu_AMD486Plus_Str
;R354 		dw	offset Cpu_AMD486DX4Plus_Str
;R354 		dw	offset Cpu_U486sx2_Str
;R354 		dw	offset Cpu_U486DX_Str
;R354 		dw	offset Cpu_U486DX2_Str
;R354 		dw	offset Cpu_M9_Str
;R354 		dw	offset Cpu_Cyrix_Dx4_Str
;R354 		dw	offset Cpu_P6_Str
;R354 		dw	offset Cpu_AmdDX5_Str
;R354 		dw	offset Cpu_AmdD5K86_Str
;R354 NUM_OF_CPU_TYPE	EQU	($ - offset CPU_TYPE_STRS)
;R354 
;R354 ;-------------------------- 386 CPU Strings --------------------------
;R354 
;R354 IF	BIOS_SUPPORT_386
;R354 
;R354 	cpu_386dx_str:		db	"80386DX",0
;R354  ifdef	M6117_CPU	       					;R339
;R354 	cpu_386sx_str:		db	"ALi-M6117",0		;R339
;R354  else	;M6117_CPU						;R339
;R354 	cpu_386sx_str:		db	"80386SX",0
;R354  endif	;M6117_CPU						;R339
;R354 	cpu_386sl_str:		db	"RapidCAD",0
;R354 	Cpu_Cx486slc2_Str:	db	"Cx486SLC2",0
;R354 	cpu_Cx486slc_str:	db	"Cx486SLC",0
;R354 	cpu_Cx486dlc_str:	db	"Cx486DLC",0
;R354 
;R354 ELSE	;BIOS_SUPPORT_386
;R354 
;R354 	cpu_386dx_str:
;R354 	cpu_386sx_str:
;R354 	cpu_386sl_str:
;R354 	Cpu_Cx486slc2_Str:
;R354 	cpu_Cx486slc_str:
;R354 	cpu_Cx486dlc_str:	db	0
;R354 
;R354 ENDIF	;BIOS_SUPPORT_386
;R354 
;R354 ;-------------------------- 486 CPU Strings --------------------------
;R354 
;R354 IF	BIOS_SUPPORT_486
;R354 
;R354 	;----- Intel 486 -----
;R354 
;R354 	cpu_486dx_str:		db	"80486DX",0
;R354 	cpu_486sx_str:		db	"80486SX",0
;R354 	cpu_487sx_str:		db	"80487SX",0
;R354 	cpu_486sx2_str:		db	"80486SX2",0
;R354 	cpu_486dx2_str:		db	"80486DX2",0
;R354 	Cpu_P24t_str:		db	"PENTIUM OverDrive",0	    	;R293
;R354 ;R293	Cpu_P24t_str:		db	"P24T",0
;R354 	Cpu_P24c_Str:		db	"DX4",0
;R354 	Cpu_P24D_Str:		db	"P24D",0
;R354 
;R354 	;----- TI 486 -----
;R354 
;R354 	TI_486dx2_str:		db	"TI486DX2",0
;R354 	TI_486dx4_str:		db	"TI486DX4",0
;R354 
;R354 	;----- Cyrix 486 -----
;R354 
;R354 	ifndef	No_Brand_For_CYRIXCPU
;R354 
;R354 		Cpu_Cyrix_Dx4_Str:	db	"CxDX4",0
;R354 		Cpu_486s_Str:		db	"Cx486S",0
;R354 		Cpu_486s2_Str:		db	"Cx486S2",0
;R354 		Cpu_M7_Str:		db	"Cx486DX",0
;R354 		Cpu_M7_2_Str:		db	"Cx486DX2",0
;R354 
;R354 	else	;No_Brand_For_CYRIXCPU
;R354 
;R354 		Cpu_Cyrix_Dx4_Str:	db	"DX4",0
;R354 		Cpu_486s_Str:		db	"486S",0
;R354 		Cpu_486s2_Str:		db	"486S2",0
;R354 		Cpu_M7_Str:		db	"486DX",0
;R354 		Cpu_M7_2_Str:		db	"486DX2",0
;R354 
;R354 	endif	;No_Brand_For_CYRIXCPU
;R354 
;R354 		Cpu_M9_Str:		db	"Cx5x86",0
;R354 
;R354 	;----- UMC 486 -----
;R354 
;R354 	ifndef	No_Brand_For_UMCCPU
;R354 
;R354 		Cpu_U5_Str:		db	"U486SX",0
;R354 		Cpu_U486sx2_Str:	db	"U486SX2",0
;R354 		Cpu_U486DX_Str:		db	"U486DX",0
;R354 		Cpu_U486DX2_Str:	db	"U486DX2",0
;R354 
;R354 	else	;No_Brand_For_UMCCPU
;R354 
;R354 		Cpu_U5_Str:		db	"486SX",0
;R354 		Cpu_U486sx2_Str:	db	"486SX2",0
;R354 		Cpu_U486DX_Str:		db	"486DX",0
;R354 		Cpu_U486DX2_Str:	db	"486DX2",0
;R354 
;R354 	endif	;No_Brand_For_UMCCPU
;R354 
;R354 	;----- AMD 486 -----
;R354 
;R354 	ifndef	No_Brand_For_AMDCPU
;R354 
;R354 		Cpu_AMD486_Str:		db	"Am486DX",0
;R354 		Cpu_AMD486DX2_Str:	db	"Am486DX2",0
;R354 		Cpu_AMD486DX4_Str:	db	"Am486DX4",0
;R354 		Cpu_AMD486Plus_Str:	db	"Enhanced Am486DX2",0
;R354 		Cpu_AMD486DX4Plus_Str:	db	"Enhanced Am486DX4",0
;R354 		Cpu_AmdDX5_Str:		db	"Am5x86-P75",0
;R354 		Cpu_AmdDX5_160_Str:  	db	"Am5x86-P90",0	;R291
;R354 		Cpu_AmdDX5_150_Str:  	db	"Am5x86-P75+",0	;R292
;R354 
;R354 	else	;No_Brand_For_AMDCPU
;R354 
;R354 		Cpu_AMD486_Str:		db	"486DX",0
;R354 		Cpu_AMD486DX2_Str:
;R354 		Cpu_AMD486Plus_Str:	db	"486DX2",0
;R354 		Cpu_AMD486DX4_Str:
;R354 		Cpu_AMD486DX4Plus_Str:	db	"486DX4",0
;R354 		Cpu_AmdDX5_Str:		db	"Am5x86-P75",0
;R354 		Cpu_AmdDX5_160_Str:  	db	"Am5x86-P90",0	;R291
;R354 		Cpu_AmdDX5_150_Str:  	db	"Am5x86-P75+",0	;R292
;R354 
;R354 	endif	;No_Brand_For_AMDCPU
;R354 
;R354 ELSE	;BIOS_SUPPORT_486
;R354 
;R354 	Cpu_AmdDX5_Str:
;R354 	cpu_486dx_str:
;R354 	cpu_486sx_str:
;R354 	cpu_487sx_str:
;R354 	cpu_486sx2_str:
;R354 	cpu_486dx2_str:
;R354 	Cpu_P24t_str:
;R354 	Cpu_P24c_Str:
;R354 	Cpu_P24D_Str:
;R354 	Cpu_AMD486Plus_Str:
;R354 	Cpu_AMD486DX4Plus_Str:
;R354 	Cpu_U486sx2_Str:
;R354 	Cpu_U486DX_Str:
;R354 	Cpu_U486DX2_Str:
;R354 	Cpu_M9_Str:
;R354 	TI_486dx2_str:
;R354 	Cpu_Cyrix_Dx4_Str:
;R354 	Cpu_486s_Str:
;R354 	Cpu_486s2_Str:
;R354 	Cpu_M7_Str:
;R354 	Cpu_M7_2_Str:
;R354 	Cpu_AMD486_Str:
;R354 	Cpu_U5_Str:
;R354 	Cpu_AMD486DX2_Str:
;R354 	Cpu_AMD486DX4_Str:	db	0
;R354 
;R354 ENDIF	;BIOS_SUPPORT_486
;R354 
;R354 ;-------------------------- 586 CPU Strings --------------------------
;R354 
;R354 IF	BIOS_SUPPORT_586
;R354 
;R354 	Cpu_586_Str:		db	"PENTIUM",0
;R354 	Cpu_P54c_Str:	      
;R354 
;R354 	Cpu_M1_Str:		db	"6x86",0
;R354 	Cpu_AmdD5K86_Str:	db	"AMD-K5",0		;R283;R312
;R354 
;R354 ELSE	;BIOS_SUPPORT_586
;R354 
;R354 	Cpu_AmdD5K86_Str:
;R354 	Cpu_586_Str:
;R354 	Cpu_P54c_Str:
;R354 	Cpu_M1_Str:
;R354 
;R354 ENDIF	;BIOS_SUPPORT_586
;R354 
;R354 
;R354 ;-------------------------- 686 CPU Strings --------------------------
;R354 
;R354 IF	BIOS_SUPPORT_686
;R354 
;R354 ifdef	KLAMATH_CPU_ONLY				;R338
;R354 	Cpu_P6_Str:		db	"KLAMATH",0	;R338
;R354 else;	KLAMATH_CPU_ONLY				;R338
;R354 	Cpu_P6_Str:		db	"PENTIUM PRO",0
;R354 endif;	KLAMATH_CPU_ONLY				;R338
;R354 
;R354 ELSE	;BIOS_SUPPORT_686
;R354 
;R354 	Cpu_P6_Str:		db	0
;R354 
;R354 ENDIF	;BIOS_SUPPORT_686
;R354 
;R354 ;-------------------------- IBM CPU Strings --------------------------
;R354 
;R354 IF	BIOS_SUPPORT_IBM_CPU
;R354 
;R354 	cpu_ibm386slc_str:	db	"IBM386SLC",0
;R354 	cpu_ibm486slc2_str:	db	"IBM486SLC2",0
;R354 	cpu_ibm486dlc3_str:	db	"IBM486DLC3",0
;R354 
;R354 ELSE	;BIOS_SUPPORT_IBM_CPU
;R354 
;R354 	cpu_ibm386slc_str:
;R354 	cpu_ibm486slc2_str:
;R354 	cpu_ibm486dlc3_str:	db	0
;R354 
;R354 ENDIF	;BIOS_SUPPORT_IBM_CPU
;R354 
;R354 ;-------------------------- TI CPU Strings --------------------------
;R354 
;R354 IF	BIOS_SUPPORT_TI_CPU
;R354 
;R354 	Cpu_TI486SXL_Str:	db	"TI486SXL",0
;R354 	Cpu_TI486SXL2_Str:	db	"TI486SXL2",0
;R354 	Cpu_TI486SXLC_Str:	db	"TI486SXLC",0
;R354 	Cpu_TI486SXLC2_Str:	db	"TI486SXLC2",0
;R354 
;R354 ELSE	;BIOS_SUPPORT_TI_CPU
;R354 
;R354 	Cpu_TI486SXL_Str:
;R354 	Cpu_TI486SXL2_Str:
;R354 	Cpu_TI486SXLC_Str:
;R354 	Cpu_TI486SXLC2_Str:	db	0
;R354 
;R354 ENDIF	;BIOS_SUPPORT_TI_CPU
;R354 
;R354 ;---------------------- Dummy/Unknown CPU Strings -------------------
;R354 
;R354 	unknown_str:		db	"Unknown"
;R354 	Cpu_486dxS_Str:
;R354 	Cpu_486sxS_Str:
;R354 	Cpu_486dx2S_Str:
;R354 				db	0
;R354 
;R354 CPU_DISPLAY	ENDP
;R272 end

		public	WAIT_REFRESH1
WAIT_REFRESH1	PROC	NEAR

		push	ds			;128k
		push	0f000h			;128k
		pop	ds			;128k
;R187		test	byte ptr [A20_Byte],20h ;128k
		assume	ds:DGROUP			;R187
		test	byte ptr DGROUP:A20_Byte,20h	;R187
		assume	ds:NOTHING			;R187
		pop	ds			;128k
;128k		test	cs:byte ptr A20_Byte,20h;using CPU loop wait
		jz	short @F
		F000_call	Wr_Cpu		; use CPU loop
		jmp	short NoShadow
@@:
;R236		F000_call	Wait_Refresh
		call	F000_Wait_Refresh		;R236
NoShadow:
		ret
WAIT_REFRESH1	ENDP

;[]==============================================================[]
; ExtCache_Status:
; IntCache_Status:
;	This routine is used to read CMOS value of cache on/off
;
;Entry: None
;Exit : zero	 - cache to be off
;	non-zero - cache to be on
;[]==============================================================[]
		public	ExtCache_Status			;R284
ExtCache_Status label	near
		mov	si,offset ExtCache_Item
		jmp	short Read_Cmos_Cache

		public	IntCache_Status			;R284
IntCache_Status proc	near
		mov	si,offset IntCache_Item
Read_Cmos_Cache:
		call	F000_GetItem_Value
		or	al,al
		ret
IntCache_Status endp

;[]==============================================================[]
;
; TRY_SHADOW:
;	Shadowing system (F0000H) and video (C0000H or E0000H) BIOS
;
;Saves: all , but DS & ES
;
;Entry: NONE
;
;Exit:	NONE
;
;[NOTE]
;
;[]==============================================================[]

;R21 - start
ifndef	No_C8_DF_Shadow_Item			;R407
		Public	Shadow_Adaptor		;R35
Shadow_Adaptor:
		dw	offset DGROUP:C800_Item
		dw	offset DGROUP:C800_Shadow
		dw	offset DGROUP:CC00_Item
		dw	offset DGROUP:CC00_Shadow
		dw	offset DGROUP:D000_Item
		dw	offset DGROUP:D000_Shadow
		dw	offset DGROUP:D400_Item
		dw	offset DGROUP:D400_Shadow
		dw	offset DGROUP:D800_Item
		dw	offset DGROUP:D800_Shadow
		dw	offset DGROUP:DC00_Item
		dw	offset DGROUP:DC00_Shadow
;R001		dw	offset DGROUP:E000_Item
;R001		dw	offset DGROUP:E000_Shadow
;R001		dw	offset DGROUP:E400_Item
;R001		dw	offset DGROUP:E400_Shadow
;R001		dw	offset DGROUP:E800_Item
;R001		dw	offset DGROUP:E800_Shadow
;R001		dw	offset DGROUP:EC00_Item
;R001		dw	offset DGROUP:EC00_Shadow
Adaptor_End:
endif	;No_C8_DF_Shadow_Item				;R407

;R21 - end

		public	TEMP_MEM
;R198 TEMP_MEM	equ	1000h		;temporary memory to store shadow data
;R337 TEMP_MEM	equ	2000h	;R198	;temporary memory to store shadow data
TEMP_MEM	equ	3000h	;R198	;temporary memory 		;R337
;Note : use 2000H as temporary buffer cause P6/MP SMI failed in NT	;R337

		PUBLIC	TRY_SHADOW
TRY_SHADOW	PROC	NEAR

		pusha
		push	ds
		push	es

		lea	si,Shadow_Dr
;R236		F000_call	Do_F000_Shadow
		call	F000_Do_F000_Shadow		;R236

		F000_call	Ct_Shadow_Alone_Check
		jnz	All_Shdow_Exit			;shodow is independent?
;2. Check video BIOS shadow
;Move codes from ROM to temporary area

ifndef	NO_VIDEO_BIOS_SHADOW_ITEM				;R429
		mov	si,offset DGROUP:C000_Item
		call	F000_GetItem_Value

		or	al,al
		jz	Off_2

ifdef	DOUBLE_BYTE_LANGUAGE					;R436
		cmp	word ptr INT10_SEGMENT[bp],0C000h	;R436
		jne	Shadow_2				;R436
		jmp	Shadow_C				;R436
endif	;DOUBLE_BYTE_LANGUAGE					;R436

		xor	ax,ax
		mov	ds,ax
		cmp	byte ptr ds:[43h],0c0h		;C000 video ROM
;Skip this code, it will set itself into write state
ifdef RPB_ENABLED					;M02
		jne	short Shadow_2			;M02
else  ;RPB_ENABLED					;M02
		je	short Shadow_C
		cmp	byte ptr ds:[43h],0e0h	;R236 video ROM
		jne	Shadow_2			;monochrome dispaly

;		mov	ax,G_RAM
;		mov	ds,ax
;		assume	ds:G_RAM
;		cmp	byte ptr [INT10+3],0c0h ;C000 video ROM
;		je	short Shadow_C
;		cmp	byte ptr [INT10+3],0e0h ;R236 video ROM
;		jne	short Shadow_2			;monochrome dispaly

		mov	si,0e000h		;source area
		mov	ds,si			;R03
		mov	al,ds:[2]		;R03 get ROM size by 512 byte
		shr	al,1			;R03 size by 1k unit
		push	ax			;R03 save ROM size
		mov	di,TEMP_MEM		;destination area
;R03		mov	cx,4000h		;32k
		mov	cx,8000h		;64k		;R03
		call	E000_Move_Codes		;R335
;R335		F000_call	Move_Codes

		F000_call	E000_Shadow_W		;enable C000 shadow writeable
		mov	si,TEMP_MEM		;source area
		mov	di,0e000h		;destination area
;R03		mov	cx,4000h		;32k
		mov	cx,8000h		;64k		;R03
		call	E000_Move_Codes		;R335
;R335		F000_call	Move_Codes
		pop	ax			;R03 restore ROM size
		F000_call	E000_Shadow_R		;enable C000 shadow readonly
		jmp	short Shadow_2
endif ; RPB_ENABLED				;M02

Shadow_C:
		mov	si,0c000h		;source area

		mov	ds,si			;R03
		mov	al,ds:[2]		;R03 get ROM size by 512 byte
		shr	al,1			;R03 size by 1k unit
		push	ax			;R03 save ROM size

		mov	di,TEMP_MEM		;destination area
;R03		mov	cx,4000h		;32k
;R03A		mov	cx,8000h		;64k		;R03
		mov	cx,4000h				;R03A
		push	cx					;R03A
		call	E000_Move_Codes		;R335
;R335		F000_call	Move_Codes

;R287		F000_call	C000_Shadow_W		;enable C000 shadow writeable
		F000_call	C000_Shadow_RW		;enable C000 shadow writeable	;R287
		mov	si,TEMP_MEM		;source area
		mov	di,0c000h		;destination area
;R03		mov	cx,4000h		;32k
;R03A		mov	cx,8000h		;64k		;R03
		pop	cx					;R03A
		call	E000_Move_Codes		;R335
;R335		F000_call	Move_Codes
		pop	ax			;R03 restore ROM size
		F000_call	C000_Shadow_R		;enable C000 shadow readonly

		jmp	short Shadow_2
Off_2:
Shadow_2:
endif;	NO_VIDEO_BIOS_SHADOW_ITEM				;R429

;Clear temporary memory
All_Shdow_Exit:
		mov	ax,TEMP_MEM
		mov	es,ax
		xor	di,di
		xor	ax,ax
		mov	cx,8000h
		rep	stosw
		F000_call	Clear_Parity

		pop	es
		pop	ds
		popa
		clc
		ret
Try_Shadow	endp

;[]==============================================================[]
; Try_Actual_Cache:
;	This routine is used to turn cache on or off
;
;Entry: None
;Exit : None
;	None
;[]==============================================================[]
		public	Try_Actual_Cache
Try_Actual_Cache	proc	near
		pushad

		call	ExtCache_Status
		mov	al,TRUE 		;assume on
		jnz	short @F
		mov	al,FALSE
@@:
		cli				;R108

ifdef	P6_BIOS_ONLY				;R348
		call	P6_L2Cache_Control	;R348
endif;	P6_BIOS_ONLY				;R348

		F000_call	Ct_Cache

		call	IntCache_Status
		mov	al,TRUE 		;assume on
		jnz	short @F
		mov	al,FALSE
@@:
;R260		F000_call	Cpu_Cache
		call	F000_Cpu_Cache		;R260
;R274 start
		call	IntCache_Status
		jz	short @F
		push	ds
		push	g_ram
		pop	ds
		or	byte ptr ds:[SYSTEM_FLAG],Int_Cache_Status
		pop	ds
@@:
;R274 end

		popad
		ret
Try_Actual_Cache	endp

;R348 - start
;R354 ifdef	P6_BIOS_ONLY				
;R354 ;Function : Enable/Disable P6 L2 cache
;R354 ;Input    : AL = TRUE  - enable L2 cache
;R354 ;	       = FALSE - disable L2 cache
;R354 P6_L2Cache_Control	proc	near
;R354 		pushad
;R354 
;R354 ifdef	KLAMATH_CPU_ONLY
;R354 ;L2 cache control for KLAMATH CPU
;R354 		mov	bl,al
;R354 		mov	ecx,11eh
;R354 		RDMSR
;R354 		or	eax,(1 SHL 8)		;assume L2 enable
;R354 		cmp	bl,TRUE
;R354 		je	short Yes_Enable
;R354 		and	eax,NOT (1 SHL 8)	;disable L2 cache
;R354 Yes_Enable:
;R354 		WRMSR		
;R354 else;	KLAMATH_CPU_ONLY
;R354 ;L2 cache control for PENTIUM PRO CPU
;R354 		mov	bl,al
;R354 		mov	ecx,119h
;R354 		RDMSR
;R354 		and	eax,NOT (1 SHL 19)	;assume L2 enable
;R354 		cmp	bl,TRUE
;R354 		je	short Yes_Enable
;R354 		or	eax,(1 SHL 19)		;disable L2 cache
;R354 Yes_Enable:
;R354 		WRMSR		
;R354 endif;	KLAMATH_CPU_ONLY
;R354 
;R354 		popad
;R354 		ret
;R354 P6_L2Cache_Control	endp
;R354 endif;	P6_BIOS_ONLY				
;R348 - end

;R02 - start
;[]==============================================================[]
;
; TRY_OTHER_SHADOW:
;	Shadowing adaptor ROM (C8000H - EFFFFH) BIOS
;
;Saves: all
;
;Entry: NONE
;
;Exit:	NONE
;
;[NOTE]
;
;[]==============================================================[]
		public	TRY_OTHER_SHADOW

TRY_OTHER_SHADOW	proc	near
		pusha
		push	ds
		push	es

		F000_call	Ct_Shadow_Alone_Check
		jnz	short Other_Shadow_Exit ;shodow is independent?

;3. Check C8000-EFFFF adaptor ROM shadow

		call	Get_OptionROM_Map	;R21;DX contain ROM map
		shr	dx,2			;R21:start from C800h
ifdef	USB_SUPPORT				;R380
		mov	edi, 0Fh		;R380;mask value 16KB
endif	;USB_SUPPORT				;R380

ifndef	No_C8_DF_Shadow_Item		;R407
		mov	bx,offset EGROUP:Shadow_Adaptor
endif	;No_C8_DF_Shadow_Item		;R407
Next_Seg:
		shr	dx,1			;R21;ROM exist?
		jnc	short @f		;R21;no, check next 16KB
ifdef	USB_SUPPORT				;R380
		test	LMEM_RESERVED[bp], edi	;R380;reserved by others?
		jnz	short @f		;R380
endif	;USB_SUPPORT				;R380
ifndef	No_C8_DF_Shadow_Item		;R407
		mov	si,cs:[bx]		;load item table offset
		call	F000_GetItem_Value
		or	al,al
else	;No_C8_DF_Shadow_Item		;R407
		xor	al, al		;R407
endif	;No_C8_DF_Shadow_Item		;R407
		jz	short @F

ifndef	No_C8_DF_Shadow_Item		;R407
		mov	ax,cs:[bx+2]
		push	edi			;R380
		push	dx			;R21
		push	bx
		F000_call	ax
		pop	bx
		pop	dx			;R21
		pop	edi			;R380
endif	;No_C8_DF_Shadow_Item		;R407
@@:
ifdef	USB_SUPPORT				;R380
		shl	edi, 4			;R380;next 16KB
endif	;USB_SUPPORT				;R380
ifndef	No_C8_DF_Shadow_Item		;R407
		add	bx,4
		cmp	bx,offset EGROUP:Adaptor_End
		jne	short Next_Seg
endif	;No_C8_DF_Shadow_Item		;R407

Other_Shadow_Exit:
		jmp	All_Shdow_Exit
TRY_OTHER_SHADOW	endp

;[]==============================================================[]
;
; Get_OptionROM_Map:
;	Scanning C0000h to EFFFFh Option ROM
;
;Entry: none
;
;Exit:	dx = option ROM map
;	   bit = 1 : ROM exist
;	   bit = 0 : empty
;		bit 0 : C0000h (16kb)
;		bit 1 : C4000h (16kb)
;		......
;		bit 11 : EC000h (16kb)
;
;[NOTE] **** All registers be destroyed ****
;
;[]==============================================================[]

		public	Get_OptionROM_Map

Get_OptionROM_Map	proc	near
		push	ds
		mov	bx,0C000h		;start segment to scan
		xor	dx,dx			;DX for saving ROM map
Scan_ROM_Loop:
		mov	di,0080h
		mov	ds,bx
		cmp	word ptr ds:[0],0AA55h ;ISA option ROM header
		jne	short Scan_Next_ROM

		mov	al,byte ptr ds:[2]	;unit of ROM size is 512Byte
		test	al,00000011b		;check 2KB boundary ?
		jz	short @f		;yes, in 2KB boundary
		add	al,00000100b		;no, add 2KB size
@@:
		shr	al,2			;convert ROM size to 2KB unit
		xor	ah,ah
		mov	cx,bx			;convert segment to 2KB boundry
		and	cx,03FFh
		shr	cx,7
		add	ax,cx			;length from 2KB boundry
						;  with 2KB unit
		mov	di,ax			;DI for calculate next segment
		shl	di,7
		test	ax,00000111b		;check 16KB boundry ?
		jz	short @f		;yes, in 16KB boundry
		add	ax,00001000b		;no, add 16KB
@@:
		shr	ax,3			;convert to 16KB unit
		mov	cx,bx			;calculate bit position for
						;  segment
		and	cx,3C00h
		shr	cx,10
@@:
		inc	cx
		mov	si,8000h
		rol	si,cl
		or	dx,si
		dec	ax			;ROM size end ?
		jnz	short @b		;No, continue to set flag
		and	bx,0FC00h
Scan_Next_ROM:
		add	bx,di
;R433		cmp	bx,0F000h
;R433 start
if RELEASE_E000_FOR_PCI	eq 1
		cmp	bx,0E800h
else ;RELEASE_E000_FOR_PCI	eq 1
		cmp	bx,0E000h
endif ;RELEASE_E000_FOR_PCI	eq 1
;R433 end
		jb	short Scan_ROM_Loop
		pop	ds
		ret
Get_OptionROM_Map	endp

;R214 start
		Public	F000_GetItem_Value		;R236
		Public	F000_Display_Char
		Public	F000_Get_Cmos
		Public	F000_Set_Cmos
		Public	F000_Cursor_Set
		Public	F000_Vcrlf
		Public	F000_Buffer_8042_Full
		Public	F000_Out_8042_Full
		Public	F000_Out_8042
		Public	F000_Display_String		;R236
		Public	F000_Vreverse			;R236
		Public	F000_VNormal			;R236
		Public	F000_Cursor_On			;R236
		Public	F000_Wait_Refresh		;R236
		Public	F000_Do_F000_Shadow		;R236
;R260 - start
		public	F000_Cpu_Cache
F000_Cpu_Cache:
		F000_call	Cpu_Cache
		ret
;R260 - end

F000_GetItem_Value:
		F000_call	GetItem_Value
		ret
F000_Display_Char:
		F000_call	Display_Char
		ret
F000_Get_Cmos:
		F000_call	Get_Cmos
		ret
F000_Set_Cmos:
		F000_call	Set_Cmos
		ret
F000_Cursor_Set:
		F000_call	Cursor_Set
		ret
F000_Vcrlf:
		F000_call	Vcrlf
		ret
F000_Buffer_8042_Full:
		F000_call	Buffer_8042_Full
		ret
F000_Out_8042_Full:
		F000_call	Out_8042_Full
		ret
F000_Out_8042:
		F000_call	Out_8042
		ret
;R236 - start
F000_Display_String:
		F000_call	Display_String
		ret
F000_Vreverse:
		F000_call	Vreverse
		ret
F000_VNormal:
		F000_call	VNormal
		ret
F000_Cursor_On:
		F000_call	Cursor_On
		ret
F000_Wait_Refresh:
		F000_call	Wait_Refresh
		ret
F000_Do_F000_Shadow:
		F000_call	Do_F000_Shadow
		ret
;R236 - end
;R214 end
;R272 start
		public	Display_CS_String
Display_CS_String:
		push	ds
		push	cs
		pop	ds
		call	F000_Display_String		;R335
;R335		F000_call	Display_String
		pop	ds
		ret
;R272 end

;R252 - start
;Input : none
;Output: zero set - No PS2 mouse support
;	 non-zero - PS2 mouse supported
		public	Check_PS2_Mouse_Support
Check_PS2_Mouse_Support	proc	near
		push	ds
		push	si

		push	0f000h				;point to F-segment
		pop	ds

		lea	si,SYSTEM4_BYTE			;config. byte
		test	byte ptr ds:[si],PS2_MOUSE	;PS2 mosue support

		pop	si
		pop	ds
		ret
Check_PS2_Mouse_Support	endp
;R252 - end

		public	Disp_Str_In_POST
Disp_Str_In_POST	LABEL NEAR
		push	dx
		call	Display_CS_String
		pop	dx
		ret
;R272 end

		public	Disp_Str_In_BIOS
Disp_Str_In_BIOS	LABEL NEAR

;128k		push	ds
;128k		push	cs
;128k		pop	ds
		push	dx				;R211
;R236		F000_call	Display_String
		call	F000_Display_String		;R236
		pop	dx				;R211
;128k		pop	ds
		ret

;R54 Starts
;R354 		public	Disp_Intel_S_CPU
;R354 Disp_Intel_S_CPU:
;R354 
;R354 ifndef	P6_BIOS_ONLY				;R335
;R354 ;R327 - start
;R354 ;Display CPU type "6x86L" if the revision number is 20h-2fh, regular
;R354 ;6x86 is 00h-1fh
;R354 		call	Check_M1_Cpu 		;check if 6x86 CPU
;R354 		jne	short Not_6x86Cpu
;R354 
;R354 		mov	al,0ffH			;DIR1 register
;R354 		out	22h,al
;R354 		in	al,23h			;read DIR1 value
;R354 
;R354 		cmp	al,20H			;6x86L ?
;R354 		jb	short Not_6x86Cpu
;R354 
;R354 		mov	al,"L"
;R354 		call	F000_Display_Char
;R354 
;R354 Not_6x86Cpu:
;R354 endif;	P6_BIOS_ONLY				;R335
;R354 
;R354 ;R327 - end
;R354 		test	byte ptr OVERRIDE[BP],(SMICPU shr 8)
;R354 		jz	short @F
;R354 
;R354 ;R323 - start
;R354 ifdef	P6_BIOS_ONLY				
;R354 
;R354 		call	Read_CpuID		;read CPU ID
;R354 		and	ah,0f0H			;get CPU type
;R354 		cmp	ah,010H			;override drive processor
;R354 		jne	short Not_Odp
;R354 
;R354 		push	cs
;R354 		pop	ds		
;R354 		mov	si,offset Odp_String	;ODP string
;R354 		call	F000_Display_String		
;R354 
;R354 Not_Odp:
;R354 
;R354 		shr	edx,16
;R354 		test	dl,80H			;With MMX ? (bit23 = 1 ?)
;R354 		jz	short Normal_PentiumPro	;no MMX
;R354  
;R354 		push	cs
;R354 		pop	ds		
;R354 		mov	si,offset MMX_String	;MMX string
;R354 		call	F000_Display_String		
;R354 
;R354 		jmp	short @F		;skip "-S" display
;R354 Normal_PentiumPro:
;R354 
;R354 ifdef PM_SUPPORT					
;R354 		mov	al,"-"
;R354 		call	F000_Display_Char
;R354 		mov	al,"S"
;R354 		call	F000_Display_Char
;R354 endif; PM_SUPPORT					
;R354 else;	P6_BIOS_ONLY					
;R354 ;R323 - end
;R354 
;R354 ;R113 - Begin
;R354 ifdef	No_Cyrix_Mark_For_M6M7
;R354 ;
;R354 ; This is for special customer
;R354 ; If the CPU is Cyrix then don't show S-serial
;R354 ;
;R354 		F000_Call Cyrix_Detect
;R354 		jnc	short @F
;R354 endif	;No_Cyrix_Mark_For_M6M7
;R354 ;R113 - End
;R354 
;R354 ;R280 - start
;R354 ifndef	NO_PRATING_DISPLAY		 			;R280A
;R354 ;Display P-rating if CYRIX 6x86 CPU plugged
;R354 		call	Check_M1_Cpu 		;check if 6x86 CPU
;R354 		jne	short Not_6x86
;R354 
;R354 		mov	si,offset M1_PRat_Tbl	;table of P-rating
;R354 		call	Show_PRating
;R354 
;R354 		jmp	short @F
;R354 Not_6x86:
;R354 
;R354 ;R282 - start
;R354 		call	Check_K586_Cpu 	;check if AMD 5k86 CPU
;R354 		jne	short Not_K586
;R354 
;R354 ;R312 - start
;R354 ;R319		mov	eax,1			;read cache isze
;R354 ;R319		db	0Fh,0A2h		;OP code: CPUID
;R354 		call	Read_CpuID		;R319
;R354 		mov	si,offset K586_051x_PRat_Tbl	;table of P-rating
;R354 		and	al,0f0H
;R354 		cmp	al,10H			;CPUID=051X
;R354 		je	short K5_051x
;R354 ;R312 - end
;R354 
;R354 		mov	si,offset K586_PRat_Tbl	;table of P-rating
;R354 K5_051x:					;R312
;R354 		call	Show_PRating
;R354 
;R354 		jmp	short @F
;R354 Not_K586:
;R354 ;R282 - end
;R354 endif;	NO_PRATING_DISPLAY		 			;R280A
;R354 ;R280 - end
;R354 
;R354 ifndef	P6_BIOS_ONLY				;R335
;R354 ;R319 - start
;R354 ;Display string "MMX" if CPU with MMX supported, for PENTIUM CPUs
;R354 ;bit 23 of EDX indicate MMX support or not.
;R354 
;R354 		mov	al,byte ptr FIXED_DISK_STEP[bp]
;R354 		and	al,CPU_TYPE_MASK
;R354 		cmp	al,TYPE_586  		;PENTIUM CPU ?
;R354 		jne	short Normal_Pentium	;no , no MMX display
;R354 
;R354 		call	Read_CpuID		;read CPU ID
;R354 
;R354 ;R322 - start
;R354 		and	ah,0f0H			;get CPU type
;R354 		cmp	ah,010H			;override drive processor
;R354 		jne	short Not_Odp
;R354 
;R354 		push	cs
;R354 		pop	ds		
;R354 		mov	si,offset Odp_String
;R354 		call	F000_Display_String		
;R354 
;R354 Not_Odp:
;R354 ;R322 - end
;R354 
;R354 		shr	edx,16
;R354 		test	dl,80H			;With MMX ? (bit23 = 1 ?)
;R354 		jz	short Normal_Pentium	;no MMX
;R354  
;R354 		push	cs
;R354 		pop	ds		
;R354 		mov	si,offset MMX_String
;R354 		call	F000_Display_String		
;R354 
;R354 		jmp	short @F
;R354 Normal_Pentium:
;R354 ;R319 - end
;R354 endif;	P6_BIOS_ONLY				;R335
;R354 
;R354 ifdef PM_SUPPORT						;R116
;R354 		mov	al,"-"
;R354 		call	F000_Display_Char
;R354 		mov	al,"S"
;R354 		call	F000_Display_Char
;R354 endif; PM_SUPPORT						;R116
;R354 
;R354 endif;	P6_BIOS_ONLY					;R323
;R354 
;R354 	@@:
;R354 		ret
;R354 ;R54 Ends
;R354 
;R354 ;R319 - start
;R354 ;Function : Read CPU ID
;R354 ;Input    : none
;R354 ;Output   : EAX - CPU ID information
;R354 ;	    EDX - CPU features
;R354 Read_CpuID	proc	near
;R354 		mov	eax,1			;read cache isze
;R354 		db	0Fh,0A2h		;OP code: CPUID
;R354 		ret
;R354 Read_CpuID	endp
;R354 
;R354 Odp_String	db	' ODP',0			;R322
;R354 MMX_String	db	'-MMX',0
;R354 ;R319 - end
;R354 		public	Check_M1_Cpu				;R305
;R354 Check_M1_Cpu	proc	near
;R354 		push	bx
;R354 		mov	bh,byte ptr FIXED_DISK_STEP[bp]
;R354 		and	bh,CPU_TYPE_MASK
;R354 		cmp	bh,TYPE_M1
;R354 		pop	bx
;R354 		ret
;R354 Check_M1_Cpu	endp
;R354 
;R354 ;R282 - start
;R354 Check_K586_Cpu	proc	near
;R354 		push	bx
;R354 		mov	bh,byte ptr FIXED_DISK_STEP[bp]
;R354 		and	bh,CPU_TYPE_MASK
;R354 		cmp	bh,TYPE_AMD5K86
;R354 		pop	bx
;R354 		ret
;R354 Check_K586_Cpu	endp
;R354 ;R282 - end
;R354 
;R354 ;R280 - start
;R354 ifndef	NO_PRATING_DISPLAY		 			;R280A
;R354 ;P-rating table of cyrix 6x86 CPU
;R354 M1_PRat_Tbl:		;Mhz
;R354 		db	80			;80Mhz
;R354 		db	'90+ ',0		;P-rating
;R354 PRAT_TBL_LEN	EQU	($ - offset M1_PRat_Tbl)
;R354 
;R354 		db	66			;66Mhz	 	;R326
;R354 		db	'90+ ',0		;P-rating	;R326
;R354 
;R354 		db	60			;66Mhz	 	;R326
;R354 		db	'90+ ',0		;P-rating	;R326
;R354 
;R354 		db	100			;100Mhz
;R354 		db	'120+',0		;P-rating
;R354 
;R354 		db	110			;110Mhz
;R354 		db	'133+',0		;P-rating
;R354 
;R354 		db	120			;120Mhz
;R354 		db	'150+',0		;P-rating
;R354 
;R354 		db	133			;133Mhz
;R354 		db	'166+',0		;P-rating
;R354 
;R354 		db	150			;150Mhz		;R284
;R354 		db	'200+',0		;P-rating	;R284
;R354 
;R354 		db	0			;end of table
;R354 
;R354 
;R354 ;R282 - start
;R354 ;P-rating table of cyrix K5 CPU for 050XH
;R354 K586_PRat_Tbl:		;Mhz
;R354 		db	66			;66Mhz
;R354 		db	'75  ',0		;P-rating
;R354 
;R354 		db	75			;75Mhz
;R354 		db	'75  ',0		;P-rating
;R354 
;R354 		db	83			;83Mhz
;R354 		db	'90  ',0		;P-rating
;R354 
;R354 		db	90			;90Mhz
;R354 		db	'90  ',0		;P-rating
;R354 
;R354 		db	100			;100Mhz
;R354 		db	'100 ',0		;P-rating
;R354 
;R354 ;R312A - start
;R354 		db	120			;120Mhz
;R354 		db	'120 ',0		;P-rating
;R354 
;R354 		db	133			;133Mhz
;R354 		db	'133 ',0		;P-rating
;R354 ;R312A - end
;R354 
;R354 		db	0			;end of table
;R354 ;R282 - end
;R354 
;R354 ;R312 - start
;R354 ;P-rating table of cyrix K5 CPU for 051XH
;R354 K586_051X_PRat_Tbl:		;Mhz
;R354 		db	75			;75Mhz
;R354 		db	'100 ',0		;P-rating
;R354 
;R354 		db	83			;83Mhz
;R354 		db	'100 ',0		;P-rating
;R354 
;R354 		db	90			;90Mhz
;R354 		db	'120 ',0		;P-rating
;R354 
;R354 		db	100			;100Mhz
;R354 		db	'133 ',0		;P-rating
;R354 
;R354 		db	120			;120Mhz
;R354 		db	'150 ',0		;P-rating
;R354 
;R354 		db	133			;133Mhz
;R354 		db	'166 ',0		;P-rating
;R354 
;R354 		db	0			;end of table
;R354 ;R312 - end
;R354 
;R354 ;Input : SI - offset of Prating table to display
;R354 ;Output: none
;R354 ;Function: Display P-rating behind of CPU type
;R354 Show_PRating	proc	near
;R354 
;R354 		mov	al,byte ptr CPU_INT_CLOCK[bp]	;CPU real clock
;R354 
;R354 Next_Mhz_Tbl:
;R354 		cmp	byte ptr cs:[si],0		;last table ?
;R354 		je	short No_Prat_Found
;R354 		cmp	al,cs:[si]			;Mhz match ?
;R354 		je	short Prat_Found		;yes
;R354 	      
;R354 	   	add	si,PRAT_TBL_LEN	  		;no, next mhz
;R354 		jmp	short Next_Mhz_Tbl
;R354 
;R354 
;R354 Prat_Found:
;R354 		inc	si				;offset of string
;R354 
;R354 		mov	al,"-"				;display character
;R354 		call	F000_Display_Char
;R354 		mov	al,"P"
;R354 		call	F000_Display_Char
;R354 
;R354 		call	Check_K586_Cpu 	;check if AMD 5k86 CPU	;R312B
;R354 		jne	short Not_K586_CPU			;R312B
;R354 
;R354 		;"PR" for AMD K5
;R354 		mov	al,"R"				;R312
;R354 		call	F000_Display_Char		;R312
;R354 Not_K586_CPU:							;R312B
;R354 
;R354 		push	cs
;R354 		pop	ds
;R354 
;R354 		call	F000_Display_String		;display P-rating
;R354 No_Prat_Found:
;R354 
;R354 		ret
;R354 Show_PRating	endp
;R354 endif;	NO_PRATING_DISPLAY		 			;R280A
;R354 ;R280 - end


;Input : None
;Output: CF = 1 - only one CPU plugged
;	 CF = 0 - Multiple CPUs plugged
		public	If_MP_PLUGGED		
If_MP_PLUGGED	proc	near
		xor	ax,ax					
		mov	es,ax					
		cmp	byte ptr es:[0500H],0AAH	;More than one CPU ?
		clc
		je	short @F				
		stc
@@:
		ret
If_MP_PLUGGED	endp

;R296 - start
ifdef	MP_SUPPORT
;R296A ;Input    : none
;R296A ;Output   : none
;R296A ;Function : Scan IRQ assignment of PCI devices and record it in MP table
;R296A ;	   
;R296A Build_PciIrq_MpTable	proc	near
;R296A ifdef	NEW_INTEL_IOAPIC
;R296A ;
;R296A ;build IRQ table for PCI devices
;R296A ;		
;R296A 
;R296A 		F000_CALL F000_Shadow_W
;R296A 
;R296A 		F000_CALL Ct_Get_Pirq_In_EBX
;R296A  		and	ebx,0f0f0f0fh	;available bits
;R296A 	;now ebx[ 7: 0] = PIRQ 0
;R296A 	;now ebx[15: 8] = PIRQ 1
;R296A 	;now ebx[23:16] = PIRQ 2
;R296A 	;now ebx[31:24] = PIRQ 2
;R296A 
;R296A 		push	0f000H
;R296A 		pop	ds		 ;DS point to FP structure
;R296A 		
;R296A 		mov	si,offset IO_Int_Entry16 ;first level IRQ
;R296A 
;R296A Next_Io_Entry:
;R296A 		mov	[si+7],bl  	;set destination IRQ
;R296A 
;R296A 		add	si,8		;next PIRQ table
;R296A 		shr	ebx,8
;R296A 		or	ebx,ebx		;finish ?
;R296A 		jnz	short Next_Io_Entry
;R296A 		
;R296A 		F000_CALL 	F000_Shadow_R
;R296A 
;R296A endif;	NEW_INTEL_IOAPIC
;R296A 
;R296A 		ret
;R296A Build_PciIrq_MpTable	endp


;R369;Input : none
;R369;Output: None 
;R369CheckSum_Mp_Table	proc	near
;R369;Build MP table and re-calculate checksum
;R369;Second - calculate checksum of MP Floating Pointer structure
;R369		push	0f000H
;R369		pop	ds			;DS point to FP structure
;R369
;R369;First - Force system BIOS readable and shadow RAM writeable
;R369		F000_CALL F000_Shadow_W
;R369
;R369		mov	si,offset MP_FP_Stru	;checksum stating location
;R369		mov	cx,MP_FP_LENGTH		;length to check sum
;R369		xor	bl,bl			;initial checksum
;R369		cld
;R369Check_Sum1:
;R369		lodsb
;R369		add	bl,al
;R369		loop	short Check_Sum1		
;R369
;R369		neg	bl			;checksum byte
;R369		mov	si,MP_FP_CHKSUM
;R369		add	si,offset MP_FP_Stru
;R369		mov	[si],bl
;R369
;R369;Third - calculate checksum of MP Configuration Table
;R369		mov	si,offset MP_Config_Table;checksum stating location
;R369		mov	cx,MPCFG_LEN		;length to check sum
;R369		xor	bl,bl			;initial checksum
;R369		cld
;R369Check_Sum2:
;R369		lodsb
;R369		add	bl,al
;R369		loop	short Check_Sum2
;R369
;R369		neg	bl			;checksum byte
;R369
;R369
;R369		mov	si,MP_CFG_CHKSUM
;R369		add	si,offset MP_Config_Table
;R369		mov	[si],bl
;R369
;R369
;R369;Last - Force system BIOS shadow RAM readonly
;R369		F000_CALL 	F000_Shadow_R
;R369
;R369		ret
;R369CheckSum_Mp_Table	endp
endif;	MP_SUPPORT

CPUMsg		db	', 1',0
CpuMsgCommon	db	' Processor(s)',0		;R413
;R413 CpuMsgCommon	db	' Processor(s) Detected',0
CPUMsg1		db	', 2',0

		public	Show_Processor_Number
Show_Processor_Number	Proc	Near
ifdef MP_SUPPORT
		push	cs
		pop	ds			;DS point to FP structure
		;*** Display CPU 2 String
		mov	si, offset CPUMsg
		xor	ax,ax
		mov	es,ax
		cmp	byte ptr es:[0500H],0aaH
		jne	short @F
		mov	si, offset CPUMsg1	;2 CPU detected
@@:
		call	F000_Display_String    

		mov	si, offset CPUMsgCommon
		call	F000_Display_String    
endif; MP_SUPPORT
		ret
Show_Processor_Number	ENDP

;R296 - end

;R330A start
		public	Reset_INT13
Reset_INT13:
		mov	ax,g_ram
		mov	es,ax
		assume	es:g_ram
		cli
		mov	ax,word ptr g_ram:int13
		cmp	ax,offset dgroup:hrdskio
		je	short Already_Reset_Int13	
		mov	word ptr g_ram:int40,ax
		mov	ax,word ptr g_ram:int13+2
		mov	word ptr g_ram:int40+2,ax

		mov	ax,offset dgroup:hrdskio
		mov	word ptr g_ram:int13,ax
		mov	word ptr g_ram:int13+2,0f000h
;R428	ifdef	Support_4_IDE
;R428		cmp	byte ptr CMOS_HDDE[bp],0
;R428;R352		je	short @F
;R428;R352A		jne	short Set_Int77			;R352
;R428		je	short Check_HDDF		;R352A
;R428		mov	bx,offset HDDE_ITEM
;R428		f000_call	Get_HDD_CMOS_Info
;R428		cmp	word ptr [bp+di+0],0		;CYLINDER
;R428;R352		je	short @F
;R428;R352 start
;R428		jne	short Set_Int77
;R428Check_HDDF:						;R352A
;R428		cmp	byte ptr CMOS_HDDF[bp],0
;R428		je	short @F
;R428		mov	bx,offset HDDF_ITEM
;R428		f000_call	Get_HDD_CMOS_Info
;R428		cmp	word ptr [bp+di+0],0		;CYLINDER
;R428		je	short @F
;R428Set_Int77:
;R428;R352 end
;R428		mov	ax,offset dgroup:int_hdisk1
;R428		mov	word ptr g_ram:int77,ax		;IRQ15 offset
;R428		mov	word ptr g_ram:int77+2,0f000h	;IRQ15 segment
;R428@@:
;R428	endif	;Support_4_IDE
Already_Reset_Int13:					
		sti
		ret
;R330A end

;R335 - start
;Function : Memory block move function
;Input    : SI - source address
;	    DI - destination address
;	    CX - number of word to move
;Output   : none
		public	E000_Move_Codes
E000_Move_Codes	proc	near
		F000_CALL Move_Codes
		ret
E000_Move_Codes	endp

E000_Kb_Out	proc	near
		F000_CALL Kb_Out
		ret
E000_Kb_Out	endp

;R335 - end

;R381 - start
;Function : Set F0000-FFFFF shadow read/write
;Input    : none
;Output   : none
		public	E_F000_Shadow_W
E_F000_Shadow_W	proc	near
		F000_CALL F000_Shadow_W
		ret
E_F000_Shadow_W	endp

;Function : Set F0000-FFFFF shadow read only.
;Input    : none
;Output   : none
		public	E_F000_Shadow_R
E_F000_Shadow_R	proc	near
		F000_CALL F000_Shadow_R
		ret
E_F000_Shadow_R	endp

;R381 - end

;R396 start
;=============================================================================
; Procedure: POST_decompress
;	for POST runtime decompress ROM BIOS
; Input : DI = decompress index (reference CBROM.EXE)
;	  DI bit 15 = 1 indicate SI is available	;R406
;	     bit 14 = 1 only check decompress code exist?	;R410
;	  SI = new decompress segment			;R406
; Output: decompress ROM BIOS to 4000:0
;	  carry set   - Compressed data not found			   ;R420B
;	  carry clear - Compressed data found and be decompressed to buffer;R420B
;			successfully 					   ;R420B
;		ebx   - Size of data decompressed in Byte unit		   ;R420B
; destroy : ALL register but DS,ES
;=============================================================================
		public	POST_decompress
POST_decompress:
		push	ds
		push	es
		push	bp
		push	di			;R406 store DI
		push	si			;R406 store SI
;R410		and	di,7fffh		;R406 mask DI bit 15
		and	di,3fffh		;R410 mask DI bit 14 & 15

		cli

		mov	al,TRUE
		call	F000_Cpu_Cache

;----- push data and offset for decompress request
;R420		mov	bx,Temp_EXP_Seg
;R420		mov	es,bx
		F000_call	A20_On		;R420;turn on a20 gate
		call	E000_Enter_Prot_mode	;R420
		mov	ax,ds			;R420
		mov	es,ax			;R420
		call	E000_Back_Real_Mode	;R420

;R420ifdef Flash_2M_support
;R420;R396C		mov	esi,160000h
;R420;R396A		cmp	es:[di+Temp_EXP_Off+2],8000h
;R420;R396A		je	short @F
;R420;R396A		add	esi,10000h
;R420;R396A@@:
;R420		push	es
;R420		push	di
;R420		F000_call	A20_On		;turn on a20 gate
;R420		call	E000_Enter_Prot_mode
;R420		mov	ax,ds
;R420		mov	es,ax
;R420		call	E000_Back_Real_Mode	;R396B
;R420;R396C start
;R420		mov	esi,90000h
;R420;R396D		mov	edi,150000h
;R420		mov	edi,140000h		;R396D
;R420		mov	ecx,4000h
;R420		cld
;R420 		db	67h
;R420 		rep	movsd			;backup 90000h to 150000h
;R420
;R420		mov	esi,160000h
;R420;R396C end
;R420		mov	edi,80000h
;R420;R396A		mov	ecx,4000h
;R420		mov	ecx,8000h	;R396A
;R420		cld
;R420 		db	67h
;R420 		rep	movsd			;move extend 128k data to 160000h
;R420;R396B		call	E000_Back_Real_Mode
;R420		F000_CALL A20_Off		;turn gate A20 off
;R420		pop	di
;R420		pop	es
;R420 endif ;Flash_2M_support
		pop	dx			;R406 restore SI to DX
		pop	ax			;R406 restore DI to AX

		mov	ebx,es:[di+Temp_EXP_Off]
		or	ebx,ebx			;invalid data
		jz	Decomp_Data_Empty
		cmp	bx,0ffffh		;invalid data
		je	Decomp_Data_Empty
;R410 start
		test	ah,40h			;check compressed existence
		jz	short Go_on		;only ?
		clc
		jmp	POST_decomp_Ret
Go_on:
;R410 end
;R396Aifdef Flash_2M_support
;R396A		push	8000h
;R396Aelse ;Flash_2M_support
;R420		push	es:[di+Temp_EXP_Off+2]
;R396Aendif ;Flash_2M_support
		mov	di,es:[Temp_EXP_Off]
;R420		pop	es
;R420 start
ifdef Flash_2M_support
;R420C start
;R420D		mov	eax,ds:[160000h]
;R420D		not	eax
;R420D		mov	ds:[80000h],eax
		mov	esi,ds:[160000h]		;R420D
		not	esi				;R420D
		mov	ds:[80000h],esi			;R420D
		cmp	ebx,100000h
		jb	short Is_New_Decomp_Method
		push	di

		mov	esi,90000h
		mov	edi,140000h
		mov	ecx,4000h
		cld
 		db	67h
 		rep	movsd			;backup 90000h to 140000h

		mov	esi,160000h
		mov	edi,80000h
		mov	ecx,8000h
		cld
 		db	67h
 		rep	movsd			;move extend 128k data to 160000h

		pop	di
;R420E		jmp	short Go_Decomp
;R420E start
		ror	ebx,16
		mov	es,bx
		ror	ebx,16
		mov	cx,es:[bx+11h]		;store decompress segment for
						;recalculate checksum
		push	cx			;store it to stack
		push	word ptr es:[bx]	;store original checksum value
		test	ah,80h			;test SI is available?
		jz	short @F		;No,skip process SI
		mov	es:[bx+11h],dx		;reset decompress segment
		add	cl,ch			;original segment of checksum
		add	dl,dh			;new segment of checksum
		sub	cl,dh			;difference segment of checksum
		sub	es:[bx+1],cl		;recalculate checksum
		jmp	short @F		;No,skip process SI
;R420E end
Is_New_Decomp_Method:
;R420C end
		add	ebx,0e0000h		;set 80000h to 160000h
;R420E Go_Decomp:					;R420C
endif ;Flash_2M_support
;R420 end
;R406 start
;R420		mov	cx,es:[bx+11h]		;store decompress segment for
		mov	cx,es:[ebx+11h]		;R420;store decompress segment for
						;recalculate checksum
		push	cx			;store it to stack
;R420		push	word ptr es:[bx]	;store original checksum value
		push	word ptr es:[ebx]	;R420;store original checksum value
		test	ah,80h			;test SI is available?
		jz	short @F		;No,skip process SI
;R420		mov	es:[bx+11h],dx		;reset decompress segment
		mov	es:[ebx+11h],dx		;R420;reset decompress segment
		add	cl,ch			;original segment of checksum
		add	dl,dh			;new segment of checksum
		sub	cl,dh			;difference segment of checksum
;R420		sub	es:[bx+1],cl		;recalculate checksum
		sub	es:[ebx+1],cl		;R420;recalculate checksum
@@:
;R406 end
		ror	ebx,16			;R420
		mov	es,bx			;R420
		ror	ebx,16			;R420
		push	cs
		push	offset @F
		push	0dfffh
;----- Execute decompress -----
		mov	dx,Exp_Data_Seg
		push	2000h
		push	di
		retf
@@:
		F000_call	A20_On		;R420;turn on a20 gate
		call	E000_Enter_Prot_mode	;R420
		mov	ax,ds			;R420
		mov	es,ax			;R420
		call	E000_Back_Real_Mode	;R420
;R420E start
ifdef Flash_2M_support				;R420F
		mov	eax,ds:[80000h]
		cmp	eax,ds:[160000h]
		jne	short Is_New_Decomp
		ror	ebx,16
		mov	es,bx
		ror	ebx,16
		pop	word ptr es:[bx]	;restore original checksum
		pop	word ptr es:[bx+11h]	;restore original segment
		mov	ebx, dword ptr es:[bx+0bh];get decompressed data size
		jmp	short GoAhead
Is_New_Decomp:
endif ;Flash_2M_support				;R420F
;R420E end
;R420A		pop	word ptr es:[bx]	;R406 restore original checksum
;R420A		pop	word ptr es:[bx+11h]	;R406 restore original segment
		pop	word ptr es:[ebx]	;R420A restore original checksum
		pop	word ptr es:[ebx+11h]	;R420A restore original segment
;R420B - start
		mov	ebx, dword ptr es:[ebx+0bh];get decompressed data size
						;in byte unit
;R420B - end
GoAhead:					;R420E
		F000_CALL A20_Off		;R420;turn gate A20 off
;R396Cifdef Flash_2M_support
;R396C		mov	di,8000h
;R396C		mov	es,di
;R396C		xor	di,di
;R396C		xor	eax,eax
;R396C;R396A		mov	cx,4000h
;R396C		mov	cx,8000h		;R396A
;R396C		rep	stosd
;R396Cendif ;Flash_2M_support
		clc
		jmp	short POST_decomp_Ret
Decomp_Data_Empty:
		stc
POST_decomp_Ret:
		pushf
;R420;R396C start
;R420ifdef Flash_2M_support
;R420		mov	di,8000h
;R420		mov	es,di
;R420		xor	di,di
;R420		xor	eax,eax
;R420		mov	cx,4000h
;R420		rep	stosd
;R420
;R420		F000_call	A20_On		;turn on a20 gate
;R420		call	E000_Enter_Prot_mode
;R420		mov	ax,ds
;R420		mov	es,ax
;R420		call	E000_Back_Real_Mode
;R420;R396D		mov	esi,150000h
;R420		mov	esi,140000h		;R396D
;R420		mov	edi,90000h
;R420		mov	ecx,4000h
;R420		cld
;R420 		db	67h
;R420 		rep	movsd			;restore 150000h to 90000h
;R420		F000_CALL A20_Off		;turn gate A20 off
;R420 endif ;Flash_2M_support
;R420;R396C end
;R420C start
ifdef Flash_2M_support
		push	ebx

		F000_call	A20_On		;turn on a20 gate
		call	E000_Enter_Prot_mode
		mov	ax,ds
		mov	es,ax
		call	E000_Back_Real_Mode
		mov	eax,ds:[80000h]
		cmp	eax,ds:[160000h]
		jne	short Not_Old_Decomp_Method

		mov	edi,80000h
		mov	ecx,4000h
		xor	eax,eax
		cld
 		db	67h
 		rep	stosd			;clear 80000h to 8FFFFh

		mov	esi,140000h
		mov	edi,90000h
		mov	ecx,4000h
		cld
 		db	67h
 		rep	movsd			;restore 150000h to 90000h
Not_Old_Decomp_Method:
		F000_CALL A20_Off		;turn gate A20 off
		pop	ebx
endif ;Flash_2M_support
;R420C end
		mov	al,FALSE
		call	F000_Cpu_Cache
		popf

		pop	bp
		pop	es
		pop	ds
		ret
;R396 end

;R400 - start
;[]===========================================================[]
;Function : F0000-FFFFF shadow write
;Input    : Write DATA   al/ax/eax
;	    Offset 	 SI	
;Output   : none
;[]===========================================================[]

public	Write_F000_shadow_Byte	
public	Write_F000_shadow_Word
public	Write_F000_shadow_DWord

Write_F000_shadow_Byte:	
		push	cx
		mov	cx,1		;Write 1 byte
		jmp	short @F
Write_F000_shadow_Word:
		push	cx
		mov	cx,2		;Write 2 bytes
		jmp	short @F
Write_F000_shadow_DWord:
		push	cx
		mov	cx,4		;Write Double word
@@:
		call	G_RAM_EXT_W
		pop	cx
		ret		

;[]===========================================================[]
;Function : F0000-FFFFF shadow write
;Input    : 
;	    Data length = cl	   Write DATA
;	       cl=1,Byte	      al
;	       cl=2,Word	      ax
;	       cl=4,Dword	     eax
;R400A;	    Offset [SI+BX]
;	    Offset [SI]					;R400A
;Output   : none
;[]===========================================================[]

public	G_RAM_EXT_W
G_RAM_Ext_W	proc	near
		pusha
		push	cx
		push	eax
		push	si				;R400A
		call	E_F000_Shadow_W			
		pop	si				;R400A
		pop	eax
		pop	cx
		push	gs
		push	0f000h
		pop	gs  				;G_RAM_EXT use F000 segment
		xor	bx,bx				;R400A
@@:
		mov	gs:[si+bx],al			;write data to shadow
		inc	bx				;index
		shr	eax,8				;shift to next byte
		loop	short @B			;count cx(data lentgh)
		call	E_F000_Shadow_R			;disable shadow RAM write
		
		pop	gs
		popa
		ret
G_RAM_Ext_W	endp

;R400 - end

ECODE		ENDS

;R187 DGROUP		GROUP	FCODE
FCODE		SEGMENT PARA PUBLIC 'CODE'
		ASSUME	CS:DGROUP
FCODE		ENDS


;R436 - starts
XGROUP		GROUP	XCODE
XCODE		SEGMENT USE16 PARA PUBLIC 'XCODE'
		ASSUME	CS:XGROUP
XCODE		ENDS
;R436 - ends

		END
