Question

In: Computer Science

Rars Rise V please Write a program that inserts a minus “-“ between all (!) double-consonants:...

Rars Rise V please

Write a program that inserts a minus “-“ between all (!) double-consonants:

Tunnel -> Tun-nel Busseat -> Bus-seat

And so on..

Howto:

Write a program that lets you enter a string.

  • Use ecall(12) readchar for that in a loop until carriage return.

  • The string can be limited to 30 letters.

  • Make a static string array in the data section holding at least 40 letters.

  • Loop over the string searching for double-consonants.

  • Have a second string for the result.

  • Print the result string.

You can use:

.global _start # Provide program starting address to linker _start:

#loop
addi a7, x0, 12 # linux write system call

ecall .data

sourcestring: .ascii " " #30

targetstring: .ascii " "#40

Solutions

Expert Solution

#Could you please leave a THUMBS Up for my work...

RARS -- RISC-V Assembler and Runtime Simulator:

It is used to assemble and simulate the execution of RISC-V assembly language programs.Its goal is to make an effective development environment.

Some features of RARS -- RISC-V Assembler and Runtime Simulator:

Number of system calls that match behaviour from MARS or SPIKE.

Debugging using breakpoints and/or ebreak is Supported.

RISC-V IMFDN Base (riscv32 and riscv64).

Simultaniously compare psuedo-instruction to machine code with intermediate steps.

Multifile assembly using either files open or a directory.

Program that inserts a minus “-“between all (!) double constants :

.global _start # Gives starting address to linker

_start:

la t1,sourcestring

li t2,10 #enter consonants

loop:

addi a7,x0,12 #readchar

ecall

# input is stored in a0

sb a0,0(t1)

addi t1,t1,1

bne a0,t2,loop

sb x0,0(t1)

.data

sourcestring: .word 30 #String Limit 30 letters

targetstring: .word 40 #Static String array holding 40 letters


Related Solutions

Write a Console Java program that inserts 25 random integers in the range of 0 to...
Write a Console Java program that inserts 25 random integers in the range of 0 to 100 into a Linked List. (Use SecureRandom class from java.security package. SecureRandom rand = new SecureRandom(); - creates the random number object rand.nextInt(100) - generates random integers in the 0 to 100 range) Using a ListItreator output the contents of the LinkedList in the reverse order. Using a ListItreator output the contents of the LinkedList in the original order.
Write a Console Java program that inserts 25 random integers in the range of 0 to...
Write a Console Java program that inserts 25 random integers in the range of 0 to 100 into a Linked List. (Use SecureRandom class from java.security package. SecureRandom rand = new SecureRandom(); - creates the random number object rand.nextInt(100) - generates random integers in the 0 to 100 range) Using a ListItreator output the contents of the LinkedList in the original order. Using a ListItreator output the contents of the LinkedList in the reverse order.
Write a Java program that reads a list of 30 fruits from the file “fruits.txt”, inserts...
Write a Java program that reads a list of 30 fruits from the file “fruits.txt”, inserts them into a string array, and sorts the array in alphabetical order. String objects can be compared using relational operators such as <, >, or ==. For example, “abc” > “abd” is false, but “abc” < “abd” is true. Sample output: Before Sorting: Cherry, Honeydew, Cranberry, Lemon, Orange, Persimmon, Watermelon, Kiwifruit, Lime, Pomegranate, Jujube, Pineapple, Durian, Plum, Banana, Coconut, Apple, Tomato, Raisin, Mandarine, Blackberry,...
Write a java program that inserts 25 random integers from 0 to 100 in order into...
Write a java program that inserts 25 random integers from 0 to 100 in order into a LinkedList object. The program should sort the elements, then calculate the sum of the elements and the floating-point average of the elements.
Written in JAVA Code Write a program that inserts 25 random integers from 0 to 100...
Written in JAVA Code Write a program that inserts 25 random integers from 0 to 100 in order into a LinkedList object. The program should sort the elements, then calculate the sum of the elements and the floating-point average of the elements.
A. Write a program called OnesZerosA.java to do all of the following. Please note, for this...
A. Write a program called OnesZerosA.java to do all of the following. Please note, for this problem you are not allowed to use ArrayList. Read a file containing ones and zeros (such as the example below, also available at http://www2.hawaii.edu/~esb/2020fall.ics111/oneszeros.txt) into a two-dimensional int array. Your program must create the array with the same number of rows as the number of lines in the file, and the same number of columns as the number of ones and zeros in each...
Exercise 2: Write a program in Java to manipulate a Double Linked List: 1. Create Double...
Exercise 2: Write a program in Java to manipulate a Double Linked List: 1. Create Double Linked List 2. Display the list 3. Count the number of nodes 4. Insert a new node at the beginning of a Double Linked List. 5. Insert a new node at the end of a DoubleLinked List 6. Insert a new node after the value 5 of Double Linked List 7. Delete the node with value 6. 8. Search an existing element in a...
11.10 LAB: All permutations of names PLEASE ANSWER IN C++! Write a program that lists all...
11.10 LAB: All permutations of names PLEASE ANSWER IN C++! Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names (until -1), and use a recursive method to create and output all possible orderings of those names, one ordering per line. When the input is: Julia Lucas Mia -1 then the output is (must match the below ordering): Julia...
Please show all work an explain to be upvoted. Write an assembly program to convert an...
Please show all work an explain to be upvoted. Write an assembly program to convert an 8 character string from upper case to lower case.
Write a c++ program that prints the count of all prime numbers between A and B...
Write a c++ program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = Any 5 digit unique number B = A + 1000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT