Lab Mannual
Lab Mannual
LAB MANNUAL
OR GATE:
NOT GATE:
NAND GATE:
XOR GATE:
NOR GATE:
LAB : 02
2) NAND TO AND
3) NAND TO OR
3) NOR TO OR
LAB : 03
A B X
0 0 0
0 1 1
1 0 1
1 1 0
2. BOOLEAN FUNTION :
3. DIAGRAM :
CASE: 1
CASE : 2
CASE : 3
CASE : 4
I PLEMENTATIONOFXNORGATEUSING
M
NANDGATE:
1. TRUTH TABLE:
A B X
0 0 1
0 1 0
1 0 0
1 1 1
2. BOOLEAN FUNCTION:
3. DIAGRAM:
CASE : 1
CASE : 2
CASE : 3
CASE :4
LAB : 04
HALFADDER
TRUTH TABLE AND LOGIC DESIGN:
DIAGRAM:
FULLADDER
TRUTH TABLE AND LOGIC DESIGN :
DIAGRAM :
LAB 05
Questions
Modify the BCD to Decimal decoder circuit provided to give output of all
0’s when any invalid input combination occurs.
TRUTH TABLE:
LAB : 06
MUX:
2*1:
4*1:
ENCODER:
DECODER:
LAB : 08
Question 1: Comment on Architecture of the following
CPUs:
1. PIC18:
2. ATMEL:
3. IBM POWER2:
4. ITANIUM:
5. EPIC:
6. INTEL I860:
7. TRANSMETA CRUSOE:
8. STARCORE (LUCENT/MOTOROLLA):
9. TIGERSHARC (ADI):
10. INFENON X:
Home Appliances:
Consumer Electronics:
Transportation:
Healthcare:
Architecture: Skylake
Comments:
CODE:
CONSOLE:
Exercise 9.2
Write a program that input a character from user. The program will display it
ten times on screen in newline.
CODE:
CONSOLE:
LAB: 10
Activity #3.1
Activity #3.2
Activity #3.3:
Activity 3.3: Addition of two single digits numbers
.model small
.stack 100h
.data
Num1 db 0
Num2 db 0
msgNum1 db "Enter the 1st No: $"
.code
main proc
int 21h
mov ah, 1
int 21h
mov Num1, al
int 21h
mov ah, 1
int 21h
; Addition
cmp bh, 9
int 21h
mov dl, bh
mov ah, 2
int 21h
; Exit
int 21h
; ...
main endp
end main
Activity #3.4
.data
num1 dw 0
num2 dw 0
; get the multi-digit signed number from the keyboard, and store the
; result in cx register:
END
Exercise #3.1:
include emu8086.inc
.data
num1 dw 0
num2 dw 0
.code
main proc
call scan_num
mov num1, cx
; Get second number:
call scan_num
mov num2, cx
call print_num
main endp
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS
DEFINE_SCAN_NUM
END main
Exercise#3.2
Exercise 3.2:
Write a program that reads five unsigned integers from user and display sum of those
Code:
.data
num2 dw 0
num3 dw 0
num4 dw 0
num5 dw 0
.code
main:
mov ds, ax
int 21h
int 21h
int 21h
int 21h
int 21h
int 21h
int 21h
END main
Output:
Exercise 3.3:
Write a program using instruction shown in table and fill in the table with the offsets
Code:
.data
number dw 100
sum dw 0
.code
main PROC
mov sum, ax
mov ax, 0
int 21h
main ENDP
Output:
INSTRUCTION 3:
EXERCISE 4.2:
Calculate the range of signed and unsigned numbers that db, dw, dd, dq and dt
directives can specify. Mention the adopted method i.e how you will calculate therange.
EXERCISE 4.3:
byte1 db 10110111b : 183
byte2 db 35q :29
byte3 db 0E8h :232
byte4 db 150 : 150
byte5 db -91 : 165
byte6 db ‘K’ : 75
byte7 db ‘k’ :107
byte8 db “Ali’s book” : 065
byte9 db 5 DUP("< >") : 060
byte10 dw 1000000 : overflow error
Byte11 dw "Maria Sultan": 4D077- 90144
Exercise 4.4
Define 5 different 8-bit Numbers. Write a programme to do the
following : Use the DB directive to define the following list of numbers and
name it myarray.
• 36h, 37h, 39h, 40h
• Display the array in reverse order.
OPEN ENDED LAB
Exercise 5.1
Write a program to use the SCAN_NUM to input prompt for values for three
variables x, y and z and the PRINT_NUM to display an appropriate label and
value of the expression x – y + 2z – 1.
CODE:
include emu8086.inc ;include library
.data
x dw 0 ; Define variable for x
y dw 0 ; Define variable for y
z dw 0 ; Define variable for z
result dw 0 ; Variable to store the result
msgX db "Enter value for x: $"
msgY db 10, 13, "Enter value for y: $"
msgZ db 10, 13, "Enter value for z: $"
msgResult db 10, 13, "Result (x-y + 2z- 1): $"
.code
main:
mov ax, @data
mov ds, ax
; Input for x
mov dx, offset msgX
mov ah, 09h
int 21h
call scan_num ; Get value for x
mov x, cx ; Store value for x
; Input for y
mov dx, offset msgY
mov ah, 09h
int 21h
call scan_num ; Get value for y
mov y, cx ; Store value for y
; Input for z
mov dx, offset msgZ
mov ah, 09h
int 21h
call scan_num ; Get value for z
mov z, cx ; Store value for z
; Calculate the result
mov ax, x ; Move the value of x to ax
sub ax, y ; Subtract the value of y
shl z, 1 ; Multiply the value of z by 2
add ax, z ; Add the doubled value of z
sub ax, 1 ; Subtract 1
mov result, ax ; Store the final result
; Display the result
mov dx, offset msgResult
mov ah, 09h
int 21h
mov ax, result ; Move the result to ax for printing
call print_num ; Print the result
mov ax, 4C00h ; Exit to DOS
int 21h
DEFINE_PRINT_NUM ; used by print_num proc
DEFINE_PRINT_NUM_UNS ; used by print_num proc
DEFINE_SCAN_NUM ; used by scan_num proc
END main
OUTPUT:
Exercise 5.2
Write an assembly language program that prompts for and inputs the length,
width, and height of a box and calculates and displays its surface area surface
area = 2 * (length * width + length * height + width * height)
CODE:
include emu8086.inc ;include library
.data
length dw 0 ; Define variable for length
width dw 0 ; Define variable for width
height dw 0 ; Define variable for height
surface_area dw 0 ; Variable to store the surface area
msgLength db "Enter Length: $"
msgWidth db 10, 13, "Enter Width: $"
msgHeight db 10, 13, "Enter Height: $"
msgResult db 10, 13, "Surface Area: $"
.code
main:
mov ax, @data
mov ds, ax
; Input for length
mov dx, offset msgLength
mov ah, 09h
int 21h
call scan_num ; Get length
mov length, cx ; Store length
; Input for width
mov dx, offset msgWidth
mov ah, 09h
int 21h
call scan_num ; Get width
mov width, cx ; Store width
; Input for height
mov dx, offset msgHeight
mov ah, 09h
int 21h
call scan_num ; Get height
mov height, cx ; Store height
; Calculate surface area
mov ax, length
imul width ; Multiply length by width and store the result in ax
mov bx, length
imul height ; Multiply length by height and store the result in bx
mov cx, width
imul height ; Multiply width by height and store the result in cx
shl ax, 2 ; 2 * (length * width)
add ax, bx ; 2 * (length * width + length * height)
add ax, cx ; 2 * (length * width + length * height + width * height)
mov surface_area, ax ; Store the surface area
; Display the result
mov dx, offset msgResult
mov ah, 09h
int 21h
mov ax, surface_area ; Move the surface area to ax for printing
call print_num ; Print the surface area
mov ax, 4C00h ; Exit to DOS
int 21h
DEFINE_PRINT_NUM ; used by print_num proc
DEFINE_PRINT_NUM_UNS ; used by print_num proc
DEFINE_SCAN_NUM ; used by scan_num proc
END main
OUTPUT: