basic.asm

来自「DSP的例程」· 汇编 代码 · 共 62 行

ASM
62
字号
	.title	"TMS320C2xx PROCESSOR SELFCHECK -- BASIC OPERATIONS"
	.length	60
	.width	120
	.option X
************************************************************
* BASIC OPERATIONS TEST                                    *
*                                                          *
* This code checks the basic accumulator load and store    *
* functions, and the SPLK, BCND, and B instructions.       *  
* These operations must work for any of the other tests to *
* be valid.                                                *
*                                                          *
* Written by:                                              *
*                                                          *
* Release Version 1.0                                      *
*                                                          *
************************************************************
	.def	basic
	.nolist
	.copy	"options.h"
	.copy	"memmap.h"
	.list

	.text
basic	.set	$ + SS

; preliminary setup
	LDP	#0h		; data page @ 0h

; test the LACL #k instruction (used to generate error codes)
	LACL	#0ffh		; ACC = ffh (ffh is "All tests passed" code)
	BCND	erbasic,EQ	; if ACC doesn't load then error
	SUB	#0ffh		; subtract
	BCND	erbasic,NEQ	; if ACC != 0 then error

; test LACC and SACL instruction
	LACC	#0aaaah		; ACC = aaaah
	BCND	erbasic,EQ	; if ACC doesn't load then error
	SACL	TEMP00		; save to memory
	SUB	TEMP00		; subtract
	BCND	erbasic,NEQ	; if ACC != 0 then error

; test the SPLK instruction
	SPLK	#5555h,TEMP00	; data(TEMP00) = 5555h
	LACC	TEMP00		; ACC = 5555h
	SUB	#5555h		; subtract
	BCND	basic1,EQ	; if ACC = 0 then NO error (BCND branches)

erbasic	.set	$+SS

	LACL	#10h		; basic operations general error
	RET			; test fails

basic1	.set	$+SS

	B	basic2		; test B instruction
	LACL	#11h		; basic operations B instruction error

basic2	.set	$+SS        

	RET			; test passes

⌨️ 快捷键说明

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