********************************************************************************* * exp4c55_3.asm - An assembly program for C55x CCS simulator * Overflow handling of y = sum (xi) i = 1 to 8 in Section 4.6.3 * ********************************************************************************* * Section allocation * .def x,y,init x .usect "vars",8 ; reserve 8 locations for x y .usect "vars",1 ; reserve 1 location for y .sect "table" init .int 19660, 19660, 6554, -9830, -32768, -29491, 9830, 6554 ; Adding these numbers : 0.6+0.6+0.2-0.3-1-0.9+0.3+0.2 .text ; create code section .def start ; label of the beginning of code * Copy data to vector x using indirect addressing mode start BSET C54CM ; set C55x native mode BCLR AR1LC ; set AR1 in linear mode BCLR AR2LC ; set AR2 in linear mode BSET SXMD BSET FRCT BCLR SATD copy AMOV #x,XAR1 ; XAR1 pointing to x0 AMOV #init,XAR2 ; XAR2 pointing to table of data RPT #7 ; repeat next instruction 8 times MOV *AR2+,*AR1+ ; copy 8 data to x add: AMOV #x,XAR2 ; XAR2 pointing to x0 MOV #0,AC0 RPT #7 ; set repeat counter to 8 counts ADD *AR2+<<16,AC0 * Write the result to memory location y write MOV HI(AC0),*(#y) ; y <- AC0 end: NOP B end