Assembly Language Lab using DosBox program

profileredjohn__1994
lab_2_template_ver_c.doc

Directions for Laboratory Exercise 2

· 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, draw the diagram for Part 1 Steps 1 and 2 electronically.

· Be sure to include Titles and label and number all Parts and Steps.

· Completely answer all questions and draw requested tables/diagrams.

· Be sure that your report is complete, the information is clearly presented, and that it has been edited for errors, typos, etc.

· 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 lines, empty lines, and errors

Note:

1. This lab uses the following DEBUG commands from the textbook.

a. Section 4.3 Pages 116-123: Register (R) commands

b. Section 4.4 Pages 123-133: Memory (D, E, F, etc.) commands

c. Section 4.7 Pages 136-142: Unassemble (U) command only

d. Section 4.8 Pages 142-144: Assemble (A) command

e. Section 4.9 Pages 145-147: Trace (T) command

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. .

Changes to the Lab Experiment in the Book

1. Mark the following changes into the lab exercise in the book

Part 2

Step 1a Change the instruction to MOV AL,CL

Step 1b Change the instruction to MOV AH,ABH

Step 1e Change the instruction to MOV AH,[BX+SI]

Step 1f Change the instruction to MOV AL,[SI+4H]

Part 3

Step 2 Change the data used to initialize memory to the following values:

(DS:0001H) = 2211H

(DS:0004H) = 4433H

(DS:0011H) = 9988H

(DS:0014H) = CCBBH

(DS:0016H) = FFEEH

Alternate Procedure

1. Perform Parts 2 and 3 of the experiment first and then use these experimental results to create a spread sheet or table containing the information requested in Part 1 Steps 1 and 2. For example,

Assembly Language Instruction Machine Code Number of Bytes

MOV AX,BX ????? ????

MOV AX,AAAAH ????? ????

????? ????? ????

????? ????? ????

2. Use the following alternate procedure for Parts 2 and 3 of Lab 2—Instructions will not be saved or loaded to/from a floppy disk as stated.

a. New Part 2: Just assemble the instructions into memory as stated and unassembled to verify correct loading (do not save to a diskette in drive a). Capture all results to a temporary Word document. b. New Part 3: Instructions should already be in memory from Part 2 (do not load from diskette); just initialize registers and memory as stated and then execute the instructions individually. Capture all results to a temporary Word document.

c. After performing these lab procedures, edit your experimental information into the Word document template below to form a detailed report for your lab exercise.

(Template)

Name: _________________

Student ID: _____________

Date: __________________

Lab 2 (xxxTitlexxx)

Goal of the Laboratory Exercise:

[ Type in a description of what you believe are the “Goals” of this laboratory exercise

.

.

.

]

Part 1 (xxxTitlexxx)

1 and 2.

[Insert/make electronically created spread sheet/table here]

Interpretation of Results: Use the information in the table for Part 1 Steps 1 and 2 to answer the following questions.

1. How many hexadecimal digits correspond to a byte of machine code? Ans. _________________

2. For the instructions in the table above, what is the maximum number of bytes used to encode an instruction in machine code? Ans. __________________

3. For the instructions in the table above, what is the minimum number of bytes used to encode an instruction in machine code? Ans. __________________

4. How many bytes are required to encode the immediate operand of the instruction in Step 1b? Ans. ______________

5. How many bytes are required to encode the direct address of the instruction in Step 1d? Ans. ______________

6. Does the 80x86 instruction set architecture employ fixed instruction length or variable instruction length? Ans. __________________

Conclusion for Part 1:

[Write a paragraph or more to describe the purpose of this part of the experiment and make a list of what you have learned]

Part 2 (xxxTitlexxx)

a. [Insert DEBUG sequence]

b. [Insert DEBUG sequence]

c. [Insert DEBUG sequence]

d. [etc.]

.

.

.

Interpretation of Results:

Using the information displayed for Part 2 Step 1, answer each of the questions that follow:

1. What is the starting address at which the instruction for Step 1a in loaded into memory? Ans. _______ The ending address? Ans. _______

2. At what addresses is the immediate operand of the instruction for Step 1b stored in memory? Ans. _____________

3. What addressing mode is employed by the destination operand of instruction for step 1f? Ans. ______________ The source operand? Ans. ________________

4. If the results produced by an assemble/unassemble command sequence are as follows:

-a cs:310

1369:0310 add [bx+di+1234],dx

1369:0314

-u cs:310 313

1369:0310 01913412 ADD [BX+DI+1234],DX

a. What is the assembly language instruction? Ans. ____________

b. What is the equivalent machine code for the instruction? Ans. _______________

c. What addressing mode does the source operand employ? Ans. ____________ The destination operand? Ans. ________________

d. What is the starting address of the machine code instruction in memory? Ans. ______________ The ending address? ____________

e. How many bytes are required to store the instruction in memory? Ans. ______________

f. At what address is the most significant byte of the address displacement stored? Ans. _____________ The low byte of the displacement? Ans. ______________

g. What is the organization used to arrange the bytes of the displacement in memory called? Ans. ___________________

Conclusion for Part 2:

[Write a paragraph or more to describe the purpose of this part of the experiment and make a list of what you have learned]

Part 3 (xxxTitlexxx)

1. [Insert DEBUG sequence]

2.

[Insert DEBUG sequence]

3.

a. [Insert DEBUG sequence]

b. [Insert DEBUG sequence]

c. [Insert DEBUG sequence]

d. [etc.]

.

.

.

Interpretation of Results:

Using the information displayed for Part 3 Steps 1, 2, and 3, answer each of the questions that follow:

1. Describe the operation performed for each instruction (include in your answer where the source information is located, what is the value moved, and where the destination in which this information is placed is?

Ans.

a. __________________________________________________

b. __________________________________________________

c. __________________________________________________

.

.

.

.

.

etc.

Conclusion for Part 3:

[Write a paragraph or more to describe the purpose of this part of the experiment and make a list of what you have learned]

Supplement: Design an Experimental Process

Design and conduct an experimental procedure to test the operation of the instruction:

add [bx+di+10],dx

In your procedure you should:

a. Assemble and disassemble the instruction

b. Arbitrarily select address offsets for the base and index registers (use small values so that the data is not offset to far in memory i.e. 0100, 0200, etc.)

c. Arbitrarily specify data that will be used for the source and destination operands (use values that you can easily confirm that the correct add took place)

d. Initialize the appropriate registers and memory locations with address and data information

e. Execute the instruction to observe its operation

f. Verify operation of the instruction by viewing and confirming that correct results were obtained

[Insert the complete DEBUG sequence used to implement your design process here]

Conclusion for Supplement:

[Write a paragraph or more to describe the purpose of this part of the experiment and make a list of what you have learned]

PAGE

2