Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an assembly program that will examine an input string. Assume that a strin

ID: 3883310 • Letter: W

Question

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 Assembly Programming
@MSP430!”. Your program should count the number of total characters, number of uppercase
vowels, and number of special characters (other than characters and digits). Set the port P1 to
display the number of special characters, and port P2 to display the number of vowels. Store
the total number of characters in register R10. If you are using the sample string given above
for testing, the correct results are shown below (in decimal):
Total Characters: 40
Total Uppercase Vowels: 1
Total Special Characters: 6

Explanation / Answer

dosseg

.model small

.stack 100H

.code

main proc

mov ax, @data ; initialize ds register

mov ds, ax

mov si, offset string

mov cx, length ; length in cx register

mov bl, 00 ; vowel = 0

BACK: mov al, [si]

cmp al, ‘a’ ; alternatively cmp al, 41h for comparing if al =41h

jb AHEAD ; jump below if al < 41, discard

cmp al, ‘z’ ; convert the character to upper case

ja VOWEL

sub al, 20h

VOWEL: cmp al, ‘A’

jnz a3 ; go to a3 to check next vowel character

inc bl ; vowel = vowel + 1

jmp a2 ; jump to increment pointer

a3: cmp al, ‘E’

jnz a4 ; go to a4 to check next vowel character

inc bl ; vowel = vowel + 1

jmp a2 ; jump to increment pointer

a4: cmp al, ‘I’

jnz a5 ; go to a5 to check next vowel character

inc bl ; vowel = vowel + 1

jmp a2 ; jump to increment pointer

a5: cmp al, ‘O’

jnz a6 ; go to a6 to check next vowel character

inc bl ; vowel = vowel + 1

jmp a2 ; jump to increment pointer

a6: cmp al, ‘U’

jmp a2 ; jump to increment pointer

inc bl ; vowel = vowel + 1

a2: inc si

loop BACK

mov VOWEL, bl

mov ax, 4C00H ; return to DOS

int 21H

main endp

.data

string db ‘The quick brown fox jumped over the lazy sleeping dog’, ‘$’

length dw $ string

VOWEL db ?

end main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote