Introduction
More ALP program time and this time its Addition of 10 numbers stored in memory at consecutive locations
Code with all lines explained
The subroutine we will use is as follows. This will behave as a delay for our counter
Code:
LDA XXXX // Some memory location say 8500
// Load the accumulator with the address of memory viz 8500
MOV D, A
// Move the accumulator value to the register D
MVI E, 09
// Load the E register with the counter 10 - 1
LXI B, XXXX + 1 // Next memory location from where we have done LDA - 8501
// Load immediate B C with the memory location
LDAX B
// Load Accumulator indirect A=[BC]
ADD D
//Add the content of the Accumulator to the Register D
MOV D, A
//Move the value in D to the Accumulator or register A
INX B
// Increment BC register pairs
DCR E
// Decrement the counter register
JNZ XXXX // LDAX B Location
// Jump on no zero
STA XXXX // Suitable memory location
// Store the output into a memory location
HLT
// Stop the program
