Publicité
DONT USE JAVA! ITS A SPARC ASSEMBLY LANGUAGE! It has to be in a -m fil.docx
DONT USE JAVA! ITS A SPARC ASSEMBLY LANGUAGE! It has to be in a -m fil.docx
Prochain SlideShare
NOT IN C but in Assembly language SPARC converting a string to lowerca.docxNOT IN C but in Assembly language SPARC converting a string to lowerca.docx
Chargement dans ... 3
1 sur 2
Publicité

Contenu connexe

Plus de rtodd615(20)

Publicité

DONT USE JAVA! ITS A SPARC ASSEMBLY LANGUAGE! It has to be in a -m fil.docx

  1. DONT USE JAVA! ITS A SPARC ASSEMBLY LANGUAGE! It has to be in a .m file. use terminal Notes: 1.  Make sure to declare word elements before declaring bytes or strings. 2.  After using the scanf function, you can then use either the ld or ldub commands to access the input values. The command ld is for the word size elements and ldub is for the byte size elements. Write a program that accepts a string from the user. You can assume the length of the string will be less than 30 characters and only alphabetical letters are entered. Your program should then prompt the user to enter a letter (either lower case or upper case) After this, you should 1) display the string with only lower case letters, 2) display the length of the string, 3) count the number of occurrences of the letter entered (upper or lower case), 4) store the string with the letter removed (upper and lower case occurrences) and display the shortened string, and 5) ask the user if they want to continue or not. Error checking on user input is required for the single letter input and the option to continue or not. Here is an example: Please enter in a string of a maximum of 30 letters: iloVeAssEmBlyLanguAge Please enter a letter: e lestring of a maximum of 30 letters laysAssEmail angles The string in lower case is: iloveassemblylanguage The length of the string is 21 characters The letter e appears 3 times The revised string is: ilovassmblvlanguag Would you like to enter in another string n)? D Solution .MODEL SMALL .STACK 100H .DATA PROMPT_1 DB 'Enter the Lower Case Letter : $' PROMPT_2 DB 'The Upper Case Letter is : $' .CODE MAIN PROC MOV AX, @DATA ; initialize DS MOV DS, AX LEA DX, PROMPT_1 ; load and print PROMPT_1 MOV AH, 9 INT 21H MOV AH, 1 ; read a letter INT 21H MOV BL, AL ; save the letter in BL MOV AH, 2 ; return carriage MOV DL, 0DH INT 21H MOV DL, 0AH ; line feed INT 21H LEA DX, PROMPT_2 ; load and print PROMPT_2 MOV AH, 9 INT 21H SUB BL, 20H ; convert a lower case letter to upper case letter MOV AH, 2 ; print the Upper case letter MOV DL, BL INT 21H MOV AH, 4CH ; return control to DOS INT 21H MAIN ENDP END MAIN
Publicité