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

📄 smb_fcn.asm

📁 This program displays all SMBIOS/DMI information within the BIOS. The information is organized as a
💻 ASM
📖 第 1 页 / 共 5 页
字号:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

	lclPROLOG SMB_STR	; Address local vars

	pushad			; Save all EGP registers

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	si,[bp].SMBarg.argSMB_START ; Get struc start
	add	si,[bp].SMBarg.argSMB_OFFS  ; Plus struc offset

	push	fs:[si].EDQLO	; Pass the low-order dword
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_PID ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+4	; Strip arguments from stack

	push	ds		; Pass ptr to format string
	push	offset ds:MSG_FET ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4		; Strip arguments from stack

	push	ds		; Pass ptr to string
	push	offset DGROUP:MSG_FET ; ...
	call	StrLen		; Return with string length in AX

	mov	edi,fs:[si].EDQHI ; Get the feature contents
	lea	bx,SMB4_FET_TAB ; Get offset in DGROUP of REC_MACs
	call	DispRecord	; Display the record contents in EDI
				; using DS:BX ==> REC_MACs, AX = indent
	clc			; Mark as successful

	popad			; Restore

	lclEPILOG SMB_STR	; Strip local vars and return

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_PID endp			; End SMB_PID procedure
	NPPROC	SMB_SID -- Display A Slot ID
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display a Slot ID from FS.

On entry:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

	lclPROLOG SMB_STR	; Address local vars

	pusha			; Save all GP registers

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	si,[bp].SMBarg.argSMB_START ; Get struc start
	mov	bx,[bp].SMBarg.argSMB_OFFS  ; ...	offset

	movzx	ax,fs:[si].SMB9_TYPE ; Get type, zero to use as word
	xor	di,di		; Initialize index into table
@@:
	cmp	SMB9_TYPE_ACT[di].TYPE_ACT_NUM,-1 ; Izit end-of-table?
	je	near ptr SMB_SID_NONE ; Jump if so

	cmp	ax,SMB9_TYPE_ACT[di].TYPE_ACT_NUM ; Duzit match?
	je	short @F	; Jump if so

	add	di,type TYPE_ACT_STR ; Skip to next entry

	jmp	short @B	; Go around again


@@:
	jmp	SMB9_TYPE_ACT[di].TYPE_ACT_ACT ; Take appropriate action


	public	SMB_SID_MCA
SMB_SID_MCA:

; The value in the slot ID field is the MCA slot # (range 1-15)

	push	fs:[bx+si].ELO	; Pass the MCA slot #
	push	fs:[bx+si].ELO	; ...	   Slot ID
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_SID_MCA ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+2+2	; Strip arguments from stack

	jmp	SMB_SID_DONE	; Join common done code


	public	SMB_SID_EISA
SMB_SID_EISA:

; The value in the slot ID field is the EISA slot # (range 1-15)

	push	fs:[bx+si].ELO	; Pass the EISA slot #
	push	fs:[bx+si].ELO	; ...	   Slot ID
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_SID_EISA ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+2+2	; Strip arguments from stack

	jmp	SMB_SID_DONE	; Join common done code


	public	SMB_SID_PCI,SMB_SID_AGP,SMB_SID_PCIX
SMB_SID_PCI:
SMB_SID_AGP:
SMB_SID_PCIX:

; The value in the slot ID field corresponds to an entry in the PCI
; Interrupt Routing Table.

	mov	dx,fs:[bx+si].ELO ; Get the Slot ID

; Lookup the Slot ID in the Slot # field of the IRQ Routing Table

	mov	cx,RouteBuffer.PCI_RB_SIZE ; Get the table size
	jcxz	@F		; Jump if it's empty

	shr	cx,4-0		; Convert from bytes to PCI_DB_STR
	xor	bx,bx		; Initialize index into DataBuffer
SMB_SID_PCI_NEXT:
	cmp	dl,DataBuffer[bx].PCI_DB_SLOT ; Izit this slot?
	je	short SMB_SID_PCI_OK ; Jump if so

	add	bx,type PCI_DB_STR ; Skip to next entry

	loop	SMB_SID_PCI_NEXT ; Jump if more entries
