********************************************************************************* * exp4c54_3.asm - An assembly program for C5000 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: NOP copy: STM #x,AR1 ; AR0 pointing to x0 RPT #7 ; repeat next instruction 8 times MVPD init,*AR1+ ; copy 8 data to x add: SSBX SXM ; turn on sign-extension mode ;RSBX OVM ; turn on(SSBX)/off(RSBX) overflow mode SSBX OVM ; to view the different in the result... STM #x, AR2 ; DP pointing to vector x0 RPTZ A,#7 ; A = 0, Set repeat counter to 8 counts ADD *AR2+,16, A ; shift numbers by 16 bits to left ; before adding them together * Write the result to memory location y write: STH A,*(y) ; y <- A end: NOP B end