Japanese
HARDWARE ManualSCU User's Manual
BackForward

SCU DSP Assembler Instruction Manual

'94/07/08

table of contents

1. Assembler functions
2. Executing assembler
3. Program description format
4. Command list
5. Sample program

1. Overview of assembler functions

This assembler is for generating instruction codes for DSP, and is intended to run on MS-DOS and UNIX. The output code is directly output in Motorola's S format, so there is no need to link.
The DSP assembler requires a lot of knowledge about the hardware, so please deepen your understanding of the DSP hardware before using the assembler.

2. Executing assembler

dspasm [option]< source file name>
  1. The options can be specified as follows: (The file is created only when it ends normally)
    -l[file name]: List output specification
    -a[file name] : Data format output specification for SH assembler
    -c[file name]: C language data format output specification
    -m: Specify when using MODEL M development environment
  2. Source file names have no default extension.
  3. Only the first error detected will be displayed, so please repeat the correction and assembly until the error no longer occurs.

3. Program description format

[Label] [△Operation [△Operand]]…[Comment]
Example: LABEL: MOV MC0,X ; Comment

(1) Label

(2) Operation

(3) Operand

(4) Comments

* Notes on description * About reserved words * About numerical operations

Arithmetic relationship

+ … addition
- … Subtraction
* … Multiplication
/ … division
% … Remainder
‾ … bit negation
& … bit product
| … bit sum
^ … Exclusive bitwise sum
<< … left shift
>> … right shift

Priority

1. + - ~ (unary operator)
2. * / %
3. + -
4.<<>>
5. &
6. | ^

4. Command list

  1. Arithmetic instruction
    NOP AND OR XOR ADD SUB AD2 SR RR SL RL RL8 CLR MOV
  2. Load immediate instruction
    MVI
  3. DMA command
    DMA DMAH
  4. JUMP instruction
    JMP
  5. LOOP BOTTOM instruction
    BTM LPS
  6. END command
    END ENDI

pseudo-instruction

5. Sample program

(1) When copying the contents of internal RAM 0 of the DSP to internal RAM 1.

; ------- sample (1) start -------

COPY_SIZE  =  12          ; Copy size
RAM0_ADR   = $00          ; Copy source address
RAM1_ADR   = $00          ; Copy destination address

	MOV RAM0_ADR,CT0      ; Set the copy source address of RAM0
	MOV RAM1_ADR,CT1      ; Set the copy destination address of RAM1
	MOV COPY_SIZE-1,LOP   ; Set transfer size - 1 to LOP register
	LPS                   ; Execute 1-instruction loop
	MOV MC0,MC1           ; Transfer from RAM0 to RAM1
	ENDI

; ------- sample (1) end -------

(2) When calculating 2 x 3 + 4 x 5. (RAM0 x RAM1 + RAM0 x RAM1 = RAM2) (Sample 2b is an optimized version of 2a.)

; ------- sample (2a) start -------

RAM0_ADR   = $00          ; 2, 4 Storage address first
RAM1_ADR   = $00          ; 3, 5 Storage address first
RAM2_ADR   = $00          ; Result storage address

	MOV RAM0_ADR,CT0   ; Set RAM0 address
	MOV RAM1_ADR,CT1   ; Set RAM1 address
	MVI #2,MC0         ; Set "2" to RAM0
	MVI #3,MC1         ; Set "3" to RAM1
	MVI #4,MC0         ; Set "4" to RAM0
	MVI #5,MC1         ; Set "5" to RAM1
	MOV RAM0_ADR,CT0   ; Set the address of RAM0
	MOV RAM1_ADR,CT1   ; Set the address of RAM1
	MOV RAM2_ADR,CT2   ; Set the address of RAM2
	MOV MC0,X          ; Transfer data from RAM0 to RX
	MOV MC1,Y          ; Transfer data from RAM1 to RY
	MOV MUL,P          ; Store the integration results of RX and RY in PH,PL
	MOV MC0,X          ; Transfer data from RAM0 to RX
	MOV MC1,Y          ; Transfer data from RAM1 to RY
	CLR A              ; Set "0" to ACH,ACL
	AD2 MOV ALU,A      ; Store the addition result of PH,PL and ACH,ACL in ACH,ACL
	MOV MUL,P          ; Store the integration result of RX and RY in PH,PL
	AD2 MOV ALL,MC2    ; Store the addition result of PH, PL and ACH, ACL in RAM2
	ENDI