@@:

; Display error message

	push	dx		; Pass the Slot ID
	push	dx		; ...
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_SID_PCI_XTAB ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+2+2	; Strip arguments from stack

	jmp	SMB_SID_DONE	; Join common done code


; Format the PCI IRQ Routing information in DataBuffer[bx]

SMB_SID_PCI_OK:
	movzx	ax,DataBuffer[bx].PCI_DB_SLOT	; Get  the slot #
	push	ax				; Pass ...
	push	DataBuffer[bx].PCI_DB_BM_D	; ...  the IRQ bitmap for INTD#
	movzx	ax,DataBuffer[bx].PCI_DB_LV_D	; Get  the link value for INTD#
	push	ax				; Pass ...
	push	DataBuffer[bx].PCI_DB_BM_C	; ...  the IRQ bitmap for INTC#
	movzx	ax,DataBuffer[bx].PCI_DB_LV_C	; Get  the link value for INTC#
	push	ax				; Pass ...
	push	DataBuffer[bx].PCI_DB_BM_B	; ...  the IRQ bitmap for INTB#,
	movzx	ax,DataBuffer[bx].PCI_DB_LV_B	; Get  the link value for INTB#
	push	ax				; Pass ...
	push	DataBuffer[bx].PCI_DB_BM_A	; ...  the IRQ bitmap for INTA#,
	movzx	ax,DataBuffer[bx].PCI_DB_LV_A	; Get  the link value for INTA#
	push	ax				; Pass ...
	movzx	ax,DataBuffer[bx].PCI_DB_DEVNO	; Get the device #
	push	ax				; Pass ...
	movzx	ax,DataBuffer[bx].PCI_DB_BUSNO	; Get the bus #
	push	ax				; Pass ...
	push	dx				; ...  the Slot ID

	push	ds		; ...  ptr to format string
	push	offset ds:MSG_SID_PCI_TAB ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+2*12	; Strip arguments from stack

	jmp	short SMB_SID_DONE ; Join common done code


	public	SMB_SID_PCMCIA
SMB_SID_PCMCIA:
	push	fs:[bx+si].ELO	; Pass the Adapter # & Socket #
				; Note the digits are printed in reverse order
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_SID_PCMCIA ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+2	; Strip arguments from stack

	jmp	short SMB_SID_DONE ; Join common done code


SMB_SID_NONE:
	push	fs:[bx+si].ELO	; Pass the Slot ID
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_SID_NONE ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+2	; Strip arguments from stack
SMB_SID_DONE:
	clc			; Mark as successful

	popa			; Restore

	lclEPILOG SMB_STR	; Strip local vars and return

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_SID endp			; End SMB_SID procedure


SMB_HEXNN macro NN

	NPPROC	SMB_HEX&NN -- Display A Hex NN Bytes
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display a Hex NN Bytes from FS.

On entry:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

	lclPROLOG SMB_STR	; Address local vars

	pusha			; Save all GP registers

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	si,[bp].SMBarg.argSMB_START ; Get struc start
	add	si,[bp].SMBarg.argSMB_OFFS  ; Plus struc offset

	mov	cx,NN		; Get # bytes to display
	lea	di,MSG_HEX&NN	; DS:DI ==> output save area
@@:
	lods	fs:[si].LO	; Get the next byte
	call	DB2HEX		; Convert AL to ASCII starting at DS:DI

	loop	@B		; Jump if more bytes to format

	push	ds		; Pass ptr to string
	push	offset ds:MSG_HEX&NN ; ...
	call	DispASCIIZ	; Display ASCIIZ string

	clc			; Mark as successful

	popa			; Restore

	lclEPILOG SMB_STR	; Strip local vars and return

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_HEX&NN endp 		; End SMB_HEX&NN procedure

	endm			; SMB_HEXNN


	SMB_HEXNN   6
	SMB_HEXNN   9
	SMB_HEXNN  15
	SMB_HEXNN  16


	NPPROC	SMB_ROMSIZE -- Display A ROM Size
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display a ROM Size from FS.

