Write an assembly program that will examine an input string

Write an assembly program that will examine an input string. Assume that a string does not include more than one line. Assume the input string is \"Welcome to CPE325, home of the MSP430!\". Your program should count the number of total characters (including spaces), number of letters, and number of integers (0-9) Set the port P1 to display the number of letters, and port P2 to display the number of integers. Store the total number of characters in register R8. If you are using the sample string given above for testing, the correct results are shown below: Total Characters: 38 Total Letters: 24 Total Integers: 6

Solution

DATA SEGMENT
STR1 DB \"Enter String ->$\"
STR3 DB \"Total Letters ->$\"
INSTR1 DB 20 DUP(\"$\")
EWLINE 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
;GET 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
;PRINT Total Letters
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
CODE ENDS
END START

 Write an assembly program that will examine an input string. Assume that a string does not include more than one line. Assume the input string is \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site