1. Each exercise is written as a spreadsheet. You can either print out the exercise and fill in a paper version, or enter your solutions on the spreadsheet. 2. Work through each program and complete the tables to the right of the program. The first table requires you to enter the contents of each register at each instruction The second table shows results of tests The third shows data stored in memory tagged with labels. Remember: Contents of registers/memory locations remain the same, until overwritten 3. At the end of the program, write a short description of what the program does. Note: numbers starting with 0x are in hexadecimal (used for memory addresses), numbers starting with 0b are in binary, others (used for data) are our usual decimal numbers. 4. Exercises are in sets, with a reference to the pages in CdM-8 Ecosystem Installment 2 textbook A3CompEx0.. simple if.. CompEx1.. comlex conditions CompEx2.. simple loops CompEx3.. loops complex operations including if's 5. If you want to check your results: copy the program into Geany, compile, build and execute. Once you get the Emulator screen , RUN the program and check the final results in the expected memory location. If you want to check registers/locations at each instruction, use Step. Then change the data (as shown in versions1,2,3)and re-run to see the result
Note: These are very basic comprehension exercises covering only some of the early topics. Assessment 3 will require you to write programs and may be more challenging.
4COM1042 Platforms for Computing
Debugging Exercises - Instructions
1. Read the program specification. To de-bug, you will need some test data and expected results. Early exercises provide test data. In later ones you will need to design your own test data and expected results. 2. You cannot de-bug, if you do not know the correct results. First work out the result you would expect. Then, work through each exercise using the tables on the right of each program to identify the errors. 3. You can copy and paste the code into Geany for de-bugging. Correct the errors in the program, by completing the columns in the spreadsheet. 4. To check your answers, Work out the correct answer (based on the data given in memory) Copy the program into into Geany (copy/paste), correct the errors. Compile, build & execute, and then RUN the Emulator Check the data in memory to see if you have fixed the errors Remember: the Emulator works in Hexadecimal 5. The exercises are in sets: CompEx0.. are simple if.. CompEx1.. complex conditions CompEx2.. simple loops CompEx3.. loops with if.. 6. Errors are likely to be, some or all of the following: The wrong registers used The wrong instructions Instructions in the wrong order Instructions omitted wrong tests used; especially boundary values