;************************************************************* ;A SIMPLE PROGRAM: CALCULATING THE SUM OF PRODUCTS ;************************************************************* nolist include 'ioequ.asm' list PBASE EQU $100 ;instruct the assembler to replace ;every occurrence of PBASE with $200 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,$091271,$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 START ;p:0 is the reset vector i.e. where ;the DSP looks for instructions ;after a reset org p:PBASE ;start the main program at p:PBASE START 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 movep #$040003,x:M_PCTL ;set up PLL for MF of 4 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 r4 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 ;*************************************************************