📄 dmi.inc
字号:
GetDMIInfo:
pushad
call ClearScreen
call CheckSMBiosPresent
jc SMBIOSabsent
;Hide Cursor
mov cx,200eh
call SetCursorType
mov si,offset cs:DMIHeadAttribTbl
mov cx,NoDMIHeadAttribTbl
WinAttrDMI:
push cx
mov dx,cs:[si+4]
mov cx,cs:[si+2]
mov bx,cs:[si]
call SetWindowsAttribute
add si,6
pop cx
loop WinAttrDMI
mov dx,HeaderPosition
call SetCursor
lea si,DMIHeadString
call DisPlayString
call DisplaySMBIOSVersion
call ViewSMBIOSHandleData
jmp short ExitDMIViewer
SMBIOSabsent:
call DisplaySMNoSupport
ExitDMIViewer:
lea di,SubFuncSelect
mov al,0ffh
mov ds:[di],al
popad
ret
;----------------------------------------------------------------
ViewSMBIOSHandleData:
pushad
push es
BeginHandle:
lea si,DMIDataSegment
mov ax,ds:[si]
mov es,ax
lea si,DMIDataOffset
mov di,ds:[si]
mov ax,di
mov ax,0
lea si,NowHandlerNo
mov ds:[si],ax
LoopViewDMIData:
call DisplayHandlerTypeSize
call GetCursor
mov cx,0
mov ch,dh
inc ch
mov dh,24
mov dl,79
mov bh,((Blue) shl 4)+ BrightWhite
call ClearWindowsCharAttribute
movzx bx,byte ptr es:[di] ; Get type
mov si,offset cs:DMIDataViewTBL
shl bx,1
add si,bx
call word ptr cs:[si]
call WaitOneKey
lea si,SearchFlag
mov ah,ds:[si]
cmp ah,KeyPgDn
jnz @f
lea si,NowHandlerNo
mov ax,ds:[si]
inc ax
mov ds:[si],ax
call NextPoint
jnc PointToNext
jmp short BeginHandle
PointToNext:
jmp LoopViewDMIData
@@:
pop es
popad
ret
;----------------------------------------------------------------
DisplayHandlerTypeSize:
;Input: ES:DI structure start point
;DisplayHandlerData
mov dx,SMBiosHandlerPosn
call SetCursor
mov ax,es:[di+2]
xchg ah,al
call DisplayHex
xchg ah,al
call DisplayHex
;DisplayType
mov dx,SMBiosTypePosn
call SetCursor
mov al,es:[di]
call DisplayHex
;DisplayLehgth
mov dx,SMBiosSizePosn
call SetCursor
mov al,es:[di+1]
call DisplayHex
ret
;----------------------------------------------------------------
NextPoint:
mov al,byte ptr es:[di]
cmp al,7fh
jz EndOfSMBIOS
movzx ax,byte ptr es:[di+1]
add di,ax
CheckDoubleZero:
mov al,byte ptr es:[di]
cmp al,00h
jnz ForwaorPoint
inc di
mov al,byte ptr es:[di]
cmp al,00h
jz IncPoint
ForwaorPoint:
inc di
jmp short CheckDoubleZero
IncPoint:
inc di
clc
ret
EndOfSMBIOS:
stc
ret
;----------------------------------------------------------------
DisplaySMBIOSVersion:
push ax
mov dx,SMBiosVersionPosn
call SetCursor
push es
mov ax,0f000h
mov es,ax
lea di,SMStringAddr
mov si,ds:[di]
mov al,es:[si+06h]
add al,30h
call DisplayChar
mov al,'.'
call DisplayChar
mov al,es:[si+07h]
add al,30h
call DisplayChar
pop es
pop ax
ret
;----------------------------------------------------------------
DisplaySMNoSupport:
mov dx,0618h
call SetCursor
lea si,NotSupportSM
mov bl,(White shl 4)+Red
call DisplayStringAttrib
call WaitOneKey
ret
;----------------------------------------------------------------
CheckSMBiosPresent:
push es
mov ax,0f000h
mov es,ax
mov cx,0fff0h
xor di,di
LoopCheckSM:
mov ah,es:[di]
cmp ah,'_'
jnz LoopCheckSMLabel
mov ah,es:[di+1]
cmp ah,'S'
jnz LoopCheckSMLabel
mov ah,es:[di+2]
cmp ah,'M'
jnz LoopCheckSMLabel
mov ah,es:[di+3]
cmp ah,'_'
jz SMBIOSSupport
LoopCheckSMLabel:
inc di
loop LoopCheckSM
jmp NoMIDataFound
SMBIOSSupport:
lea si,SMStringAddr
mov ds:[si],di
;Check DMI string
mov cx,0fff0h
xor di,di
LoopCheckDMI:
mov ah,es:[di]
cmp ah,'_'
jnz LoopCheckDMILabel
mov ah,es:[di+1]
cmp ah,'D'
jnz LoopCheckDMILabel
mov ah,es:[di+2]
cmp ah,'M'
jnz LoopCheckDMILabel
mov ah,es:[di+3]
cmp ah,'I'
jnz LoopCheckDMILabel
mov ah,es:[di+4]
cmp ah,'_'
jz DMIBIOSSupport
LoopCheckDMILabel:
inc di
loop LoopCheckDMI
jmp NoMIDataFound
DMIBIOSSupport:
lea si,DMIStringAddr
mov ds:[si],di
lea si,SMStringAddr
mov di,ds:[si]
lea si,DMIDataSegment
xor ax,ax
mov al,es:[di+1ah]
shl ax,12
mov ds:[si],ax
lea si,DMIDataOffset
mov ax,es:[di+18h]
mov ds:[si],ax
clc
jmp short CheckSMBiosPresentExit
NoMIDataFound:
stc
CheckSMBiosPresentExit:
pop es
ret
;----------------------------------------------------
; Input : AL
; SI
DisplayBiosCharacter:
mov cx,8
LoopDisplayBiosCharacter:
push cx
test al,01h
jz NoDisplayCharacter
push si
call DisplayString
call GetCursor
cmp dl,40
jbe SameRow
lea si,crlf
call DisplayString
jmp short NewType0Cursor
SameRow:
mov dl,40
call SetCursor
NewType0Cursor:
pop si
NoDisplayCharacter:
pop cx
shr al,1
add si,35
loop LoopDisplayBiosCharacter
ret
;----------------------------------------------------
DisplayBIOSCharacterS:
mov al,byte ptr es:[di+0ah]
lea si,BIOSCharactDef
call DisplayBiosCharacter
mov al,byte ptr es:[di+0bh]
lea si,BIOSCharactDef1
call DisplayBiosCharacter
mov al,byte ptr es:[di+0ch]
lea si,BIOSCharactDef2
call DisplayBiosCharacter
mov al,byte ptr es:[di+0dh]
lea si,BIOSCharactDef3
call DisplayBiosCharacter
ret
;----------------------------------------------------
DisplayBIOSCharacterExt:
mov al,byte ptr es:[di+12h]
lea si,BIOSExtCharB1
call DisplayBiosCharacter
mov al,byte ptr es:[di+13h]
lea si,BIOSExtCharB2
call DisplayBiosCharacter
ret
;----------------------------------------------------
;Input: si
DisplayDMIDataByBit:
mov cx,8
LoopDisplayDMIDataByBit:
push cx
test al,01h
jz NoDisplayBits
push si
call DisplayString
pop si
NoDisplayBits:
pop cx
shr al,1
push ax
GoNextsi:
inc si
mov al,ds:[si]
cmp al,0
jnz GoNextsi
inc si
pop ax
loop LoopDisplayDMIDataByBit
ret
;----------------------------------------------------
DMIChangeCursorAttribute:
push dx
lea si,BIOSCharExtPosn
cmp dx,ds:[si]
jz incbar
dec dh
jmp short RestoreType0Bar
incbar:
inc dh
RestoreType0Bar:
call CalaFixedCursorposn ; AX=First Posn
mov bx,ax
push ds
mov ax,0b800h
mov ds,ax
DMIPreCheckType0BarLoop:
mov al,Cyan+(Blue shl 4)
mov ds:[bx+1],al
mov al,ds:[bx]
cmp al,'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -