TITLE Proj2
PAGE 56,90
; I used your Lab05 as a template for this
; ----------------------------------------
;
;
; This program will take a name entered by the user
; and display it backwards. It will also tell the
; user whether the word is a palindrome or not.
; ----------------------------------------
.MODEL SMALL
.STACK 100H
.DATA
CR EQU 0DH ; Carriage Return Code
LF EQU 0AH ; Line Feed Control Code
DOSEXIT EQU 4CH ; DOS exit code for 21h int
para_list LABEL BYTE
max_len db 20
act_len db ?
theword db 20 DUP(' ')
MSG1 DB CR,LF,'Enter a word $'
ItIs DB CR,LF,'The word is a Palindrome $'
ItIsNot DB CR,LF,'The word is not a Palindrome $'
SPACE DB CR,LF,'----------------------------$'
MSG2 DB CR,LF,'The word backwards is '
wordbw DB CR,LF, 12 DUP(20H),'$'
; --------- End of Data Segment ----------
.CODE
Main PROC
;------------------------------------------
; The routine performs basic
; "housekeeping" operations necessary in
; any Assembly Language Program running
; under DOS or Windows...
; 1 - Establish Addressability to the
; Data Segment of the program.
;------------------------------------------
HouseKeeping:
mov ax,@data ;get addr. of DSeg.
mov ds,ax ;set in DS Reg.
;------------------------------------------
; Routine "GetPut" will...
; 1 - Display prompt message.
; 2 - capture user provided ASCII
; letter (located in AL register).
; 3 - Convert the letter to it's decimal
; equivalent.
; 4 - Display the converted letter within
; an "echoing" message.
;------------------------------------------
Prompt:
lea dx,MSG1 ;addr. of 1st msg
mov ah,9h ;set for str. displ.
int 21H ;call DOS to displ.
; DISPLAY MESSAGE ABOVE;
GetWord:
mov ah,0Ah ;set func. to Get String
lea DX,Para_list ;load address of para list
int 21H ;call DOS (val-AL)
mov theword,al ;move input to theword
lea dx,space ;addr. of 1st msg
mov ah,9h ;set for str. displ.
int 21H ;call DOS to displ.
CLD
MOV CX, 20
LEA SI,theWORD
L20:
LODSB
mov [di],AL
dec di
XOR BX, BX
mov bl, act_len
LEA DI, WORDBW[bx]
loop l20
lea dx, wordbw
mov ah,9h
int 21h
jmp pgmexit
;------------------------------------------
; The routine sets the exit code and
; calls DOS. This is the appropriate
; technique for terminating a non-
; resident program running under DOS.
;------------------------------------------
PgmExit:
mov ah,DOSEXIT ;set Exit code
int 21H ;and call DOS
Main EndP
End Main
My problem is that it is not outputting the reworsed word. I want to create a second string (that is the word backwards), and then compare the two strings if they are the same.
Any ideas? I've been trying for weeks and have been so stuck. I even posted here for no responces.