QuestionQuestion

Sorter
You are responsible to write an assembly function to perform sorting of a list of integer key values. This function can sort either in ascending or descending order. You will use the bubble sort algorithm for this function. This function will use the C function signature but everything within this function should be assembly code using the ASM block similar to the assembly example shown in class.

Program Specification:

int sorter ( int* list, int count, int opcode );

list – the starting address of the list of integers to be sorted

count – total number of integers in the list

opcode -

1. Ascending
2. Descending


Binary Search
You are responsible to write an assembly function to perform searching of a list of names in stored in ascending order. This function will use the binary search algorithm. The names could be stored in mixed case. Therefore your assembly function must do the comparison in a case insensitive manner. This function will use the C function signature but everything within this function should be assembly code using the ASM block similar to the assembly example shown in class.

Program Specification:

int b_search (char list[100][20], int count, char* token);

list – the starting address of the list of names to be searched

count – total number of names in the list

token – name to be search in the list

This function returns the position of the token in the list (starting with 1). If the name is not found, then it returns 0. When it returns 0, print a message on the console.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>


int sorter ( int *list, int count, int opcode )
{
int wasswap; //flag to indicate if there was a swap in loop execution
int i; // loop counter

_asm
{
mov wasswap, 1 ; set wasswap to true to enter loop
whileLoop: ; main loop
cmp wasswap, 0 ; check if there was a swap
je endWhileLoop ; exit loop if there were no swap

mov eax, count ; move count to reg
sub eax, 1 ; decrement reg with 1
mov count, eax ; count = count - 1

mov wasswap, 0 ; set wasswap to false before the checks start

mov i, 0 ; set i to 0, start checking loop
forLoop:
mov eax, count ; move count to reg to compare with i...
$40.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats