;************************************************************************************* ;A simple program: calculating the sum of products ;************************************************************************************* PBASE EQU $100 ;instruct the assembler to replace every occurence ;of PBASE with $100 XBASE EQU $0 ;used to define the position of the data in X memory YBASE EQU $0 ;used to define the position of the data in Y memory ;************************************************************************************* ;X memory ;************************************************************************************* org x:XBASE ;instructs the assembler that we are referring to X ;memory starting at location XBASE list1 dc $475638,$738301,$92673a,$898978,$091217,$f25067 dc $987153,$3A8761,$987237,$34b852,$734623,$233763 dc $f76756,$423423,$324732,$f40029 ;************************************************************************************* ;Y memory ;************************************************************************************* org y:YBASE ;instructs the assembler that we are referring to Y ;memory starting at location YBASE list2 dc $f98734,$800000,$fedcba,$487327,$957572,$369856 dc $247978,$8a3407,$734546,$344787,$938482,$304f82 dc $123456,$657784,$567123,$675634 ;************************************************************************************* ;Program ;************************************************************************************* org p:0 ;put following program in program memory ;starting at location 0 jmp begin ;p:0 is the reset vector i.e. where the DSP looks for ;instructions after reset org p:PBASE ;start the main program at p:PBASE begin move #list1,r0 ;set up pointer to start of list1 move #list2,r4 ;set up pointer to start of list2 clr a ;clear accumulator a move x:(r0)+,x0 y:(r4)+,y0 ;load the value of X memory pointed to by the contents ;of r0 into x0 and post-increment r0 ;load the value of Y memory pointed to by the contents ;of 4 into y0 and post-increment r4 do #15,endloop ;do 15 times mac x0,y0,a x:(r0)+,x0 y:(r4)+,y0 ;multiply and accumulate, and load next values endloop jmp * ;this is equivalent to label jmp label ;and is therefore a never-ending, empty loop ;************************************************************************************** ;END OF THE SIMPLE PROGRAM ;**************************************************************************************