Assembly language using DosBox program
Fall 2007
Directions for Laboratory Exercise 1
· Your report for this experiment must be submitted as both a Word file and printed document.
· In the lab session, collect the information required to complete the lab exercise and record all answers to questions in the lab manual.
· The final report must be in the format of the template provided below. You may simply edit your experimental information into the document below by cutting and pasting from the Word document in which you recorded your lab results in the lab. Also, you should draw the diagram for Part 3 Step 1 electronically.
· Be sure to include titles and Step numbers for all information.
· Do all parts of the lab unless it is stated in that template to be skipped.
· As noted in Part 1 Step 4 use the “Mark” and “Copy” icon on the DEBUG toolbar to cut and paste the commands and results into a temporary Word document.
1. Open a word document and minimize
2. Depress the “Mark” icon (leftmost icon on the DEBUG toolbar)
3. Highlight the debug statements that you want to save
4. Depress the “Copy” icon (2nd from left)
5. Open the Word document; click in at the appropriate line, and depress the “Paste” icon.
6. Edit out extra or empty lines or information.
Notes:
1. This lab uses the register and memory DEBUG commands. Refer to pages 116 through 133 of the textbook for information on these commands.
2. You may need to reference the command syntax, register notation, and flag notation in Figures 4.8, 4.10, and 4.11 in the textbook to assist in writing DEBUG commands.
3. Be sure to cut and paste frequently. If you don’t, earlier commands and results will scroll off the screen at the top and be lost.
4. Perform the complete lab exercise on the same PC.
Important! Before You Start this lab exercise mark these “Revisions” into the lab exercise in your Lab Manual
Part 2
Step 3 Change CX to the value 0123H, instead of 10H
Step 4 Change IP to the value 20H, instead of 200H
Step 5 Change PF as stated, but also modify SF to reflect a negative result, and
the carry flag to reflect that a borrow has occurred.
Part 3
Step 6 Enter 2CH instead of 55H starting at address DS:10 and 3DH instead of
00H at DS:30
Step 10 Search for the value 2CH instead of FFH
(Template)
Name: _________________
Student ID: _____________
Date: __________________
Lab 1 (xxxTitlexxx)
Goal of the Laboratory Exercise:
[ Type in a description of what you believe is the “Goal” of this laboratory exercise
.
.
.
]
Part 1 (xxxTitlexxx)
[Insert DEBUG sequence]
[Answer question]
[Insert DEBUG sequence]
[Answer to question]
Conclusion for Part 1:
[Write a brief statement to describe the purpose of this part of the experiment and make a list of what you have learned]
Part 2 (xxxTitlexxx)
[Insert DEBUG sequence]
[Answer to questions]
[Insert DEBUG sequence]
[Answer to questions]
3-6.
[Insert DEBUG sequence]
[Answer to questions]
Interpretation of Results:
Using the information displayed for Step 6, answer each of the questions that follow:
1. What is the value in the CH registers? Ans. _______ The CL register? Ans. _______
2. Is the carry flag set or reset? Ans. _____________Was the result of the prior instruction zero or nonzero? Ans. ___________
3. If the results produced by a register dump command are as follows:
-r
AX=4321 BX=0010 CX=0000 DX=0000 SP=FFEE BP=0000 SI=1234 DI=0200
DS=4367 ES=2367 SS=5367 CS=1367 IP=0100 NV UP EI PL NZ NA PO NC
1367:0100 0000 ADD [BX+DI],AL DS:0210=EF
a. What is the value of the segment base address in the extra data segment register? Ans. _________ The offset address in the destination index register. Ans. __________
b. What is the value of the low byte of the accumulator register? Ans. ________ The high byte of the accumulator register? Ans. _______
c. Write the numeric value (in hex notation) of the logical address formed from the extra data segment register and the destination index register. Ans. _________
Compute the equivalent physical address. Ans. __________
d. Write the numeric value (in hex notation) of the logical address formed from the data segment register and the source index register. Ans. _________
Compute the equivalent physical address. Ans. __________
e. What do you think the notation DS:0210=EF at the bottom right corner of the display means?
Ans. ____________________________________________________
Conclusion for Part 2:
[Write a brief paragraph to describe the purpose of this part of the experiment and make a list of what you have learned]
Part 3 (xxxTitlexxx)
1. [ make line drawing here—must be done electronically for full credit]
2. 1
[Insert DEBUG sequence]
3. 1
[Insert DEBUG sequence]
1 Note: read these two steps carefully to assure that they are done correctly
4. Skip this step
[Insert DEBUG sequence]
5.2
[Insert DEBUG sequence]
6. 2
[Insert DEBUG sequence]
7. 2
[Insert DEBUG sequence]
8. 2
[Insert DEBUG sequence]
9. 2
[Insert DEBUG sequence]
10. 2
[Insert DEBUG sequence]
2 Note: look at your results obtained for these steps carefully to be sure that they make sense.
Interpretation of Results:
Using the information displayed for Step 2, answer each of the questions that follow:
1. What is the value displayed as the fourth byte of data on the first row of the memory dump? Ans. ________
2. What is the logic address of this byte of data? Ans. ________
3. Compute the equivalent physical address for this byte-wide storage location. Ans. _______
4. What is the word value of data stored at this logical address? Ans. _______ Is this an aligned or misaligned word of data? Ans. _______
5. What is the value of the double-word-wide element of data stored in memory starting at address DS:30? Ans. __________ Is this an aligned or misaligned double-word of data? Ans. ___________
6. Find the first byte-wide element of data in the display that has its most significant bit (MSB) equal to 1. Assuming that this hex number represents unsigned integer data, computer the decimal equivalent number Ans. ___________ Then assume that this same number represents a 2’s complement signed integer number, compute the equivalent decimal value.
7. Review the results you obtained for steps 5 through 10. Briefly describe the array of data that was created and viewed in steps 5-8.
8. Explain your results obtained in step 9.
Ans. _____________________________________________________
9. Explain your results obtained in step 10.
Ans. _____________________________________________________
Conclusion for Part 3:
[Write a brief paragraph to describe the purpose of this part of the experiment and make a list of what you have learned]
Part 4 (xxxTitlexxx)
[Insert DEBUG sequence]
2.
[Insert DEBUG sequence]
Interpretation of Results in Preparation for Competing Part 4
a. Review the material in the class notes about pointers and how they are stored in memory—Chapter 2 Part 2 Slide 13. A logic address is expressed as:
Segment base address:offset
SBA: OFFSET
b. Is the segment base part of the address the lower or higher addressed word of the four byte pointer in memory? Ans. __________
The offset part of the address? Ans. _____________
c. Make a table (using Word or Excel) of the segment base address and offset address for the pointers that start at each of the addresses that follow:
Logical Address
0:0
0:4
0:8
0:C
0:10
0:14
0:18
d. Reference the diagram of the interrupt vector table in Fig. 11-3 on
Page 579 of the textbook. What does it say the use of the interrupt vector
at each of the following addresses is?
0:4 Ans. _____________
0:C Ans. _____________
0:14 Ans. _____________
0:16 Ans. _____________
0:18 Ans. _____________
e. Reference the diagram of the interrupt vector table in Fig. 16-42 on
Page 912 of the textbook. What does it say the use of the interrupt vector
at each of the following addresses is?
0:4 Ans. _____________
0:C Ans. _____________
0:14 Ans. _____________
0:16 Ans. _____________
0:18 Ans. _____________
f. Explain the differences between the answers for (d) and (e).
Ans. ________________________________________
Continuation of Lab Procedure for Part 4
2. Ans. ________________
3. Ans. _________________
4. Ans. _________________
Conclusion for Part 4:
[Write a brief paragraph to describe the purpose of this part of the experiment and make a list of what you have learned]
PAGE
2
Version Lab1C