214Chapter 7Low-Level Programming Languagessum. Oops, there is a necessary step not in the algorithm: We must clear theaccumulator. We can either loadsuminto the accumulator first (to set it tozero) or we can load the first number into the accumulator rather thanadding it in. Since we have made sure thatsumis zero, let’s load it in first.So, after reading and adding three numbers, we must write out the sum.Oops, another missing step. We must store the accumulator intosuminorder to write it out.Here is our completed program. Note that we had to have a statementthat branches around the data values as the first statement. That is, executionbegins with the instruction stored in location 0000. We have put the data atthe beginning of the program rather than the instructions that operate on thedata. Thus, we must have an instruction stored in location 0000 that puts thelocation of the first instruction in the program into the program counter. The’"instruction does this.
This is the end of the preview.
access the rest of the document.
Central processing unit, Control flow, Machine code, Computer program, M5i4