Question
Self-Modifying Programs A program that changes itself is often called a self-modifying program. Experiment 4.5 This experiment investigates the concept of self-modifying programs. Step 1.
Self-Modifying Programs
A program that changes itself is often called a self-modifying program.
Experiment 4.5
This experiment investigates the concept of self-modifying programs.
Step 1. Start the simulation program and clear the simulated machines main memory. Then, place the program below in main memory.
Address Contents Address Contents Address Contents
00 23 04 B0 08 C0
01 08 05 06 09 00
02 33 06 C0 0A C0
03 05 07 00 0B 00
Step 2. Execute the machine languages program just entered and record the results.
(In particular, what is the value of the program counter when execution stops?)
Step 3. Translate into English the machine language program in Step 1 and explain how the program counter obtained the value observed in Step 2.
Step 4. Clear the simulated machines memory and place the following program in it.
Address Content
00, 01 2100 Initialize
02, 03 2270 counters.
04, 05 3109 Set origin
06, 07 320B and destination.
08, 09 1000 Now move
0A, 0B 3000 one byte.
0C, 0D 2001 Increment
0E, 0F 5101 addresses.
10, 11 5202
12, 13 2333 Do it again
14, 15 4010 if more
16, 17 B31A bytes to be
18, 19 B004 moved.
1A, 1B 2070 Adjust values
1C, 1D 3071 that are
1E, 1F 2079 location
20, 21 3075 dependent.
22, 23 207B
24, 25 3077
26, 27 208A
28, 29 3087
2A, 2B 2074
2C, 2D 3089
2E, 2F 20C0 Make sure
30, 31 30A4 program
32, 33 2000 will halt.
34, 35 30A5
36, 37 B070 Make the big jump!
Step 5. Execute this machine language program by clicking the Step button. Describe the changes that have appearing in the machines main memory.
Step 6. Continue executing and halting the program while observing the changes being made in memory and the program counter. When the program finally terminates, explain what the program did.
Step 7. Study the original program and explain the role of the instructions at locations 12 through 19.
Explain the role of the instructions in locations 1A through 2D.
Explain the role of the instructions in locations 2E through 33.
Step 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