Question

Write a ALP that inputs a string and let's the user choose from uppercase or lowercase...

Write a ALP that inputs a string and let's the user choose from uppercase or lowercase and vowel and consonant the characters/string to be saved in file. ASSEMBLY LANGUAGE MASM

Sample output:

Enter a string: RoSE

A uppercase vowel

B. Lowercase vowel

C. Uppercase consonant

D.Lowercase consonant

Enter choice: c

Saving...


Program used is emu8086
0 0
Add a comment Improve this question Transcribed image text
Answer #1

DIS MACRO STR
MOV AH,09H
LEA DX,STR
INT 21H
ENDM
DATA SEGMENT
    MSG1 DB \"ENTER YOUR STRING : $\"
    MSG2 DB \"Saving....\"
    MSG3 DB \"A : uppercase vowel"
    MSG4 DB \"B: lowercase vowel\"
    MSG5 DB \"C: uppercase consonant\"
    MSG6 DB \"D: lowercase consonant\"
    MSG7 DB "Enter your choice $"
    msg_wrong db 10, "Please enter correct choice $"

    STR1 DB 20 DUP(\'$\')
    LINE DB 10,13,\'$\'
DATA ENDS

CODE SEGMENT
          ASSUME DS:DATA,CS:CODE
main:
        MOV AX,DATA
        MOV DS,AX
        DIS MSG1
        MOV AH,0AH
        LEA DX,STR1
        INT 21H
        DIS LINE
        MOV CH,00
        MOV CL,BYTE PTR[STR1+1]
        LEA SI,STR1+2
        DIS MSG3
        DIS MSG4
        DIS MSG5
        DIS MSG6
        DIS MSG7
        MOV AH,0AH
        LEA DX,STR1
        INT 21H
    L1: MOV AH,BYTE PTR[SI]
        CMP AH,\'A\'
        JL L4
        CMP AH,\'Z\'
        JG L2
        ADD BYTE PTR[SI],32
        JMP L3
     L2:CMP AH,\'a\'
        JL L4
        CMP AH,\'z\'
        JG L4
        SUB BYTE PTR[SI],32
     L3:INC SI
        LOOP L1
        DIS MSG2
        DIS STR1+2
     L4:MOV AH,4CH
        INT 21H
    jmp cs:jmptble [bx]          ;jumptable

jmptble dw caseA,caseB,caseC ; caseDcases

check:
    lea dx,msg_wrong        ;Display wrong choice
    mov ah,9h         
    int 21h
    mov dl,10            ;Move to new line
    mov ah,2h
    int 21h
    jmp main            ;Loop again to get correct choice

caseA:                    ;CaseA- Uppercase vowel
    mov dl,10            ;move to new line
    mov ah,2h
    int 21h

    mov al,num1            ;copy num1 to al
    xor ah,ah            ;empty ah to zero
    add al,num2             ; add num2 to al
    call display
    jmp endlabel            ;jum to endlabel
case1:                    ;Case1 for subtraction
    mov dl,10            ;;Move to new line
    mov ah,2h
    int 21h

    mov cl,num1            ;Copy number1 to cl
    cmp cl,num2            ;check if first numbr is smaller than second
    jl verify            ;jump if num1 is less than num2

    mov al,num1            ;copy num1 to al
        xor ah,ah            ;empty the uper portion of ax
        sub al,num2             ;subtract two nmbers

    call display
    jmp endlabel
case2:
    mov dl,10
    mov ah,2h
    int 21h

        mov al,num1
        xor ah,ah
        adc al,num2     ;adc add 1 value to the sum (if carry flag is 1)

        call display
        jmp endlabel

verify:
        lea dx,msg_verify
    mov ah,9
    int 21h
display:
mov dl,10            ;mov dl,10 to divide result in ax
        div dl                ;Dvide ax by 10
        mov dl,al            ;copy quotient to dl
        mov bl,ah            ;copy remainder to bl
        add dl,30h                ;add 30h to get actual number
        mov ah,2h            ;Service # to display character
    int 21h                ;Call OS to do the job
    add bl,30h            ;add 30h to remainder
    mov dl,bl            ;move to dl to display
        mov ah,2h            ;Service # to display character
        int 21h             ;Call OS to do the job
        ret

endlabel:
    mov ah,4ch
    int 21h

end main

Add a comment
Know the answer?
Add Answer to:
Write a ALP that inputs a string and let's the user choose from uppercase or lowercase...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT