Question: USING DOSBOX : PART II CREATE CODE AND CALCULATE THE AMOUNT OF TIME IT WILL TAKE TO RUN Use the enter command in debug to
USING DOSBOX : PART II CREATE CODE AND CALCULATE THE AMOUNT OF TIME IT WILL TAKE TO RUN
Use the enter command in debug to enter the following array of bytes
Starting at offset of the default data segment therefore A goes into up to into
Using the MOV, ADD and JMP instructions create a short program that adds sums the numbers and saves the summed result of based on the above numbers into offset of the same segment note that the running total result must be saved from inside the loop Since this uses an unconditional jump the program would overwrite the result memory if you step through the loop more than decimal times it is an infinite loop for this exercise, but only the time it takes to add up the array of numbers is what we are trying to calculate
Calculate the total time number of clock cycles based on the processor the program will take to run using the instruction timing data sheets. The way to calculate is to add the timing for one pass, then multiply by the number of passes it takes to complete the summation of the values stored in the locations
Write out your program and give the number of clock cycles for each instruction next to the instruction then add up the total time for one loop pass at the bottom. Then assuming per clock cyclethis would be a processor calculate the total execution time of loops or less to sum the datawrite that as a separate result from the total number of clock cycles basically total clock cycles is the total execution time in this problem
Calculation summary steps:
Calculate instruction clock cycle time of initialization steps once this includes clearing the summation register or memory before use.
Calculate the loop clock cycles after the initialization down to and including the jmp time, multiply this number times the number of full loop passes to add the numbers Note that the loop can not sum more than it can read from ONE instruction per loop cycle eg you can't place reads and sums back to back so it finishes in one loop pass
The last loop pass time doesn't have the final increments and jump just the final add step to add the last number Therefore, the main body of the loopwhich reads the new number, adds it to the old sum, then stores the new sum will execute once more than these last instructionsinc and jmp so multiply the last instruction times one less the main body of the loop.
Use the below instructions with any of the available memory modes immediate, direct, register indirect etc. note depending on how you code it you can have a wide range of timing results But remember the object of assembly language is to minimize the number of clock cycles it takes to calculate a given problem.
Mov
Add
Inc
Jmp
Note that the above instruction names do not represent a template for the actual program you will create, just the instruction names that are needed to complete the exercise eg there may be several moves needed in your program
Note that the jmp goes back to the offset of the instructions that follow the initialization steps ie initialization for any registers used inside of the loop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
