📄 runsmba.asm
字号:
page ,132
title . SMBA Shared Frame Buffer Runtime Functions
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1995, American Megatrends, Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F Northbelt Pkwy, Norcross, GA 30071 **;
;** **;
;** Phone (770)-263-8181 **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------;
extrn FrameBufGetAsymMemInfo: near
extrn FrameBufGetBankMemSize: near
extrn FrameBufGetBankMemSpeed: near
extrn FrameBufGetBankMemType: near
extrn FrameBufGetCmosData: near
extrn FrameBufGetCurAddress: near
extrn FrameBufGetCurSize: near
extrn FrameBufGetFbBanks: near
extrn FrameBufGetHostBusSpeed: near
extrn FrameBufGetMemHoleInfo: near
extrn FrameBufGetMinMaxSize: near
extrn FrameBufMakeInvisible: near
extrn FrameBufMakeVisible: near
extrn FrameBufSetCmosData: near
extrn FrameBufSetMemHoleOverlap: near
extrn FrameBufSetSize: near
;---------------------------------------;
SMBA_BIOS_VERSION equ 10h
;---------------------------------------;
cgroup group _text
_text segment para public 'CODE' ;BIOS16 structure must be para aligned
assume cs:cgroup
.386
;---------------------------------------;
; BIOS16 Service Directory Signature ;
;---------------------------------------;--------------------------------------;
; This structure marks the position of the BIOS16 Service Directory. 16 bit ;
; runtime software will search E0000-FFFF0 for the ASCII signature "_16_" ;
; to find this structure. If the checksum of the structure is ok, then the 16 ;
; bit runtime software will use the 32 bit absolute address contained in this ;
; structure to call the BIOS16 Service Directory Function. ;
;------------------------------------------------------------------------------;
BIOS16_SD_Signature db '_16_'
BIOS16_SD_EntryPointOff dw offset cgroup:BIOS16_Service_Dir
BIOS16_SD_EntryPointSeg dw 000Fh
BIOS16_SD_RevLevel db 00h ;Rev 00
BIOS16_SD_Length db 01h ;In paragraphs
BIOS16_SD_CheckSum db 00h ;Adjusted during make so sum of this struc is 0
BIOS16_SD_Reserved db 00h, 00h, 00h, 00h, 00h
;---------------------------------------;
; BIOS16_Service_Dir ;
;---------------------------------------;--------------------------------------;
; 16 Bit runtime software will call this function to detect the presence of, ;
; and the entry point for a given 16 bit BIOS API. Currently the only 16 bit ;
; API supported by this directory is the 16 bit SMBA runtime function API. ;
; ;
; Input: EAX = 4 byte ASCII string describing the 16 bit BIOS API that caller ;
; needs to access. Only one value is currently valid: ;
; "_SF_" or 5F46535Fh : SMBA BIOS 16 bit API ;
; BL = Directory function number, currently only one function is ;
; supported: 00 - Returns entry point of given 16 bit BIOS API ;
; ;
; Output: AL = Return code: ;
; 00h = Requested API is present ;
; 80h = Requested API is not present ;
; 81h = BL contains an unsupported function number ;
; EBX = Absolute segment base of the requested API's entry point (used ;
; to build a descriptor) ;
; ECX = The requested API's length (used to build a descriptor) ;
; EDX = Offset from base of the requested API's entry point (used to ;
; place a far call to the entry point) ;
; ;
; ;
; Destroys: Nothing ;
;------------------------------------------------------------------------------;
BIOS16_Service_Dir proc far
cmp eax, 5F46535Fh ;'_SF_'
mov al, 80h ;Return code for unknown API string
jne bios16_sd_done ;Br if unknown API string
mov al, 81h ;Return code for unknown function
or bl, bl
jnz bios16_sd_done ;Br if BL has unknown function number
mov ebx, 0F0000h ;Base address of 16 bit SMBA API
mov ecx, 010000h ;Length of 16 bit SMBA API
mov edx, offset SmbaEntryPoint16
mov al, 0h ;Return code for success
bios16_sd_done:
ret
BIOS16_Service_Dir endp
;---------------------------------------;
; SmbaEntryPoint16 ;
;---------------------------------------;--------------------------------------;
; This is the entry point for all SMBA 16-bit runtime functions. ;
; ;
; Input: AL = Function number ;
; Other registers are function dependant ;
; ;
; Output: CF = Clear if function was successful, set if error ;
; AH = If CF set, contains an error code ;
; ;
; Destroys: Nothing ;
;------------------------------------------------------------------------------;
SmbaEntryPoint16 proc far
push bp
movzx bp, al ;BP = function number
shl bp, 1 ;BP = 2 * function number
add bp, offset cgroup:VumaFuncTableStart
cmp bp, offset cgroup:VumaFuncTableEnd
jae SmbaInvalidFunction ;Br if func number is too high
call word ptr cgroup:[bp] ;Returns CF/AH set if error
;Do we need to set a return code for success?...........................
SmbaDone:
pop bp
retf
SmbaInvalidFunction:
xor ah, ah ;AH = Error code 00h (General failure)
stc ;Indicate error
jmp short SmbaDone
SmbaEntryPoint16 endp
;------------------------------;
; SMBA Run Time Function Table ;
;------------------------------;
VumaFuncTableStart:
dw SmbaGetRevision ;SMBA function 00h
dw SmbaGetConfig ;SMBA function 01h
dw SmbaGetMemInfo ;SMBA function 02h
dw SmbaSetMemSize ;SMBA function 03h
dw SmbaSetMemHoleOverlap ;SMBA function 04h
dw SmbaSetNextBootMemSize ;SMBA function 05h
dw SmbaGetNextBootMemSize ;SMBA function 06h
dw SmbaOpen ;SMBA function 07h
dw SmbaClose ;SMBA function 08h
dw SmbaGetInstalledMem ;SMBA function 09h
VumaFuncTableEnd:
;---------------------------------------;
; SmbaGetRevision (00) ;
;---------------------------------------;--------------------------------------;
; This function returns the SMBA specification version supported by the BIOS. ;
; ;
; Input: AL = Function number ;
; ;
; Output: BL = SMBA Revision ;
; CF = Clear if function was successful, set if error ;
; AH = If CF set, contains an error code ;
; ;
; Destroys: Nothing ;
;------------------------------------------------------------------------------;
SmbaGetRevision proc near
mov bl, SMBA_BIOS_VERSION
clc
ret
SmbaGetRevision endp
;---------------------------------------;
; SmbaGetConfig (01) ;
;---------------------------------------;--------------------------------------;
; This function returns information about the SMBA frame buffer sizes that are ;
; supported by the chipset as well as the frame buffer's current address. ;
; ;
; Input: AL = Function number ;
; ;
; Output: BX = Frame buffer sizes supported by the chipset ;
; Bit 0: If set, 0.5 MB frame buffer size is supported ;
; Bit 1: If set, 1.0 MB frame buffer size is supported ;
; Bit 2: If set, 1.5 MB frame buffer size is supported ;
; Bit 3: If set, 2.0 MB frame buffer size is supported ;
; Bit 4: If set, 2.5 MB frame buffer size is supported ;
; Bit 5: If set, 3.0 MB frame buffer size is supported ;
; Bit 6: If set, 3.5 MB frame buffer size is supported ;
; Bit 7: If set, 4.0 MB frame buffer size is supported ;
; Bit 8-15: Reserved ;
; ECX = Frame buffer current base address ;
; DX = Memory hole information ;
; Bit 15: If set, memory hole overlaps frame buffer ;
; Bit 14-2: Reserved ;
; Bit 1-0: 00 = Memory hole is disabled ;
; 01 = Reserved ;
; 10 = Memory hole is 1MB at 15MB ;
; 11 = Memory hole is 2MB at 14MB ;
; CF = Clear if function was successful, set if error ;
; AH = If CF set, contains an error code ;
; ;
; Destroys: Nothing ;
;------------------------------------------------------------------------------;
SmbaGetConfig proc near
push eax
push di
call FrameBufGetMinMaxSize ;Returns BX=min, CX=max, DI=gran
shr bx, 3 ;BX = Min mem size in 512kb units
dec bx ;BX = Min mem size (0=0.5MB, 1=1.0MB, ...)
jns @f ;Br if min mem size >= 512kb
xor bx, bx ;Set min mem size to 512kb
@@:
shr cx, 3 ;CX = Max mem size in 512kb units
dec cx ;CX = Max mem size (0=0.5MB, 1=1.0MB, ...)
cmp cx, 7
jbe @f ;Br if max size <= 4.0 MB
mov cx, 7
@@:
xor ax, ax ;Init bit accumulator
GetConfigNextSizeBit:
bts ax, bx ;Set one of the size bits
inc bx ;Next bit number
cmp bx, cx ;Compare to max size
jbe GetConfigNextSizeBit ;Br if more bits need to be set
mov bx, ax ;BX = supported sizes ready for return
call FrameBufGetCurAddress ;Returns EAX = cur addr of frame buffer
mov ecx, eax ;ECX = address return value
call FrameBufGetMemHoleInfo ;Returns DX=mem hole info
pop di
pop eax
clc ;Indicate success
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -