University of the Fraser Valley**We aren't endorsed by this school
Course
BUS 160
Subject
Electrical Engineering
Date
Dec 10, 2024
Pages
5
Uploaded by GeneralKingfisher3554
TASK 1#------------------------------------------------------------# Name: Tejinder Singh# Lab #: 2# File Name: task1.s# Date: 12-04-24## Description: This program sums six bytes in the array VAR# and stores the result in ANSWER.#------------------------------------------------------------#constants#------------------------------------------------------------#data segment.section .dataVAR: db 5, 10, 15, 20, 25, 30 ANSWER: db 0 #------------------------------------------------------------#code segment.section .text.global _start_start:#**********************************************mov $6, %ecx mov $VAR, %esi xor %al, %al sum_loop:add (%esi), %al
inc %esi loop sum_loop mov %al, ANSWER mov $1, %eax mov $0, %ebx #set up to return to LINUX int $0x80 #this is the program exit pointTASK 2#------------------------------------------------------------# Name: Tejinder Singh# Lab #: 2# File Name: task2.s# Date: 12-04-24## Description: Sums bytes in VAR and tracks carry bits.#------------------------------------------------------------#constants#------------------------------------------------------------#data segment.section .dataVAR: db 5, 10, 15, 20, 25, 30ANSWER: db 0ANSWER1: db 0
#------------------------------------------------------------#code segment.section .text.global _start_start:#**********************************************mov $6, %ecxmov $VAR, %esixor %ax, %axsum_loop:add (%esi), %aljc carryinc %esiloop sum_loopjmp finishcarry:inc %ahinc %esiloop sum_loopfinish:mov %al, ANSWERmov %ah, ANSWER1#**********************************************mov $1, %eaxmov $0, %ebx #set up to return to LINUX int $0x80 #this is the program exit point
TASK 3#------------------------------------------------------------# Name: Tejinder Singh# Lab #: 2# File Name: task2.s# Date: 12-04-24## Description: Counts lowercase and uppercase letters in STRING1.#------------------------------------------------------------#constants#------------------------------------------------------------#data segment.section .dataSTRING1: db 'AbCdefGHijKLmnOPQRstuvWXyz', 0LOWER: db 0UPPER: db 0#------------------------------------------------------------#code segment.section .text.global _start_start:#**********************************************mov $26, %ecxmov $STRING1, %esixor %dl, %dlxor %dh, %dh
count_loop:mov (%esi), %alcmp $'a', %aljl check_uppercmp $'z', %aljg check_upperinc %dljmp next_charcheck_upper:cmp $'A', %aljl next_charcmp $'Z', %aljg next_charinc %dhnext_char:inc %esiloop count_loopmov %dl, LOWERmov %dh, UPPER#**********************************************mov $1, %eaxmov $0, %ebx #set up to return to LINUX int $0x80 #this is the program exit point