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

📄 gpmmisc.inc

📁 AMI 主板的BIOS源码
💻 INC
📖 第 1 页 / 共 3 页
字号:
	mov	ah,00100000b			; screen on

;-----------------------------------------------;

enable_display_3c0_00::

	call	video_display_3c0_on_off	;
	pop	ax				;
	ret

enable_video_display_3c0	endp

;---------------------------------------------------------------;
;		   VIDEO_DISPLAY_3C0_ON_OFF			;
;---------------------------------------------------------------;
;	Input : (AH) 00100000b display on			;
;		     00000000b display off			;
;	Output: NONE						;
;	Register destroyed : (AX)				;
;---------------------------------------------------------------;

video_display_3c0_on_off	proc	near

	push	dx				;

	call	clear_attribute_flipflop	; clear attribute flipflop

	mov	dx,attribute_addr_reg		; (dx) = ATTRIBUTE address reg (3C0H)
	in	al,dx				; (al) = current index

	and	al,11011111b			; clear display on/off bit
	or	al,ah				; display on/off

	call	clear_attribute_flipflop	; clear attribute flipflop
	out	dx,al				; display on/off

	pop	dx				;
	ret

video_display_3c0_on_off	endp

;---------------------------------------------------------------;
;		   CLEAR_ATTRIBUTE_FLIPFLOP			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

clear_attribute_flipflop	proc	near

	push	ax				;
	push	dx				;

	mov	dx,input_status_reg_1_color_reg	; (dx) = input status reg 1 color (3DAH)
	in	al,dx				; clear attribute flipflop
	smi_io_delay				; i/o delay
	mov	dl,low input_status_reg_1_mono_reg; (dx) = input status reg 1 mono (3BAH)
	in	al,dx				; clear attribute flipflop

	pop	dx				;
	pop	ax
	ret

clear_attribute_flipflop	endp

;---------------------------------------------------------------;
;		    DISABLE_VIDEO_DISPLAY_3C4			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

disable_video_display_3c4	proc	near

	push	ax				;
	mov	ah,00100000b			; screen off
	jmp	short enable_display_3c4_00	;

disable_video_display_3c4	endp

;---------------------------------------------------------------;
;		    ENABLE_VIDEO_DISPLAY_3C4			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

enable_video_display_3c4	proc	near

	push	ax				;
	mov	ah,00000000b			; screen on

;-----------------------------------------------;

enable_display_3c4_00::

	call	video_display_3c4_on_off	;
	pop	ax				;
	ret

enable_video_display_3c4	endp

;---------------------------------------------------------------;
;		     VIDEO_DISPLAY_3C4_ON_OFF			;
;---------------------------------------------------------------;
;	Input : (AH) 00000000b display on			;
;		     00100000b display off			;
;	Output: NONE						;
;	Register destroyed : (AX)				;
;---------------------------------------------------------------;

video_display_3c4_on_off	proc	near

	push	dx				;

	mov	dx,sequencer_addr_reg		; (dx) = sequencer address reg (3C4H)
	in	al,dx				; (al) = read current index select
	smi_io_delay				; i/o delay
	push	ax				; save for later restore

	mov	al,clocking_mode_reg_idx	; (al) = clocking mode reg of sequencer (3C5.01)
	out	dx,al				; select the index
	smi_io_delay				; i/o delay
	inc	dx				; data register (3C5H)
	in	al,dx				; (al) = read current programmed value
	and	al,11011111b			;

;-----------------------------------------------;

enb_dis_horz_vert_retrace_10::

	or	al,ah				; screen on/off
	out	dx,al				;
	smi_io_delay				; i/o delay

	dec	dx				; (dx) = sequencer address reg (3C4H)
	pop	ax				; (al) = read current index select
	out	dx,al				; restore index

	pop	dx				;
	ret

video_display_3c4_on_off	endp

;---------------------------------------------------------------;
;		    DISABLE_HORZ_VERT_RETRACE			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

