You are on page 1of 5

Name: Zia Ur Rehman

ID: 225081
Program: BS-CYS-4
Instructor: Mr. Zohaib Sajjad Shah
Subject: COAL LAB
Task A:

Code:
INP
STA 90
OUT
HLT

Explanation:
STEP 1: Taking input from the user.
STEP 2: Storing at location 90.
STEP 3: Output the result.
STEP 4: Terminate the execution of Program.
Task B:

Code:
INP
STA 90
INP
STA 91
LDA 90
ADD 91
OUT
HLT
Explanation:
STEP 1: Taking input from the user.
STEP 2: Store at location 90.
STEP 3: Taking input from the user.
STEP 4: Store at location 91.
STEP 5: Load data from location 90 in the accumulator.
STEP 6: Add with data at location 91.
STEP 7: Output the result.
STEP 8: Terminate the execution of Program.

Task C:
Code:
INP
STA A
INP
STA 99
LDA A
SUB 99
OUT
HLT
A DAT

Explanation:
STEP 1: Taking input from the user.
STEP 2: Store the result in Variable A.
STEP 3: Taking input from the user.
STEP 4: Store at the location 99.
STEP 5: Load data from variable in Accumulator.
STEP 6: Subtract the data at location 99 from data in Variable A.
STEP 7: Output the result.
STEP 8: Terminate the execution of Program.
STEP 9: Declaring variable A.

You might also like