JMP START
CR equ 13 ; RETURN is 13D ASCII
LF equ 10 ; LINE FEED is 10D ASCII
letterUnitCount DB 0
letterTensCount DB 0
vowelCount DB 0
getWord: DB "Please enter a word",CR, LF,"$"
letterCountMessage: DB CR, LF, "Number of Characters: ", "$"
msg1: DB CR, LF, " this is palindrome!", "$"
msg2: DB CR, LF, " this is not a palindrome!", "$"
inWord: DB 128 DUP (0)
START:
LEA DX,getWord ;Output string asking user for word
MOV AH,09h ;DOS call to output string
INT 21H ;Execute interrupt 21H
KEYBUF:
LEA DI,inWord ;Load inWord start address into DI
NEXTCHAR:
MOV AH,01h
INT 21H ;Read key pressed and echo to screen
CMP letterUnitCount, 10
JE ROLLOVER
UNIT:
INC letterUnitCount
;CMP AL, 65
;JE INCRVOWEL
;CMP AL, 97
;JE INCRVOWEL
STORE:
MOV [DI],AL ;store in inWord at position [DI]
INC DI ;Make DI point to next byte in inWord
CMP AL,0Dh ;Was it the carriage return key?
JNZ NEXTCHAR ;NO, get some more characters
MOV [byte ptr DI],"$" ;YES, add end of string marker
MOV SI, DI
COMPARE:
ADD SI, DI
DEC SI
MOV AL, [DI]
MOV DL, AL
MOV AH, 2
INT 21h
MOV BL, [SI]
MOV DL, BL
MOV AH, 2
INT 21h
CMP AL,BL
JNE NOTPAL
INC DI
DEC SI
LOOP COMPARE
ISPAL:
MOV DX, msg1
MOV AH, 09h
INT 21h
NOTPAL:
MOV DX, msg2
MOV AH, 09h
INT 21h