disable_horz_vert_retrace	proc	near

	push	ax				;
	mov	ah,00000000b			; disable horizontal & vertical retrace
	jmp	short enable_horz_vert_retrace_00

disable_horz_vert_retrace	endp

;---------------------------------------------------------------;
;		    ENABLE_HORZ_VERT_RETRACE			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

enable_horz_vert_retrace	proc	near

	push	ax				;
	mov	ah,10000000b			; enable horizontal & vertical retrace

;-----------------------------------------------;

enable_horz_vert_retrace_00::

	call	enb_dis_horz_vert_retrace	;
	pop	ax				;
	ret

enable_horz_vert_retrace	endp

;---------------------------------------------------------------;
;		    ENB_DIS_HORZ_VERT_RETRACE			;
;---------------------------------------------------------------;
;	Input : (AH) 00000000b disable horizontal/vert retrace	;
;		     10000000b enable horizontal/vert retrace	;
;	Output: NONE						;
;	Register destroyed : (AX)				;
;---------------------------------------------------------------;

enb_dis_horz_vert_retrace	proc	near 

	push	dx				;
	mov	dx,miscellaneous_out_reg_read_mode; miscellaneous output reg (3C2H) in read mode (3CCH)
	in	al,dx				; (al) = current programmed value
	test	al,00000001b			; set for color ?
	mov	dl,low crt_addr_reg_mono	; CRT control reg for mono (3B4H)
	jz	short enb_dis_horz_vert_retrace_01; no...mono
	mov	dl,low crt_addr_reg_color	; CRT control reg for color (3D4H)
enb_dis_horz_vert_retrace_01:
	in	al,dx				; (al) = read current index
	smi_io_delay				; i/o delay
	push	ax				; save it for later restore
	mov	al,crtc_mode_cntl_reg_index	; CRT mode control reg (3B4H/3D4H.17H)
	out	dx,al				;
	smi_io_delay				; i/o delay
	inc	dx				;
	in	al,dx				; (al) = current programmed value
	and	al,01111111b			; clear horizontal/vertical retrace bit
	jmp	short enb_dis_horz_vert_retrace_10

enb_dis_horz_vert_retrace	endp

;---------------------------------------------------------------;
;			SMI_INT_10H				;
;---------------------------------------------------------------;
;	Input : as required by the function requested		;
;	Output: as required by the function requested		;
;	Register destroyed : all general purpose		;
;---------------------------------------------------------------;

smi_int_10h	proc	near

	pushf					; save current interrupt enable/disable status

	call	set_vector_before_int_exec	; set interrupt vectors before executing any software interrupt

	pushf					; for IRET in INT 10H
	call	dword ptr ds:vga_bios_entry	; execute INT 10H

	call	res_vector_after_int_exec	; restore interrupt vectors after executing software interrupts

	popf					; restore interrupt enable/disable status
	ret

smi_int_10h	endp

;---------------------------------------------------------------;
;		   SET_VECTOR_BEFORE_INT_EXEC			;
;---------------------------------------------------------------;
;	Input : (DS) PM BIOS data segment			;
;	Output: NONE						;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

set_vector_before_int_exec	proc	near

	pushad					;
	mov	di,save_current_vga_vector	;
	call	save_int10_vectors		; save current vectors
	mov	si,save_post_vga_vector		;
	call	res_int10_vectors		; restore POST time vectors
	popad					;
	ret

set_vector_before_int_exec	endp

;---------------------------------------------------------------;
;		   RES_VECTOR_AFTER_INT_EXEC			;
;---------------------------------------------------------------;
;	Input : (DS) PM BIOS data segment			;
;	Output: NONE						;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

res_vector_after_int_exec	proc	near

	pushf					;
	pushad					;
	mov	si,save_current_vga_vector	;
	call	res_int10_vectors		;
	popad					;
	popf					;
	ret

res_vector_after_int_exec	endp

;---------------------------------------------------------------;
;			SAVE_INT10_VECTORS			;
;---------------------------------------------------------------;
;	Input : (DS:DI) vectors save area			;
;	Output: NONE						;
;	Register destroyed : (EAX)				;
;---------------------------------------------------------------;

