Question: There are two defines for task 3 , only define task 3 _ 1 initially when first working on the peekAddress ( ) and pokeAddress

There are two defines for task 3, only define task3_1 initially when first working on the peekAddress() and pokeAddress() functions.
Implement the peekAddress() and pokeAddress() functions and pass the unit tests for those functions. These functions are tested by using poke to write a value somewhere in memory, then we peek the same address and see if we get the value we wrote to read back out again. Both of these functions should reuse the translateAddress() function form the previous step. In both cases, you first start by translating the given address to a real address. Then for poke you need to save the indicated value into the correct location of your memory[] array. And likewise for peek, you need to read out a value from your memory[] array and return it.
Once your memory peeks and pokes are working, you can try out the tests of the loadProgram() function. This function needs to use your initializeMemory() from task 1, and the pokeAddress() function you just created. Define the task3_2 tests in the test file. But also, the calls to initializeMemory() and pokeAddress() have been commented out of the loadProgram() to get the code to compile. You should uncomment the calls to these function in the loadProgram() member method, then see if the Task 3.2 tests pass when loading full programs for the simulation. How do I write the code for this question?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!