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

📄 runsmba.asm

📁 AMI 主板的BIOS源码
💻 ASM
📖 第 1 页 / 共 3 页
字号:
; boot.  No chipset register should be affected, the size should only be saved ;
; to CMOS.                                                                     ;
;                                                                              ;
; Input:  AL = Function number                                                 ;
;         BX = New frame buffer size                                           ;
;              Bit 0: If set, 0.5 MB frame buffer size                         ;
;              Bit 1: If set, 1.0 MB frame buffer size                         ;
;              Bit 2: If set, 1.5 MB frame buffer size                         ;
;              Bit 3: If set, 2.0 MB frame buffer size                         ;
;              Bit 4: If set, 2.5 MB frame buffer size                         ;
;              Bit 5: If set, 3.0 MB frame buffer size                         ;
;              Bit 6: If set, 3.5 MB frame buffer size                         ;
;              Bit 7: If set, 4.0 MB frame buffer size                         ;
;              Bit 8-15: Reserved                                              ;
;                                                                              ;
; Output: CF = Clear if function was successful, set if error                  ;
;         AH = If CF set, contains an error code                               ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
SmbaSetNextBootMemSize	proc near
	push	bx
	push	cx
	push	dx

	call	XlatSmbaWordTo64Kb	;Returns DX=size in 64KB, CF/AH set on error
	jc	SetNbMemSizeDone	;Br if error

	xor	ch, ch			;Primary (only) SMBA device, disable mem at boot
	call	FrameBufSetCmosData

	clc				;Indicate success

SetNbMemSizeDone:
	pop	dx
	pop	cx
	pop	bx
	ret
SmbaSetNextBootMemSize	endp


;---------------------------------------;
; SmbaGetNextBootMemSize (06)           ;
;---------------------------------------;--------------------------------------;
; This function reports the size of the SMBA shared frame buffer that will be  ;
; used on the next boot.  This information is read from CMOS.                  ;
;                                                                              ;
; Input:  AL = Function number                                                 ;
;                                                                              ;
; Output: BX = New frame buffer size on next boot                              ;
;              Bit 0: If set, 0.5 MB frame buffer size                         ;
;              Bit 1: If set, 1.0 MB frame buffer size                         ;
;              Bit 2: If set, 1.5 MB frame buffer size                         ;
;              Bit 3: If set, 2.0 MB frame buffer size                         ;
;              Bit 4: If set, 2.5 MB frame buffer size                         ;
;              Bit 5: If set, 3.0 MB frame buffer size                         ;
;              Bit 6: If set, 3.5 MB frame buffer size                         ;
;              Bit 7: If set, 4.0 MB frame buffer size                         ;
;              Bit 8-15: Reserved                                              ;
;         CF = Clear if function was successful, set if error                  ;
;         AH = If CF set, contains an error code                               ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
SmbaGetNextBootMemSize	proc near
	push	cx
	push	dx

	call	FrameBufGetCmosData	;Returns DX=size in 64kb, CH=flags
	call	Xlat64KbToSmbaWord	;Returns BX=SMBA word format from size DX

	pop	dx
	pop	cx
	clc				;Indicate success
	ret
SmbaGetNextBootMemSize	endp


;---------------------------------------;
; SmbaOpen (07)                         ;
;---------------------------------------;--------------------------------------;
; This function makes the SMBA shared frame buffer memory region visible to    ;
; the CPU.                                                                     ;
;                                                                              ;
; Input:  AL = Function number                                                 ;
;                                                                              ;
; Output: CF = Clear if function was successful, set if error                  ;
;         AH = If CF set, contains an error code                               ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
SmbaOpen	proc near
	call	FrameBufMakeVisible
	clc				;Indicate success
	ret
SmbaOpen	endp


;---------------------------------------;
; SmbaClose (08)                        ;
;---------------------------------------;--------------------------------------;
; This function makes the SMBA shared frame buffer memory region invisible to  ;
; the CPU.                                                                     ;
;                                                                              ;
; Input:  AL = Function number                                                 ;
;                                                                              ;
; Output: CF = Clear if function was successful, set if error                  ;
;         AH = If CF set, contains an error code                               ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
SmbaClose	proc near
	call	FrameBufMakeInvisible
	clc				;Indicate success
	ret
SmbaClose	endp


