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

📄 spd.asm

📁 X86 GX1 BOOTLOAD代码 ,支持WINCE操作系统!
💻 ASM
字号:
;**************************************************************************
;*
;*  SPD.ASM
;*
;*  Copyright (c) 1999 National Semiconductor Corporation.
;*  All Rights Reserved.
;*
;*  Function:
;*    Support routines for reading the SPD on SDRAM.
;*
;*  $Revision:: 1    $
;*
;**************************************************************************

	;.MODEL TINY
	.486P

	INCLUDE DEF.INC
	INCLUDE MACROS.INC
	INCLUDE PORT80.INC
	INCLUDE CPU.INC

_TEXT SEGMENT PUBLIC use16 'CODE'

	EXTERN	csGetSPDByte:NEAR

;**************************************************************************
;*
;*	CpumSDRAMReadSPD -
;*
;*	This routine reads the first 64 bytes of the serial EEPROM
;*	and places the contents on the stack.  It also performs
;*	a checksum on the buffer.
;*
;*	Entry:
;*	  BX = DIMM address
;*	  BP = Points to head of buffer for SPD bytes
;*
;*	Exit:
;*	  BP - Points to head of buffer
;*	  Carry:  set if error, clear of success
;*
;*	Destroys:
;*
;**************************************************************************
CpumSDRAMReadSPD PROC NEAR PUBLIC
	push	bx
	push	cx
	push	di
	push	si

	mov	si,bx			; save chip address in si
	mov	cx,0
	call	csGetSPDByte
	jc	badRead

	cmp	bx,CHECKSUM_BYTE	; would like to have 64 bytes
	jb	noCheckSum

	xor	cx,cx			; start reading at Byte 0
	mov	di,cx
fillBuffer:
	push	si			; save the chip address
	mov	bx,si			; bx will be destroyed
	mov	cx,di
	call	csGetSPDByte		; read byte is in BL
	pop	si			; restore the chip address
	jc	badRead
	mov	BYTE PTR[bp+di],bl
	inc	di
	cmp	di,SIZE_SPDBUF-1
	jbe	fillBuffer
	clc				; at this point read 64 bytes
	call	CpumSDRAMChecksumSPD	; verify the checksum
	jnc	goodRead

noCheckSum:
badRead:
	stc
goodRead:
	pop	si
	pop	di
	pop	cx
	pop	bx
	ret
CpumSDRAMReadSPD ENDP

;**************************************************************************
;*
;*	CpumSDRAMChecksumSPD -
;*
;*	This routine verifies the checksum of the EEPROM 
;*
;*	Entry:
;*	  BX -  DIMM address
;*	  BP -  Points to head of buffer for SPD bytes
;*
;*	Exit:
;*	  Carry - set if error, clear if checksum in good
;*	  AL - contains computed checksum
;*
;*	Destroys:
;*	  AX
;*
;**************************************************************************
CpumSDRAMChecksumSPD PROC NEAR PUBLIC
	push	cx
	push	si

	xor	ax,ax
	xor	si,si
	mov	cx,SIZE_SPDBUF-1	; add Bytes 0-62
addloop:
	add	al,[bp+si]
	inc	si
	loop addloop

	cmp	al,[bp+63]		; the addition should = Byte 63
	je	goodCheck
	stc
	jmp	endCheck

goodCheck:
	clc

endCheck:
	pop	si
	pop	cx
	ret
CpumSDRAMChecksumSPD ENDP


_TEXT ENDS

	END

⌨️ 快捷键说明

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