COALAB4 (1)
COALAB4 (1)
LAB# 4
Objective:
To understand branching and simulate VVM Program using “BRP”, “BRZ”, & “BR” Instructions
LAB TASK:
1. Take any integer as input.
If the number is greater than 5, print the number.
If the number is less than 5, halt.
If the number is equal to zero, halt.
STEP: 1
STEP: 2
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
Trace View:
Task: 2
2. Take two integers as input and subtract them.
If the result is positive, save and display it at the memory location of your roll number.
STEP: 1
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
STEP: 2
TRACE VIEW:
TASK: 3
3. Take two numbers as input and print the smaller number.
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
STEP: 1
STEP: 2
TRACE VIEW:
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
TASK:4
3. Take three numbers as input like x1, x2, x3.
Then solve: x1 + x2 – x3.
If the result is 0, save and print the result at the memory location 50.
STEP: 1
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
STEP: 2
TRACE VIEW:
TASK:5
5. Write a VVM program which take an integer input and display table of that integer.
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
STEP: 1
STEP: 2
TRACE VIEW:
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
TASK:6
6. Design a simple loop using BRZ instruction in VVM.
STEP: 1
STEP: 2
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
TRACE VIEW:
TASK:7
7. Take any integer from user. If it’s positive, print the integer. Otherwise, program should be
closed. Repeat the task, the no. of times of the last digit of your roll no.
STEP: 1
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
STEP: 2
TRACE VIEW:
TASK:8
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4
8. Take square of any integer in range (1-20)
STEP:1
STEP:2
TRACE VIEW:
Parvez Ali 2023F-BSE-224 Section: E
LAB# 4