CSCI 365 Project Nine: A String Find Procedure Answered – MASM Assembly Language & String Searching

$50.00

Explore MASM assembly language programming through substring searching with the Str_find procedure. Covers string pointers, procedure arguments, loop-based comparisons, EAX register handling, Zero Flag conditions, and optional case-insensitive Y/N input validation. Delivered as a downloadable ZIP file containing the programming project solution for educational reference.

Original Work ?

Download Details:

  • Name: 9.ProjectNine-plrwrp.zip
  • Type: zip
  • Size: 79.58 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (3 votes)

CSCI 365 Project Nine: A String Find Procedure focuses on implementing string searching in MASM assembly language. The assignment explores pointer-based string arguments, user-defined procedures, loops, EAX register handling, and Zero Flag conditions. Students develop a Str_find procedure to locate the first matching substring and examine optional input validation for uppercase and lowercase responses.

Assignment Description

Objectives:

  1. Write procedures using strings as arguments
  2. Apply pointers
  3. Write user defined procedures
  4. Apply user defined procedures
  5. Apply loop

Problem Description:

Write a procedure named Str_find that searches for the first matching occurrence of a source string inside a target string and returns the matching position. The input prameters should be a pointer to the source string and a point to the target string. If a match is found, the procedure sets the Zero flag and EAX points to the matching position in the target string. Otherwise, the Zero flag is clear and EAX is undefined. The following code, for example, searches for “ABC” and returns with EAX pointing to the “A” in the target string.

.data

Target BYTE “123ABC342342”, 0

Source BYTE “ABC”, 0

Pos DWORD ?

.code

INVOKE Str_find, ADDR source, ADDR target

Jnz notFound

Mov pos, eax           ; store the position value

 

(Refer to Programming Project 4 on page 386)

 

Sample Run:

 

 

Extra Credit:

 

You may notice that in my solution, I only take lower case y/n because I used “call ReadChar” and “call WriteChar” to get the user’s choice and display the user’s choice. If user try to type capital Y, the program will exit since it will read the “shift” key as user’s input. Any input different from lower case y will be consider a NO choice

Modify your solution so that it all handle the following two cases:

  1. If can take upper case letter as user’s choice
  2. If user’s choice is NOT Y, y, N, or n, prompt error message and ask user to reenter choice.

 

This worth 2% overall extra credit. No curve for this class. If you want one, do this extra credit so you get 2% curve!

 

Due Date:

Turn in YourNameProj9.asm via Blackboard. Due date will be announced on Blackboard.

Solution Overview

The solution addresses the Str_find assembly procedure for locating the first occurrence of a source string within a target string. It covers pointer parameters, loop-based character comparisons, EAX result handling, Zero Flag status, and optional validation of Y/N user responses.