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

📄 chkmem.asm

📁 银杏科技有限公司dsp实验开发板的实验程序
💻 ASM
字号:
     .title " test des5402pp-u' ext_mem"
     .global _chk_prog28000,_chk_data8000,_CtrlWord,_chk_prog18000
     .mmregs

     .text
;---------------------------------------------------------
;  The following function to check data 8000h !
;  first write 0,1,2,...,0x7fff, then read and compare !
;---------------------------------------------------------
     
_chk_data8000:     
     pshm   bh
     pshm   bl
     pshm   ar0
         
     frame 	-2
     nop
     
     orm	#02h,*(_CtrlWord)
     portw	*(_CtrlWord),8000h	;  enable data sram in 8000h
     
     stm 	#8000h,ar0       ;  8000h -->  ar0
	 xor	a,a				 ;  0 -- >  a
	 stm 	#7fffh, BRC      ;  repeat  8000h times
     st     #0,0h
     rptb	w8_again-1 
     stl    a,*ar0+    		 ;  write 0,1,2,3,...,7fffh
     add    #1,a
w8_again:
     nop
     
     xor    a,a       		 ;  0h -->  a
     stm	#8000h,ar0		 ;  8000h --> ar0
	 stm 	#7fffh, BRC      ;  repeat  8000h times
     xor    b,b 			 ;  0  --> b
     rptb	r8_again-1 
     ld  	a,b
     nop
     nop
     sub 	*ar0+,b 			 ;  read data compare with b
     bc		error_ret,bneq	     ;  if not equal, return !
     add    #1,a,a
r8_again:
     nop
     ld 	#1,a
     b		ok_ret
error_ret:   				 ; if error return, a is error address !
     ldm    ar0,a
     sub    #1,a 	 		 ; 
ok_ret:
     popm   ar0
     popm   bl
     popm 	bh
     
     frame  2
     ret


;---------------------------------------------------------
;  The following function to check prog 28000h !
;  first write 0,1,2,...,0x7fff, then read and compare !
;---------------------------------------------------------
     
_chk_prog28000:     
     pshm   bh
     pshm   bl
         
     frame 	-2
     nop
     
     ld 	#2800h,4,a       ;  28000h -->  a
	 stm 	#7fffh, BRC      ;  repeat  8000h times
     st     #0,0h
     rptb	w28_again-1 
     writa  0h       		 ;  write 0,1,2,3,...,7fffh
     addm   #1,0h
     add    #1,a
w28_again:
     nop
     
     ld 	#2800h,4,a       ;  28000h -->  a
	 stm 	#7fffh, BRC      ;  repeat  8000h times
     xor    b,b 			 ;  0  --> b
     st		#0,1h
     rptb	r28_again-1 
     reada  0h       		 ;  read program 28000h
     ld  	1h,b
     nop
     nop
     sub 	0h,b 			 ;  read data --->  b
     bc		error_ret1,bneq	 ;  if not equal, return !
     addm   #1,1h
     add    #1,a,a
r28_again:
     nop
     ld 	#1,a
error_ret1:   				 ; if error return, a is error address !
     stl 	a,0h 	 		 ; remove ah when return
     nop
     nop
     ld  	0h,a
     popm   bl
     popm 	bh
     
     frame  2
     ret

;---------------------------------------------------------
;  The following function to check prog 18000h ! only last 16k
;  first write 0,1,2,...,0x3fff, then read and compare !
;---------------------------------------------------------
     
_chk_prog18000:     
     pshm   bh
     pshm   bl
         
     frame 	-2
     nop
     
     ld 	#1C00h,4,a       ;  1C000h -->  a
	 stm 	#3fffh, BRC      ;  repeat  8000h times
     st     #0,0h
     rptb	w18_again-1 
     writa  0h       		 ;  write 0,1,2,3,...,7fffh
     addm   #1,0h
     add    #1,a
w18_again:
     nop
     
     ld 	#1C00h,4,a       ;  28000h -->  a
	 stm 	#3fffh, BRC      ;  repeat  8000h times
     xor    b,b 			 ;  0  --> b
     st		#0,1h
     rptb	r18_again-1 
     reada  0h       		 ;  read program 28000h
     ld  	1h,b
     nop
     nop
     sub 	0h,b 			 ;  read data --->  b
     bc		error_ret2,bneq	 ;  if not equal, return !
     addm   #1,1h
     add    #1,a,a
r18_again:
     nop
     ld 	#1,a
error_ret2:   				 ; if error return, a is error address !
     stl 	a,0h 	 		 ; remove ah when return
     nop
     nop
     ld  	0h,a
     popm   bl
     popm 	bh
     
     frame  2
     ret
    
     .end 

⌨️ 快捷键说明

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