Complete this AVR assembly language fragment so that it adds the
unsigned 16-bit value in register pair r9:r6 to the unsigned 16-bit
value in r7:r8. (Registers 9 and 7 are the most signficant bytes in
these 16-bit quantities. The result ends up in r7:r8.)
addadcadiwr6r7r8r9 addadcadiwr6r7r8r9
, addadcadiwr6r7r8r9
addadcadiwr6r7r8r9 addadcadiwr6r7r8r9
, addadcadiwr6r7r8r9
/* Add the unsigned 16-bit value in register pair r9:r6 to the unsigned 16-bit value in r7:r8. The result ends up in r7:r8. */
.include "m328-pdef.inc" ; Includes AVR related functions
.eq rstart = 0x00 .def r1 = r9:r6 ;defining registers .def r2 = r7:r8 ;defining registers .ds ; data segment .org rstart r3: .byte 2 ;holds 16 bit registers r9:r6 r4: .byte 2 ;holds 16 bit registers r7:r8 .cseg .org 0x00 jmp begin ; jump to loop begin begin: movw r3,r1 ; move the content of r1 to r3 movw r4,r2 ; move the content of r2 to r4 add r3,r4 ; add the content and store in r3 ret ; return the computed result
Get Answers For Free
Most questions answered within 1 hours.