Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write an assembly language program that modifies the 10 elements of an array containing scores in the range 0-100 by adding 5 to each element.
Write an assembly language program that modifies the 10 elements of an array containing scores in the range 0-100 by adding 5 to each element.
The array elements must be processed in a loop.
The maximum value for any element after updating is 100. For example, if the original score is 90, the modified score should be 95, but if the original score is 98, the modified score should be 100.
The program should 'dump' the contents of the array before and after modification.
**Please note this is what the assembly language programming looks like!**
12 R2 13 R3 14 R12 15 R13 16 R14 17 * STANDARD ENTRYAND INITIALIZATION: 18 19 20 21 BASE EQU 2 EQU3 EQU 12 EQU 13 EQU 14 SUM REGISTER INDEX REGISTER BASE REGISTER SAVE AREA POINTER RETURN REGISTER STM R14,R12,12 (R13) SAVE REGISTERS BALR R12,0 USING BASE, R12 ST LA R13, SAVE LOAD BASE REGISTER DECLARE BASE ADDRESS AND REGISTER R13, SAVE+4SAVE R13 R13 ADDRESS OF SAVE AREA 23 * BEGIN: 2 4 25 26 LoOP 27 28 29 30 31 32 * STANDARD EXIT: 33 DONE 34 35 36 * STORAGE: 37 ARRAY 38 R2,0 R3,0 R2, ARRAY (R3) ADD NEXT ARRAY ELEMENT TO SUM R3, 4 (R3) R3, LIMIT LOOP R2, SUM LA LA ZERO SUM REGISTER ZERO INDEX REGISTER INCREMENT INDEX TO NEXT ARRAY ELEMENT IF INDEX IS NOT PAST THE END OF ARRAY LA BL ST XDUMP ARRAY,20 PROCESS NEXT ELEMENT ELSE DONE - SAVE SUM DISPLAY 5 FULLWORDS STARTING AT ARRAY R13, SAVE+4 RESTORE R13 LM R14,R12,12 (R13) RESTORE REGISTERS BR R14 RETURN DC DCStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started