0% found this document useful (0 votes)
105 views

COA LAB Project

This document describes an assembly language program for managing contacts on a computer. The program allows the user to create, display, update, search for, and remove contacts from a list stored in memory. It uses MIPS assembly instructions to prompt the user for input, store and retrieve contact information from memory locations, and output results to the console.

Uploaded by

areef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

COA LAB Project

This document describes an assembly language program for managing contacts on a computer. The program allows the user to create, display, update, search for, and remove contacts from a list stored in memory. It uses MIPS assembly instructions to prompt the user for input, store and retrieve contact information from memory locations, and output results to the console.

Uploaded by

areef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Computer Architecture And Assembly Project

BY
Areef Imran
Muhammad Balaj

.data

name:.asciiz "Please, Enter the name :"

space:.space 800

contact:.asciiz "\nContact created Succesfully."

label:.asciiz "\nEnter 1 to create a contact.\n"

label2:.asciiz "Enter 2 to display the list of contacts.\n"

label3:.asciiz "Enter 3 to update a contact.\n"

label4:.asciiz "Enter 4 to search for a contact.\n"

label5:.asciiz "Enter 5 to remove a contact.\n"

label6:.asciiz "Enter 6 to exit. \n"

choice:.asciiz "\nPlease, Enter your choice : \n"

number:.asciiz "\nPlease Enter the contact number : \n"

space2:.word 60

display:.asciiz "\nThe contacts stored in list are : \n"

noNumber:.asciiz "\nNumber is not available. \n"

endl:.asciiz "\n"

address: .asciiz "Please, Enter your address : \n"

space3: .space 1000

numSearch:.asciiz "\nThe contact number you searched for : \n"

search:.asciiz "\nEnter The Number You want to Search : \n"

numUpdate:.asciiz "\nEnter The Number You Want to Update : \n"

update:.asciiz "\nContact updated Succesfully. \n"

newNum:.asciiz "\nEnter The New Number to update previous number : \n"


newName:.asciiz "\nEnter The new Name of person : \n"

error:.asciiz "Invalid input. \n"

.text

li $s4,0

li $s6,0

main:

li $v0,4

la $a0,label

syscall

li $v0,4

la $a0,label2

syscall

li $v0,4

la $a0,label3

syscall

li $v0,4

la $a0,label4

syscall

li $v0,4

la $a0,label5

syscall

li $v0,4

la $a0,label6

syscall

li $v0,4

la $a0,choice

syscall
li $v0,5

syscall

add $t0,$zero,$v0

switch:

beq $t0,1,createContact

beq $t0,2,showContact

beq $t0,3,modifyContact

beq $t0,4,findContact

beq $t0,5,deleteContact

bgt $t0,6,error1

j exit

createContact:

li $v0,4

la $a0,name

syscall

la $a0,space($s6)

li $a1,15

li $v0,8

syscall

li $v0,4

la $a0,number

syscall

li $v0,5

syscall

add $t1,$zero,$v0

sw $t1,space2($s4)

li $v0,4
la $a0,address

syscall

la $a0,space3($s6)

li $a1,15

li $v0,8

syscall

li $v0,4

la $a0,contact

syscall

addi $s4,$s4,4

addi $s6,$s6,15

j main

showContact:

li $t5,0

li $s7,0

li $v0,4

la $a0,display

syscall

func:

bne $s4,$t5,for_loop

j main

for_loop:

la $a0,space($s7)

li $v0,4

syscall

lw $a0,space2($t5)

li $v0,1

syscall
li $v0,4

la $a0,endl

syscall

la $a0,space3($s7)

li $v0,4

syscall

addi $s7,$s7,15

addi $t5,$t5,4

j func

modifyContact:

li $s5,0

li $t5,0

li $s7,0

li $s3,0

li $v0,4

la $a0,numUpdate

syscall

li $v0,5

syscall

la $t7,($v0)

func2:

bne $s5,10,modify

li $v0,4

la $a0,noNumber

syscall

j main

modify:

lw $s3,space($t5)
beq $s3,$t7,newContact

addi $s5,$s5,1

addi $t5,$t5,4

addi $s7,$s7,15

j func2

newContact:

li $v0,4

la $a0,newName

syscall

li $a1,15

li $v0,8

la $a0,space($s7)

syscall

li $v0,4

la $a0,newNum

syscall

li $v0,5

syscall

la $t4,($v0)

sw $t4,space2($t5)

li $v0,4

la $a0,numUpdate

syscall

j main

findContact:

li $s5,0

li $t5,0

li $s3,0
li $v0,4

la $a0,search

li $t0,0

syscall

li $v0,5

syscall

la $t7,($v0)

func3:

bne $s5,10,find

li $v0,4

la $a0,noNumber

syscall

j main

find:

lw $s3,space2($t5)

beq $s3,$t7,func4

addi $s5,$s5,1

addi $t0, $t0, 15

addi $t5,$t5,4

j func3

func4:

li $v0,4

la $a0,numSearch

syscall

li $v0,4

la $a0,space($t0)

syscall

j main
deleteContact:

j main

li $v0,10

syscall

error1:

li $v0,4

la $a0,error

syscall

j switch

j main

exit:

li $v0,10

syscall

You might also like