Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9051001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:47:44+00:00 2026-06-16T12:47:44+00:00

Could anyone tell me how to compare two strings in assembly language, I`ve written

  • 0

Could anyone tell me how to compare two strings in assembly language, I`ve written the followign, but it does not seem to work.

assume cs:code, ds:data

data segment
sirlung db "abcdjjj"
lungimelung equ $-sirlung
sirscurt db "aby"
lungimescurt equ $-sirscurt
exista db "Exista!$"
nuexista db "NU exista!$"
iesire db "Apasa enter pentru iesire!$"


data ends

code segment
start:
mov ax,data
mov ds,ax

mov bx,offset sirlung
mov di,offset sirscurt
dec bx
push bx
push di
mov dx,lungimelung
mov si,lungimescurt
bucla1:
    pop di
    pop bx
    inc bx
    mov al,sirlung[bx]
    mov cl,sirscurt[di]

    cmp al,cl
    jne bucla1
    push bx
    push di
    je bucla2
    cmp bx,dx
    ja sfarsit_nu_exista
bucla2:
    inc bx
    inc di
    mov al,sirlung[bx]
    mov cl,sirscurt[di]
    cmp al,cl
    jne bucla1      
    cmp di,si
    jl sfarsit_exista
    jae bucla2





sfarsit_exista:
mov dx,offset exista
mov ah,09h
int 21h
mov ah, 0ah
mov dx,offset iesire
int 21h
mov ax,4c00h
int 21h

sfarsit_nu_exista:
mov dx,offset nuexista
mov ah,09h
int 21h
mov ah, 0ah
mov dx,offset iesire
int 21h
mov ax,4c00h
int 21h

code ends
end start
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:47:45+00:00Added an answer on June 16, 2026 at 12:47 pm

    I had the same problem when I was writing asm in school, years ago. The problem I encountered was that I wanted to compare the word “exit” with a user entry. If they typed “exit”, the application quit. If they typed anything else, then a message appeared telling them there was an erroneous entry.

    The way I solved the issue was to compare the strings character-by-character, until the characters no longer matched, or vice-versa.

    This also might be of some use. Here are some code examples relating to string comparison in assembly language: http://www.daniweb.com/software-development/assembly/threads/58667/assembly-language-comparing-strings

    You might also want to look at this article relating to regular expressions (regex) in assembly language: Regular Expressions and Assembly

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the code, I don't quite understand, how does it work. Could anyone tell,
Could anyone tell me why this code does not working? self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
Could anyone tell me why my $_SESSION variables are not being carried over to
Could anyone tell me why this doesn't work? enum CompCriteria{ByKey,ByValue,ByeKeyAndValue}; template<class T> struct X;
Could anyone tell me why a problem in the noun model would not be
Could anyone tell me why Facebook comments are not working properly? 50% of the
Could anyone tell me why this code doesn't work? I can't even get the
Could anyone tell me what does 0x48ff25 means in the following disassamble code? 00000000`7745b0ac
Please, could anyone tell me what does above mentioned mean? I'm optimizing one Drupal
I run the following command on ubuntu 10.10. Could anyone tell me what does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.