Write Intel 8086 assembly programs use the NASM assembler W

Write Intel 8086 assembly programs - use the NASM assembler

Write a program called COUNT to count the number of characters in a null-terminated ASCII string that are equal to a KEY. The
KEY is stored in memory location 0x0150. The string is stored in memory beginning at address 0x0160. Store the 8-bit count in
memory location 0x0154. (Assume the maximum count is 255.)

Solution

DATA SEGMENT

STR1 DB \"ABCDEFGHIJ\"

STR2 DB \"BDCDABCDEF\"

CNT DB 0H

MSG1 DB 10,13,\'FISRT STRING IN MEMORY IS : $\'

MSG2 DB 10,13,\'SECOND STRING IN MEMORY IS : $\'

MSG3 DB 10,13,\'COUNT OF SAME POSITION EQUAL CHAR(S) IS : $\'

DATA ENDS

DISPLAY MACRO MSG

MOV AH,9

LEA DX,MSG

INT 21H

ENDM

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START:

MOV AX,DATA

MOV DS,AX

DISPLAY MSG1

DISPLAY STR1

DISPLAY MSG2

DISPLAY STR2

LEA SI,STR1

LEA DI,STR2

MOV CX,10

CHECK:

MOV AL,[SI]

CMP [DI],AL

JNE NOTEQU

INC CNT

NOTEQU: INC SI

INC DI

LOOP CHECK

DISPLAY MSG3

MOV DL,CNT

ADD DL,30H

MOV AH,2

INT 21H

MOV AH,4CH

INT 21H

CODE ENDS

END START

Write Intel 8086 assembly programs - use the NASM assembler Write a program called COUNT to count the number of characters in a null-terminated ASCII string tha
Write Intel 8086 assembly programs - use the NASM assembler Write a program called COUNT to count the number of characters in a null-terminated ASCII string tha

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site