On entry:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

	lclPROLOG SMB_STR	; Address local vars

	pushad			; Save all EGP registers

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	di,[bp].SMBarg.argSMB_START ; Get struc start
	mov	bx,[bp].SMBarg.argSMB_OFFS  ; ...	offset
	movzx	eax,fs:[bx+di].LO ; Get the ROM Size(n) as 64KB*(n+1)
	inc	eax		; Convert to origin-1
	mov	ecx,eax 	; Copy to convert to KB
	shl	ecx,16-10	; Convert from 64KB to 1KB
	shl	eax,16-0	; Convert from 64KB to bytes

	push	ecx		; Pass the decimal dword to format
	push	eax		; ...	   hex
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_ROMSIZE ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+4+4	; Strip arguments from stack

	clc			; Mark as successful

	popad			; Restore

	lclEPILOG SMB_STR	; Strip local vars and return

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_ROMSIZE endp		; End SMB_ROMSIZE procedure
	NPPROC	SMB_MODSIZE -- Display A Module Size
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display a Module Size from FS.

On entry:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

	lclPROLOG SMB_STR	; Address local vars

	pushad			; Save all EGP registers

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	di,[bp].SMBarg.argSMB_START ; Get struc start
	mov	bx,[bp].SMBarg.argSMB_OFFS  ; ...	offset
	mov	cl,fs:[bx+di].LO ; Get the Module Size(n) as 2**n
	mov	eax,1		; Set strobe bit
	shl	eax,cl		; Calculate 2**n

	push	eax		; Pass the decimal dword to format
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_MODSIZE ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+4	; Strip arguments from stack

	clc			; Mark as successful

	popad			; Restore

	lclEPILOG SMB_STR	; Strip local vars and return

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_MODSIZE endp		; End SMB_MODSIZE procedure
	NPPROC	SMB_ENUM -- Display An Enumerated Value
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display an Enumerated Value in FS.

On entry:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

	lclPROLOG SMB_STR	; Address local vars

	pusha			; Save all GP registers

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	si,[bp].SMBarg.argSMB_START ; Get struc start
	add	si,[bp].SMBarg.argSMB_OFFS  ; Plus struc offset

	mov	bx,[bp].SMBarg.argSMB_SPC1 ; DS:BX ==> ENUM_STR

	movzx	ax,fs:[si].LO	; Get the enumerated value, zero to use as word
	call	DispEnum	; Display enumerated value AX in DS:BX ==> ENUM_STRs

	clc			; Mark as successful

	popa			; Restore

	lclEPILOG SMB_STR	; Strip local vars and return

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_ENUM endp			; End SMB_ENUM procedure
	NPPROC	DispEnum -- Display Enumerated Value
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display enumerated value

On entry:

AX	=	value
DS:BX	==>	ENUM_STRs

|

	pusha			; Save all GP registers
DispEnumNext:
	cmp	ds:[bx].ENUM_NUM,-1 ; Izit the end?
	je	short DispEnumNotf ; Jump if so

	cmp	ax,ds:[bx].ENUM_NUM ; Duzit match?
	je	short DispEnumDone ; Jump if so

	add	bx,type ENUM_STR ; Skip to next struc

	jmp	DispEnumNext	; Go around again


DispEnumNotf:
	push	ax		; Pass the hex word to format
	push	ds		; ...  ptr to format string
	push	offset ds:MSG_ENUMNOTF ; ...
	push	lpOutput	; ...  ptr to output routine
	call	RPRINTF16	; Rprintf it, return with AX = # chars printed
	add	sp,4+4+2	; Strip arguments from stack

	jmp	short DispEnumExit ; Join common exit code


DispEnumDone:
	push	ds		; Pass ptr to string
	push	ds:[bx].ENUM_TXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string

	push	ds		; Pass ptr to string
	push	offset ds:M

⌨️ 快捷键说明

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