(play) in the register EAX. atwith leading zeros. You must pass Note: the three
ID: 3755693 • Letter: #
Question
(play) in the register EAX. atwith leading zeros. You must pass Note: the three procedures must be included in ONE project using ONE assembly file. Try to create one procedure for each exercise. Write a main program calling the three procedures Programming Exercise I (15 points): The objective of this exercise is to write a procedure that I) Prompts the user with the message: "Please enter a sentence: 2) Reads a string S from the keyboard 3) Displays in decimal the length of the string entered 4) Displays in hexadecimal the length of the string entered 5) Displays the string s Programming Exercise 2 (20 points): The objective of this exercise is to write a procedure that I) Prompts the user with the message: "Please enter a sentence:" 2) Reads a string S from the keyboard 3) Prompts the user with the message: "Please enter a character:" 4) Reads a character c from the keyboard (use ReadChar) 5) Computes and displays in decimal the number of occurrences of character c in the string S. Programming Exercise 3 (25 points): The objective of this exercise is to write a procedure that l) Prompts the user with the message: "Please enter the first sentence:" 2) Reads the string SI from the keyboard 3) Prompts the user with the message: "Please enter the second sentence:" 4) Reads the string S2 from the keyboard 5) Concatenates SI and S2 into a new string S. 6) Displays S 7) Displays the length of String S in decimal and hexadecimal format.Explanation / Answer
DATA SEGMENT STR1 DB "Please Enter a scentene: $" STR2 DB "String: $" STR3 DB "Length of string: $" STR4 DB "Length of string: $" INSTR1 DB 20 DUP("$") NEWLINE DB 10,13,"$" LN DB 5 DUP("$") N DB "$" S DB ? DATA ENDS CODE SEGMENT ASSUME DS:DATA,CS:CODE START: MOV AX,DATA MOV DS,AX LEA SI,INSTR1 ;Reads the String MOV AH,09H LEA DX,STR1 INT 21H MOV AH,0AH MOV DX,SI INT 21H MOV AH,09H LEA DX,NEWLINE INT 21H ;Prints the length of string MOV AH,09H LEA DX,STR3 INT 21H MOV BL,INSTR1+1 ADD BL,30H MOV AH,02H MOV DL,BL INT 21H MOV AH,09H LEA DX,NEWLINE INT 21H ;Prints the length of string MOV AH,09H LEA DX,STR4 INT 21H ADD SI,2 MOV AX,00 L2:CMP BYTE PTR[SI],"$" JE L1 INC SI ADD AL,1 JMP L2 L1:SUB AL,1 ADD AL,30H MOV AH,02H MOV DL,AL INT 21H MOV AH,4CH INT 21H ;Display the string MOV AH,09H LEA DX,STR2 INT 21H MOV AH,09H LEA DX,INSTR1+2 INT 21H MOV AH,09H LEA DX,NEWLINE INT 21H CODE ENDS END START
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.