save_int10_vectors	proc	near

	push	ds				;
	push	es				;
	push	ds				;
	pop	es				; (ES) = (DS)
	xor	ax,ax				;
	mov	ds,ax				; (DS) = interrupt vector segment
	mov	eax,ds:[0040h]			; INT 10h
	stosd					; save
	mov	eax,ds:[01b4h]			; INT 6Dh
	stosd					; save
	mov	eax,ds:[04a8h]			; [0:4A8h]
	stosd					; save
	pop	es				;
	pop	ds				;
	ret

save_int10_vectors	endp

;---------------------------------------------------------------;
;			RES_INT10_VECTORS			;
;---------------------------------------------------------------;
;	Input : (DS:SI) vectors save area			;
;	Output: NONE						;
;	Register destroyed : (EAX)				;
;---------------------------------------------------------------;

res_int10_vectors	proc	near

	push	es				;
	xor	ax,ax				;
	mov	es,ax				; (ES) = interrupt vector segment
	lodsd					; INT 10h data
	mov	es:[0040h],eax			; restore
	lodsd					; INT 6Dh data
	mov	es:[01b4h],eax			; restore
	lodsd					; [0:4A8h] data
	mov	es:[04a8h],eax			; restore
	pop	es				;
	ret

res_int10_vectors	endp

;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;**								**;
;**	(C)Copyright 1985-1996, American Megatrends Inc.	**;
;**								**;
;**			All Rights Reserved.			**;
;**								**;
;**		6145-F, Northbelt Parkway, Norcross,		**;
;**								**;
;**		Georgia - 30071, USA. Phone-(770)-246-8600.	**;
;**								**;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
;		     GET_EBP_FOR_STACK_USAGE			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: (EBP) current stack pointer			;
;	Register destroyed : (EBP)				;
;---------------------------------------------------------------;

get_ebp_for_stack_usage	proc	near

	push	esp				;
	mov	ebp,esp				;
	movzx	esp,sp				;
	db	66h				;
	leave					; (e)sp <-- (e)bp then pop (ebp)
	xchg	ebp,esp				;
	pushf					;
	add	ebp,2				; take care of CALL
	popf					;
	ret

get_ebp_for_stack_usage	endp

;---------------------------------------------------------------;

IF	IRQ_HANDLING_SUPPORT
;---------------------------------------------------------------;
;			   CHECK_IRQ_PM				;
;---------------------------------------------------------------;
;	Input : (DS) PM BIOS data segment			;
;	Output: (ZF) 00 (NZ) IRQ based power management active	;
;		(ZF) 01 (ZR) SMI based power management active	;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

check_irq_pm	proc	near

	test	byte ptr ds:misc_proc_smi_info,irq_power_management; IRQ based power management ?
	ret

check_irq_pm	endp

;---------------------------------------------------------------;
;			   CHECK_IRQ_APM			;
;---------------------------------------------------------------;
;	Input : (DS) PM BIOS data segment			;
;	Output: (ZF) 00 (NZ) IRQ based APM 16/32 bit function	;
;			     currently being executed		;
;		(ZF) 01 (ZR) IRQ based APM 16/32 bit function	;
;			     currently is not being executed	;
;	Register destroyed : NONE				;
;---------------------------------------------------------------;

check_irq_apm	proc	near

	call	check_irq_pm			; IRQ based power management currently being active ?
	jz	short check_irq_apm_00		; no...
	cmp	byte ptr ds:irq_apm_in_progress,00h; IRQ based APM currently active ?
	jz	short check_irq_apm_00		; no...
	test	byte ptr ds:apm_connection_info,apm_16bit_mode_connect_est or apm_32bit_mode_connect_est
check_irq_apm_00:
	ret

check_irq_apm	endp

;---------------------------------------------------------------;
ENDIF

;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;**								**;
;**	(C)Copyright 1985-1996, American Megatrends Inc.	**;
;**								**;
;**			All Rights Reserved.			**;

⌨️ 快捷键说明

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