MOV DS, AX MOV AX,EXTRA MOV ES, AX MOV AX.LEN1 MOV BX, LEN2 CMP AX, BX JNE EXIT MOV CX, AX MOV SI, OFFSET LIST1 MOV DI, OFFSET LIST2 CLD REP CMPSB JNE EXIT MOV RESULT, 0FFFFH JMP NEXT MOV RESULT, 0000H EXIT: INT 03H NEXT: CODE ENDS;END START RESULT: REVERSAL OF GIVEN STRING ABSTRACT: Assembly language program to reverse a given string APPARATUS: Personal computer with TASM software. ALGORITHM: Start Step1: Step2: Initialize data segment & code segment Step3: Load starting address of the string in SI Obtain end address in DI. Step4: Get 1st character of the string into AL Step5: Step6: Exchange it with final character. Step7: Increment SI and decrement DI Repeat steps 6 & 7 until SI less than DI. Step8: Verify Result. Step9: Stop Step10: PROGRAM: ASSUME CS:CODE,DS:DATA CODE SEGMENT MOV AX, DATA
MOV DS, AX MOV AX,EXTRA MOV ES, AX MOV AX.LEN1 MOV BX, LEN2 CMP AX, BX JNE EXIT MOV CX, AX MOV SI, OFFSET LIST1 MOV DI, OFFSET LIST2 CLD REP CMPSB JNE EXIT MOV RESULT, 0FFFFH JMP NEXT EXIT: MOV RESULT, 0000H NEXT: INT 03H CODE ENDS;END START RESULT: REVERSAL OF GIVEN STRING ABSTRACT: Assembly language program to reverse a given string APPARATUS: Personal computer with TASM software. ALGORITHM: Step1: Start Step2: Initialize data segment & code segment Step3: Load starting address of the string in SI Step4: Obtain end address in DI. Step5: Get 1st character of the string into AL Step6: Exchange it with final character. Step7: Increment SI and decrement DI Step8: Repeat steps 6 & 7 until SI less than DI. Step9: Verify Result. Step10: Stop PROGRAM: ASSUME CS:CODE,DS:DATA CODE SEGMENT MOV AX, DATA