Laboratory 3
Laboratory 3
1|Page
EXPERIMENT 3
MULTIPLYING TWO MULTIBYTE NUMBERS
OBJECTIVES
• To develop a program that will store the sum of all the products from the given program.
• To use the DEBUG command in TASM and identify the contents of the different
addresses.
• To use the debug’s trace command to identify the content of the destination register or
memory after executing a certain instructions.
PROCEDURES
Part1
• Encode the following code then assemble and link using turbo assembly application
DATA SEGMENT
BYTES EQU 08H
NUM1 DB 05H, 5AH, 6CH, 55H, 66H, 77H, 34H, 12H
NUM2 DB 04H, 56H, 04H, 57H, 32H, 12H, 19H, 13H
NUM3 DB 0AH DUP (00)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX, DATA
MOV DS, AX
MOV CX, BYTES
LEA SI, NUM1
LEA DI, NUM2
LEA BX, NUM3
MOV AX, 00
NEXT: MOV AL, [SI]
MOV DL, [DI]
MUL DL
MOV [BX], AL
MOV[BX+1], AH
INC SI
INC DI
INC BX
INC BX
DEC CX
JNZ NEXT
INT 3H
CODE ENDS
END START
2|Page
Part2
Q1. Using the debug’s trace command, identify the content of the destination register or
memory after executing the following instruction:
- MOV [BX+1], AH BX = 0010, AX = 0014
- MOV AL, [SI] AX = 0005, SI = 0000
- MUL DL AX = 0014, DX = 0004
Q2. Write the content of the following memory addresses in the data segment using the E
command after executing the given assembly program.
ADDRESSES CONTENTS
DS: 0011 00
DS: 0015 01
DS: 0007 12
DS: 000A 04
DS: 000F 13
Q3. Based from your observations and analysis, what register dictates the number of
iterations in the loop?
Register CX and the BYTES = 08H determines that there will be 8 iterations in the program.
Q5. Develop a new program that will store the sum of all the products produced from the
above program.
DATA SEGMENT
BYTES EQU 08H
NUM1 DB 05H, 5AH, 6CH, 55H, 66H, 77H, 34H, 12H
NUM2 DB 04H, 56H, 04H, 57H, 32H, 12H, 19H, 13H
NUM3 DB 0AH DUP (00)
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START: MOV AX, DATA
3|Page
MOV DS, AX
MOV CX, BYTES
LEA SI, NUM1
LEA DI, NUM2
LEA BX, NUM3
MOV AX, 00
NEXT: MOV AL, [SI]
MOV DL, [DI]
MUL DL
MOV [BX], AL
MOV[BX+1], AH
ADD BP, [BX]
INC SI
INC DI
INC BX
INC BX
DEC CX
JNZ NEXT
INT 3H
CODE ENDS
END START
Part3
Submit a final report that contains the following:
4|Page
SUMMARY
I was able to Compile, link, and execute the program on multiplying two multibyte
numbers in TASM, I was also able to identify the content of the destination register or memory
when I execute a certain command in TASM using the debug trace command, and see the content
of the different addresses using the debug command. In part 2, I successfully developed a
program that adds all the product from the given program and successfully assemble, link, and
run it in TASM.
CONCLUSION
As a result, I gained more knowledge and have a better understanding of how low-level
programming works specially on multiplying numbers on using assembly language. With the aid
of TASM, I was able to create, assemble, link, and run the given program and the program I made
to add all the products of the given program, as well as view what was in the various registers
using the debugs trace command and the see the content of the different addresses using the
debug command. This laboratory also allowed me to become more acquainted with the various
CPU registers.
5|Page