Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MIPS assembly language subroutine called search that searches a NULL-terminated string of ASCII characters for the character passed as an argument in register

Write a MIPS assembly language subroutine called search that searches a NULL-terminated string of ASCII characters for the character passed as an argument in register $a0. The address of the string is passed into the routine as an argument in register $a1. The number of occurrences of the character should be returned in register $v0. Note that the string must NOT be modified by the routine!

I have started the code below so please use what I have already started. MUST BE NATIVE INSTRUCTIONS

.globl main

.data 0x10000200

.asciiz "9find 9 all 9 the 9nines999"

.data 0x10000250

.asciiz "find all the twos"

.text

main:

lui $a1, 0x1000

addi $a1, $a1, 0x0200

addi $a0, $0, 0x39

jal search

addi $0,$0,$0 # set a breakpoint here to verify that the test was passed

lui $a1, 0x1000

addi $a1, $a1, 0x0250

addi $a0, $0, 0x32

jal search

addi $0,$0,$0 # set a breakpoint here to verify that the test was passed

addi $v0, $0, 10

syscall

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions