Write and execute an alp to 8086 Microprocessor to reverse the given string and verify whether it is a palindrome.
Aim:
To write and execute an ALP to 8086 processor to reverse the given string and verify whether it is a palindrome.
Tools:
PC installed with MASM 6.11
Program:
.MODEL SMALL .STACK 45H ASSUME CS : CODE, DS : DATA DATA SEGMENT CR EQU 0DH LF EQU 0AH INS DB 40 DUP(0) RES DB 40 DUP(0) MSG1 DB 'ENTER THE STRING.INPUT STRING = ','$' MSG2 DB CR,LF,'REVERSE OF STRING = ','$' MSG3 DB CR,LF,'INPUT STRING IS PALINDROME','$' MSG4 DB CR,LF,'INPUT STRING IS NOT A PALINDROME','$' DATA ENDS DISP MACRO MSG MOV AH, 09H MOV DX, OFFSET MSG INT 21H ENDM CODE SEGMENT START : MOV AX, DATA MOV DS,AX MOV SI,OFFSET INS MOV DI,OFFSET RES DISP MSG1 MOV CX,00H RDCHAR : MOV AH, 01H INT 21H CMP AL, CR JE AHEAD MOV [SI],AL INC SI INC CX JMP RDCHAR AHEAD : MOV BX, CX REVERSE : DEC SI MOV AL, [SI] MOV [DI], AL INC DI LOOP REVERSE MOV AL, '$' MOV [DI], AL DISP MSG2 DISP RES MOV SI, OFFSET INS MOV DI, OFFSET RES MOV CX, BX CHECK : MOV AL, [SI] CMP AL, [DI] JNE FALSE INC SI INC DI LOOP CHECK DISP MSG3 JMP EXIT FALSE : DISP MSG4 EXIT : INT 03H CODE ENDS END START END
Result:
Input:
STR1 DB 01H, 02H, 03H, 04H
Output:
Strring reversal = 04Hh.03H, 02H.01H
Viva-voce questions:
1. Which instruction is used for indicating the direction for string operations? 2. What is a linker? 3. How an XCHG instruction works? 4. What is the role of REP? 5. What is the difference between base address and offset address of a word?
-
UpdatedOct 23, 2014
-
Views9,759
Write and execute an alp to 8086 Microprocessor to add, subtract and multiply two 16 bit unsigned numbers. Store the result in extra segment
Write and execute an alp to 8086 Microprocessor to a sort the give array of 32 bit number in ascending and descending order.
Program to generate following waveforms
- Ramp waveform
- Square waveform
- Step waveform
- Triangle waveform
Write and execute an alp to 8086 Microprocessor to find the length of a given string which terminates with a special character
Write and execute an alp to 8086 Microprocessor to divide a 32 bit unsigned numbers by a 16 bit unsigned number. Store the result in stack segment
Interface a stepper motor to 8086 and operate it in clock wise and anticlockwise by choosing variable stepsize.