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

📄 gxmutil.asm

📁 X86 GX1 BOOTLOAD代码 ,支持WINCE操作系统!
💻 ASM
字号:
;**************************************************************************
;*
;*  GXMUTIL.ASM
;*
;*  Copyright (c) 1998-1999 National Semiconductor Corporation.
;*  All Rights Reserved.
;*
;*  Function:
;*    Initialize the SMM system including the scratchpad space.
;*
;*  $Revision:: 2   $
;*
;**************************************************************************

	.486P

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

_TEXT SEGMENT PUBLIC use16 'CODE'
	EXTERN	CpuRegRead:NEAR
	EXTERN	CpuRegWrite:NEAR
	EXTERN	CpuMemRegRead:NEAR
	EXTERN	CpuMemRegWrite:NEAR
	EXTERN	cpuCacheOff:NEAR
	EXTERN	memTestPinCheck:NEAR

;**************************************************************************
;*
;*	setVideoDramConfig
;*
;*	Set up the amount of Video DRAM. Set MC_GBASE_ADD according to
;*	DRAM top and setup 
;*
;*	Entry:
;*	  EAX = Amount of Video DRAM in 128KB blocks
;*	  BX = Return address
;*
;*	Exit:
;*	  BX = Return address
;*
;*	Destroys:
;*	  ESI, EAX, Upper EBX, ECX, EDX
;*
;**************************************************************************
setVideoDramConfig PROC NEAR PUBLIC
	push	bx

	mov	al, XPVIDEO
	cmp	al, 1
	jne	xpVideoNotInstalled

	mov	si, VID_MEM		; read desired video memory size
	shr	si,2			; translate 128KB units to 512KB units

	mov	ax, CPU_BC_DRAM_TOP
	NOSTACK	bx, CpuMemRegRead 	; Get top of DRAM
	inc	edx				; 
	shr	edx, 19 		; # of 512K blocks

	sub	dx, si			; Reduce by size of video RAM
	and	dx, 07FFh
	mov	ax, CPU_MC_GBASE_ADD
	NOSTACK	bx, CpuMemRegWrite	; Set Graphics base address

	NOSTACK	bx, memTestPinCheck

	shl	edx, 19 		; BC_DRAM_TOP = (MC_GBASE_ADDR - 1) << 19
	dec	edx

	mov	ax, CPU_BC_DRAM_TOP
	NOSTACK	bx, CpuMemRegWrite	; Set top of DRAM to start of video DRAM

	jmp	xpAudioInstalled
xpVideoNotInstalled:	

	mov	ax, XPAUDIO
	cmp	ax, 0
	je	noXPvideoORaudio	; neither installed, get out.

xpAudioInstalled:
	;
	; If audio OR Video is installed, we need a scratchpad
	;

	NOSTACK	dx, cpuCacheOff

	;MAPEN MUST ALREADY BE ENABLED
	mov	al, CPU_GXI_GCR		; Make sure scratchpad size is zero
	NOSTACK	bx, CpuRegRead
	and	al, 03h
	mov	dl, al
	mov	al, CPU_GXI_GCR		; Make sure scratchpad size is zero
	NOSTACK	bx, CpuRegWrite

	mov	al, CPU_CCR3		; Strong read/write ordering in address beyond 1GByte
	NOSTACK	bx, CpuRegRead
	or	al, 0E0h
	mov	dl, al
	mov	al, CPU_CCR3		; Strong read/write ordering in address beyond 1GByte
	NOSTACK	bx, CpuRegWrite

	mov	ax, 0400h
	movzx	eax, ax			; Set scratchpad to 3K
	NOSTACK	bx, cacheScratchPadTagInit	; Initialize the scratchpad tags

noXPvideoORaudio:

	pop	bx 			; Restore return address
	clc
	jmp	bx
setVideoDramConfig ENDP

;**************************************************************************
;*
;*	cacheScratchpadTagInit
;*
;*	Initializes the L1 tags in set 0 to the start address of GX memory
;*	starting at value in AX and going to 4K.
;*
;*	Entry:
;*	  AX = Start Address of Scratchpad
;*	  BX = Return Address
;*
;*	Exit:
;*	  BX = Return Address
;*
;*	Modified:
;*	  EAX, Flags, Upper EBX, ESI
;*
;**************************************************************************
cacheScratchPadTagInit PROC NEAR PUBLIC
	push	ebx
	mov	esi, eax		; Save start address

	mov	al, CPU_GXI_GCR
	NOSTACK	bx, CpuRegRead
	and	eax, 03h
	shl	eax, 30
	mov	TR4, eax		; Set up L1 TAG to point to start of GX space

	mov	eax, esi		; Restore start address
	and	eax, 0FFFFh		; Clear upper half of eax
	or	al, 1			; Set up value to write to TR5

initTagLoop:
	mov	TR5, eax		; Set cache line tag
	add	eax, 10h		; Go to next cache line
	cmp	eax, 1001h
	jb	initTagLoop		; If at top of cache then we are done

gcr3kScratch:
if (SCx1xx_PROCESSOR EQ 0)
	mov	si, 08h			; Else set GCR to 3K
ELSE
	mov	si, 05h			; Else set GCR to 2K
ENDIF	

setGCRScratch:
	mov	al, CPU_GXI_GCR
	NOSTACK	bx, CpuRegRead
	and	al, 03h
	or	ax, si
	mov	dl, al
	mov	al, CPU_GXI_GCR
	NOSTACK	bx, CpuRegWrite		; Set scratch pad size to requested value

set3kBlit:
	mov	ebx, 0FFFFFF0Ch
	mov	eax, 400h
	DB	0Fh, 3ch		; Set BLIT buffer 0 base for 3K

	mov	ebx, 0FFFFFF1Ch
	mov	eax, 0930h
	DB	0Fh, 3ch		; Set BLIT buffer 1 base for 3K

blitSet:
	pop	ebx
	jmp	bx
cacheScratchPadTagInit ENDP

_TEXT ENDS

END

⌨️ 快捷键说明

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