90
PROGRAMMING EXAMPLESI
Algorithm
Step 1: Initialize R0 as source pointer and load R7 by 16d to serve as the counter. Also clear the accumu-
lator to calculate the sum.
Step 2: Add 1 byte with accumulator as pointed by R0. en increment pointer by one.
Step 3: Decrement counter by one. Continue at Step 2 if the counter is not zero.
Step 4: Store accumulator as pointed by R0. Terminate the process.
Program
; Program to calculate checksum for 16 bytes from location 50H.
; Following three instructions complete the initialization process.
START: MOV R0, #50H ; point to fi rst number
MOV R7, #10H ; counter for 16 additions
MOV A, #00H ; clear checksum
; Iterative procedure, for addition of 16 numbers, starts from here.
ADDIT ...