;---------------------------------------;
; SmbaGetInstalledMem (09)              ;
;---------------------------------------;--------------------------------------;
; This function reports the total amount of memory installed in the system as  ;
; well as the amount that is installed in the last row.                        ;
;                                                                              ;
; Input:  AL = Function number                                                 ;
;                                                                              ;
; Output: EBX = Amount of memory in last row (in bytes)                        ;
;         ECX = Total amount of memory installed in system (in bytes)          ;
;         CF = Clear if function was successful, set if error                  ;
;         AH = If CF set, contains an error code                               ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
SmbaGetInstalledMem	proc near
	push	eax

	xor	ebx, ebx		;Init memory accumulator
	mov	cx, 15			;Start with highest bank

GetMemNextBank:
	call	FrameBufGetBankMemSize	;Returns AX=size in 64k of bank CL
	shl	eax, 16			;EAX = size in bytes of bank CL
	add	ebx, eax		;EBX = total memory so far
	loop	GetMemNextBank

	call	FrameBufGetFbBanks	;Returns AX=bit map with SMBA bank set
	bsf	cx, ax			;CX = SMBA bank number
	call	FrameBufGetBankMemSize	;Returns AX=size in 64k of bank CL
	shl	eax, 16			;EAX = size in bytes of bank CL

	mov	ecx, ebx		;ECX = total memory ready to return
	mov	ebx, eax		;EBX = total memory in SMBA bank

	pop	eax
	clc
	ret
SmbaGetInstalledMem	endp



;---------------------------------------;
; XlatSmbaWordTo64Kb                    ;
;---------------------------------------;--------------------------------------;
; This function reports the total amount of memory installed in the system as  ;
; well as the amount that is installed in the last row.                        ;
;                                                                              ;
; Input:  BX = Frame buffer size                                               ;
;              Bit 0: If set, 0.5 MB frame buffer size                         ;
;              Bit 1: If set, 1.0 MB frame buffer size                         ;
;              Bit 2: If set, 1.5 MB frame buffer size                         ;
;              Bit 3: If set, 2.0 MB frame buffer size                         ;
;              Bit 4: If set, 2.5 MB frame buffer size                         ;
;              Bit 5: If set, 3.0 MB frame buffer size                         ;
;              Bit 6: If set, 3.5 MB frame buffer size                         ;
;              Bit 7: If set, 4.0 MB frame buffer size                         ;
;              Bit 8-15: Reserved                                              ;
;                                                                              ;
; Output: DX = Frame buffer size in units of 64k                               ;
;         CF = Clear if function was successful, set if error                  ;
;         AH = If CF set, contains an error code                               ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
XlatSmbaWordTo64Kb	proc near

	test	bx, 00FFh
	mov	ah, 0			;Error code
	stc				;Indicate error
	jz	XlatMemSizeDone		;Br if no legal bits are set

	bsr	dx, bx			;BX = mem size (0=0.5MB, 1=1.0MB, ...)
	inc	dx			;BX = mem size (1=0.5MB, 2=1.0MB, ...)
	shl	dx, 3			;BX = mem size in 64kB

XlatMemSizeDone:
	ret
XlatSmbaWordTo64Kb	endp


;---------------------------------------;
; Xlat64KbToSmbaWord                    ;
;---------------------------------------;--------------------------------------;
; This function reports the total amount of memory installed in the system as  ;
; well as the amount that is installed in the last row.                        ;
;                                                                              ;
; Input:  DX = Frame buffer size in units of 64kb                              ;
;                                                                              ;
; Output: BX = Frame buffer size                                               ;
;              Bit 0: If set, 0.5 MB frame buffer size                         ;
;              Bit 1: If set, 1.0 MB frame buffer size                         ;
;              Bit 2: If set, 1.5 MB frame buffer size                         ;
;              Bit 3: If set, 2.0 MB frame buffer size                         ;
;              Bit 4: If set, 2.5 MB frame buffer size                         ;
;              Bit 5: If set, 3.0 MB frame buffer size                         ;
;              Bit 6: If set, 3.5 MB frame buffer size                         ;
;              Bit 7: If set, 4.0 MB frame buffer size                         ;
;              Bit 8-15: Reserved                                              ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
Xlat64KbToSmbaWord	proc near
	push	dx
	
	xor	bx, bx
	shr	dx, 3			;DX = mem size in 512kb units
	dec	dx			;DX = mem size (0=0.5MB, 1=1.0MB, ...)
	js	@f			;Br if mem size < 512kb
	bts	bx, dx			;Set proper bit in BX
@@:
	pop	dx
	ret
Xlat64KbToSmbaWord	endp


_text	ends
	end
;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**      (C)Copyright 1985-1995, American Megatrends, Inc.      **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**           6145-F Northbelt Pkwy, Norcross, GA 30071         **;
;**                                                             **;
;**                     Phone (770)-263-8181                    **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;

⌨️ 快捷键说明

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