Program to perform loop based operation along with indirect addressing
cseg at 0 ; code segment base address from location 0
mov 55h,#11h ; Hex value 11h will be moved into the memory location 55
mov r0,55h ; register r0 points to memory location 55
mov r1,#3 ; register r1 contains value 3
loop:
clr a ; accumulator will be cleared
inc r0 ; r0 will be incremented
add a,@r0 ; value at memory location 55 will be added with accumulator
djnz r1,loop ;decrement and jump if not equal to zero. loop continue until r0 becomes zero
End
cseg at 0 ; code segment base address from location 0
mov 55h,#11h ; Hex value 11h will be moved into the memory location 55
mov r0,55h ; register r0 points to memory location 55
mov r1,#3 ; register r1 contains value 3
loop:
clr a ; accumulator will be cleared
inc r0 ; r0 will be incremented
add a,@r0 ; value at memory location 55 will be added with accumulator
djnz r1,loop ;decrement and jump if not equal to zero. loop continue until r0 becomes zero
End