Length of the string in order to reserve space

Assignment Help JAVA Programming
Reference no: EM13165501

Write an ARM assembly language subroutine that performs according to the following specification (Caesar cypher).

Given a mixed case alphabetic string from the C driver program, convert it to all upper case and create a new string for return to the C program. The new string has the characters from the old string replaced by upper case characters from the alphabet offset by the given amount in the alphabet.

If the character string is 'Abc' with an offset of -3 the new string would be 'XYZ'. For characters in the alphabet such as 'mno', the alphabet is 'JKL'. The beginning of the alphabet is wrapped to the end.

To convert a character to upper case, AND the character with 0xDF. Do not process the space character (leave it as a space) or the NULL byte terminator but be sure to include the NULL byte in the new string.

The C driver code:

/* C code for cipher */

#include <stdio.h>

#include <stdlib.h>

extern char * cypher( char * s, int offset ) ;

int main( int argc, char * argv[] )

{

            char string[] = "The quick brown fox jumped over the lazy dog" ;

            char * result ;

            int offset = -5 ;

            result = cypher( string, offset ) ;

            printf( "Original:%s\n", string ) ;

            printf( "Coded:   %s\n", result ) ;

            exit( 0 ) ;

}

The assembly routines definition is:

            extern char * cypher( char * s, int offset )

                        where char * s is the pointer to the string,

                                    int offset is the integer distance to move

                        returns a pointer to a string.

To determine the length of the string in order to reserve space for the new string use the library routine strlen. Register a1 contains a pointer to the string to measure and on return register a1 has the number of characters in the string. You need to add one to this result since strlen does not account for the null byte at the end.

You can pass this length to the malloc library routine to obtain space for the new string.

Reference no: EM13165501

Questions Cloud

What is the empirical formula of the hydrocarbon : 4.236-g sample of a hydrocarbon (CxHy) is combusted in O2 completely to give 3.810 g of H2O and 13.96 g of CO2. What is the empirical formula of the hydrocarbon?
Write a test program that prompts the user : public static int binaryToDecimal(String binaryString)Write a test program that prompts the user to enter a binary string and displays its decimal equivalent.
What mass of iron would be required to cover : What mass of iron would be required to cover a football playing surface of 120 yds × 60 yds to a depth of 1.0 mm?
Functions to make a main program : write the required functions to make a main program that is already written
Length of the string in order to reserve space : To determine the length of the string in order to reserve space for the new string use the library routine strlen. Register a1 contains a pointer to the string to measure and on return register a1 has the number of characters in the string. You..
What is the boiling point of water in breckenridge : In Breckenridge, Colorado, the typical atmospheric pressure is 514 torr. What is the boiling point of water (ΔHvap = 40.7 kJ/mol) in Breckenridge?
Calculates the sum of the cube roots of two integers. : Wrtie a program that calculates the sum of the cube roots of two integers. The program should use the following functions as well as a main funcion. 1) enter one positive value 2) compute the cube root of one integer 3) report the value of two intege..
What was the initial concentration : A zero-order reaction has a constant rate of 1.60×10-4 . If after 35.0 seconds the concentration has dropped to 2.50×10-2 , what was the initial concentration?
You must also do the work of sorting : You must also do the work of sorting in the method. You cannot just call another library method. Use loops to show the data in the original array as well as the repopulated array in ascending order.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Huge integer class

Huge Integer Class) Create a class HugeInteger which uses a 40-element array of digits to store integers as large as 40 digits each. Provide methods parse, toString, add and subtract. Method parse should receive a String, extract each digit using met..

  Write a java program that accepts a positive long integer

Write a Java program that accepts a positive long integer between 2 to 15, and then using the number, calculate its factorial (n!). Using do-while statement, make sure it only accepts a valid number (between 2 and 15) - if an invalid number is ent..

  Describe how an eavesdropped can gain access

Describe how an eavesdropped can gain access to the remote server with a relatively modest number of guesses ( Hint:  The eavesdropped starts guessing after the original user has typed all but one character of the password.

  A method with the signature public static void

A method with the signature public static void printDetails(City[] cities) that will iterate through the cities and printthe details of the city using the displayDetails(...) method.

  Application that generates a quiz

Create an application that generates a quiz. Prompt for the user's first and last name, college major, and confidence in test taking (high, medium, or low). The quiz should contain at least five true/false questions about horticulture. When the user ..

  Prompts the user for three first names

Write an application that prompts the user for three first names and concatenates them in every possible two-name combination so that new parents can easily compare them to find the most pleasing baby name. Save the file as BabyNameComparison.java

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Qr codes are a popular way

QR codes are a popular way to encode data for easy reading by computerized cameras. True QR codes contain error correction, format specifiers, version information, and a size variable layout that makes them harder to decode and process

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd