📄 runsmba.asm
字号:
SmbaGetConfig endp
;---------------------------------------;
; SmbaGetMemInfo (02) ;
;---------------------------------------;--------------------------------------;
; This function reports various system attributes such as the amount and type ;
; of memory installed. ;
; ;
; Input: AL = Function number ;
; ;
; Output: CX = Current SMBA 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 ;
; BX = Memory information word ;
; Bit 2-0: Type of memory that is installed in SMBA bank ;
; 000 = Memory type unknown ;
; 001 = Fast page mode ;
; 010 = EDO ;
; 011 = SDRAM ;
; 100 = BEDO ;
; 101 - 111 = Reserved ;
; Bit 5-3: Host bus clock frequency ;
; 000 = Host bus clock frequency unknown ;
; 001 = 50 MHz ;
; 010 = 60 MHz ;
; 011 = 66 MHz ;
; 100 - 111 = Reserved ;
; Bit 8-6: Memory speed ;
; 000 = Memory speed unknown ;
; 001 = 70 ns ;
; 010 = 60 ns ;
; 011 = 50 ns ;
; 100 - 111 = Reserved ;
; Bit 11-9: Number of rows of memory that are populated ;
; 000 = Reserved ;
; 001 = One row is populated ;
; 010 = Two rows are populated ;
; 011 = Three rows are populated ;
; 100 = Four rows are populated ;
; 101 = Five rows are populated ;
; 110 - 111 = Reserved ;
; Bit 14-12: Amount of memory installed in shared row ;
; 000 = Shared row not populated ;
; 001 = 4 MB ;
; 010 = 8 MB ;
; 011 = 16 MB ;
; 100 = 32 MB ;
; 101 - 111 = Reserved ;
; Bit 15: If set, memory is asymetrical ;
; If clear, memory is symetrical ;
; CF = Clear if function was successful, set if error ;
; AH = If CF set, contains an error code ;
; ;
; Destroys: Nothing ;
;------------------------------------------------------------------------------;
SmbaGetMemInfo proc near
push ax
push dx
push bp
; Determine SMBA bank's memory type
; Result into BP[2:0]
call FrameBufGetFbBanks ;Returns AX=bit map with SMBA bank set
bsf cx, ax ;CX = SMBA bank number
call FrameBufGetBankMemType ;Returns AL=mem type for bank CL
and ax, 07h ;AX = 1/2/3/4 for FPM/EDO/SDRAM/BEDO
mov bp, ax ;Put mem type field into BP
; Determine host bus frequency
; Result into BP[5:3]
call FrameBufGetHostBusSpeed ;AL = 1/2/3 for 50/60/66 MHz
and ax, 00000111b ;Limit host bus speed to 3 bits
shl ax, 3
or bp, ax ;Put host bus speed field into BP
; Determine memory speed
; Result into BP[8:6]
call FrameBufGetBankMemSpeed ;Returns AL=mem speed for bank CL
mov dx, 1 ;Value for 70ns
cmp al, 70d
je @f ;Br if 70ns
inc dx ;DX = value for 60ns
cmp al, 60d
je @f ;Br if 60ns
inc dx ;DX = value for 50ns
@@: shl dx, 6
or bp, dx ;Put memory speed field into BP
; Determine symetrical / asymetrical memory
; Result into BP[15]
call FrameBufGetAsymMemInfo ;Returns BL=Flag, DL=cols, DH=rows for bank CL
test bl, 00000001b ;BL[0] is set if asymetrical
jz @f ;Br if symetrical
or bp, 8000h ;Set asymetrical bit in BP
@@:
; Determine amount of memory in SMBA bank, if zero then invalidate all
; of the other info in BP so far because it is invaild.
; Result in BP[14:12]
call FrameBufGetBankMemSize ;Returns AX=size in 64k of bank CL
xor bx, bx
or ax, ax ;AX=40h/80h/100h/.. for 4/8/16/.. MB size
jz GetMemInfoNoSmbaMem ;Br if no mem is in SMBA bank
bsf ax, ax ;AX=6/7/8/9/.. for 4/8/16/32/.. MB size
sub ax, 5 ;AX=1/2/3/4/.. for 4/8/16/32/.. MB size
and ax, 0007h ;Limit result to 3 bits
shl ax, 12
or bp, ax ;Put SMBA bank mem size field into BP
mov bx, bp ;BX = value for return
GetMemInfoNoSmbaMem:
; Determine number of banks containing memory
; Result in BX[11:9]
xor dx, dx ;Init populated bank counter
mov cx, 15 ;Start with highest bank
GetMemNextBank:
call FrameBufGetBankMemSize ;Returns AX=size in 64k of bank CL
or ax, ax
jz @f ;Br if bank CL has no memory
inc dx ;Inc populated bank counter
@@: loop GetMemNextBank
and dl, 07h ;Limit bank count to 3 bits
shl dx, 9
or bx, dx ;Put # of installed banks field into BX
; Determine current SMBA frame buffer size in SMBA word format
; Result into CX
push bx
call FrameBufGetCurSize ;Returns DX = cur frame buf size in 64k
call Xlat64KbToSmbaWord ;Returns BX=SMBA word format from size DX
mov cx, bx ;CX = cur size ready to return
pop bx
clc ;Indicate success
pop bp
pop dx
pop ax
ret
SmbaGetMemInfo endp
;---------------------------------------;
; SmbaSetMemSize (03) ;
;---------------------------------------;--------------------------------------;
; This function sets the size of the SMBA shared frame buffer. The new size ;
; takes effect immediately. The SMBA frame buffer size setting in CMOS is ;
; also updated. ;
; ;
; 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 ;
;------------------------------------------------------------------------------;
SmbaSetMemSize proc near
push bx
push cx
push dx
call XlatSmbaWordTo64Kb ;Returns DX=size in 64KB, CF/AH set on error
jc SetMemSizeDone ;Br if error
call FrameBufGetFbBanks ;Returns AX=bit map with SMBA bank set
mov bx, ax
call FrameBufSetSize
xor ah, ah ;AH = error code in case of error
jc SetMemSizeDone ;Br if requested size is invalid
xor ch, ch ;Disable mem at boot
call FrameBufSetCmosData ;Update CMOS with new size
clc ;Indicate success
SetMemSizeDone:
pop dx
pop cx
pop bx
ret
SmbaSetMemSize endp
;---------------------------------------;
; SmbaSetMemHoleOverlap (04) ;
;---------------------------------------;--------------------------------------;
; This function determines if the SMBA shared frame buffer overlaps the memory ;
; hole. The new setting takes effect immediately and is saved into CMOS for ;
; the next boot. ;
; ;
; Input: AL = Function number ;
; BX = Bit 0: If set, frame buffer overlaps memory hole ;
; If clear, frame buffer does not overlap memory hole ;
; Bit 1-15: Reserved ;
; ;
; Output: CF = Clear if function was successful, set if error ;
; AH = If CF set, contains an error code ;
; ;
; Destroys: Nothing ;
;------------------------------------------------------------------------------;
SmbaSetMemHoleOverlap proc near
pusha
call FrameBufSetMemHoleOverlap
mov al, bl ;AL bit 0 = hole overlap setting
and al, 1 ;Clear all other bits
call FrameBufGetCmosData
and ch, 0FEh ;Clear overlap flag
or ch, al ;Set hole overlap flag if needed (bit 1)
call FrameBufSetCmosData
popa
clc ;Indicate success
ret
SmbaSetMemHoleOverlap endp
;---------------------------------------;
; SmbaSetNextBootMemSize (05) ;
;---------------------------------------;--------------------------------------;
; This function sets the size of the SMBA shared frame buffer for the next ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -