Sie sind auf Seite 1von 3

START CHA DB "INPUT CHARACTER: $" VOW DB 0AH, 0DH, "VOWEL$" CON DB 0AH, 0DH, "CONSONANT$" IVL DB 0AH,

0DH, "INVALID$" INPUT DB 0

Display CHA Get AL

INPUT = AL

YES INPUT=41H || 45H || 49H || 4FH || 55H NO INPUT=30H || 31H || 32H || 33H || 34H || 35H || 36H || 37H || 38H || 39H NO A Display IVL YES Display CON Display VOW A

NO

END

Explanation:

I declared the variables which the variables (VOW, CON and IVL) are declared to string and each has a message. This program is to determine whether the input character is a letter, vowel, a consonant or you enter an invalid input. I displayed the message from the variable CHA which the program will ask to enter a character. Once you enter a character then it will be automatic stored in AL register. Then, it will move to the CHA variable. If all of the conditions are not satisfy, it will output invalid. If you input letters from a,e,i,o,u it will output as vowel, then if you input letters left the output will say it is consonant. And also if you input a special character the program will say it is invalid. Like for example putting a number to this program is invalid.

Program Codes:
TITLE F.ASM DOSSEG .MODEL SMALL .STACK 0100H .DATA CHA DB "ENTER A CHARACTER: $" VOW DB "VOWEL$" CON DB "CONSTANT$" IVL DB "INVALID$" INPUT DB 0 .CODE MOV AX, @DATA MOV DS, AX MOV AX, 0600H MOV BH, 07H MOV CX, 000H MOV DX, 184FH INT 10H MOV AH, 09H MOV AX, OFFSET CHA INT 21H MOV AH, 01H INT 21H MOV INPUT, AL CMP INPUT, 'A' JGE LETTER JL INVALID LETTER: CMP INPUT, 'Z' JLE CVON JG INVALID CVON: CMP INPUT, 41H JE VOWEL CMP INPUT, 45H JE VOWEL CMP INPUT, 49H JE VOWEL CMP INPUT, 4FH JE VOWEL CMP INPUT, 55H JE VOWEL CMP INPUT, 61H JE VOWEL CMP INPUT, 65H JE VOWEL CMP INPUT, 69H JE VOWEL CMP INPUT, 6FH JE VOWEL CMP INPUT, 75H JE VOWEL JNE CONS VOWEL: MOV AH, 13H MOV AL, 00H MOV BH, 00H MOV BL, 0A7H MOV BP, OFFSET VOW MOV CX, 0005H MOV DH, 0CH MOV DL, 24H INT 10H JMP TAPOS CONS: MOV AH, 13H MOV AL, 00H MOV BH, 00H MOV BL, 0AEH MOV BP, OFFSET CON MOV CX, 0009H MOV DH, 0CH MOV DL, 24H INT 10H JMP TAPOS INVALID:MOV AH, 13H MOV AL, 00H MOV BH, 00H MOV BL, 047H MOV BP, OFFSET IVL MOV CX, 0007H MOV DH, 0CH MOV DL, 24H INT 10H JMP TAPOS TAPOS:MOV AX, 4C00H INT 21H END

Das könnte Ihnen auch gefallen