; ------- sample (2a) end -------
; ------- sample (2b) start -------

RAM0_ADR   =  $00          ; 2, 4 Storage address first
RAM1_ADR   =  $00          ; 3, 5 Storage address first
RAM2_ADR   =  $00          ; Result storage address

	                                                 MOV RAM0_ADR,CT0
	                                                 MOV RAM1_ADR,CT1
	MVI #2,MC0
	MVI #3,MC1
	MVI #4,MC0
	MVI #5,MC1
	                                                 MOV RAM0_ADR,CT0
	                                                 MOV RAM1_ADR,CT1
	     MOV MC0,X             MOV MC1,Y             MOV RAM2_ADR,CT2
	     MOV MC0,X  MOV MUL,P  MOV MC1,Y  CLR A
	AD2             MOV MUL,P             MOV ALU,A
	AD2                                              MOV ALL,MC2
	ENDI

; ------- sample (2b) end -------

(3) When calculating movement processing for a matrix. (RAM0×RAM1=RAM2)

 /M00 M01 M02 M03\  /100x\     /M00 M01M02 M03\
| M10 M11 M12 M13 || 010y | → | M10 M11M12 M13 |
 \M20 M21 M22 M23/ | 001z |    \M20 M21M22 M23/
                    \0001/

; ------- sample (3) start -------

DATA_TOP   =  $10000 >> 2       ; External memory address is in 4-byte units
MAT_SIZE   =  $0C               ; Array size
RAM0_ADR   =  $00               ; Start address for storing X, Y, Z movement amount
RAM1_ADR   =  $00               ; Array work address
RAM2_ADR   =  $00               ; Original array address

; (Transfer the array with the movement amount set from external memory to RAM0)
;
	MVI DATA_TOP,RA0
	                                                 MOV RAM0_ADR,CT0
	DMA D0,MC0,#$02
;
; (Copying the array to be operated from RAM2 to RAM1)
	                                                 MOV RAM2_ADR,CT2
	                                                 MOV RAM1_ADR,CT1
	                                                 MOV MAT_SIZE-1,LOP
	LPS
	                                                 MOV MC2,MC1
WAITING:
	JMP T0,WAITING
;
; (Execute array calculation)
	                                                 MOV RAM0_ADR,CT0
	                                                 MOV RAM1_ADR,CT1
	     MOV MC0,X             MOV MC1,Y 
	     MOV MC0,X  MOV MUL,P  MOV MC1,Y  CLR A
	AD2  MOV MC0,X  MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV RAM0_ADR,CT0
	AD2             MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV #1,RX
	AD2  MOV MC0,X  MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV RAM2_ADR+3,CT2
	AD2  MOV MC0,X  MOV MUL,P  MOV MC1,Y  CLR A      MOV ALL,MC2
	AD2  MOV MC0,X  MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV RAM0_ADR,CT0
	AD2             MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV #1,RX
	AD2  MOV MC0,X  MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV RAM2_ADR+7,CT2
	AD2  MOV MC0,X  MOV MUL,P  MOV MC1,Y  CLR A      MOV ALL,MC2
	AD2  MOV MC0,X  MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV RAM0_ADR,CT0
	AD2             MOV MUL,P  MOV MC1,Y  MOV ALU,A  MOV #1,RX
	AD2             MOV MUL,P             MOV ALU,A  MOV RAM2_ADR+11,CT2
	AD2                                              MOV ALL,MC2
	ENDI

; ------- sample (3) end -------
that's all
BackForward
HARDWARE ManualSCU User's Manual