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 8530957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:22:26+00:00 2026-06-11T09:22:26+00:00

There’s something wrong with messages block and it’s output (print_less, print_more, print_equal, print_final). I

  • 0

There’s something wrong with “messages” block and it’s output (print_less, print_more, print_equal, print_final). I really don’t know how to store strings, so that’s why I’m getting all of them in my output instead of just two of them (print_less or print_more or print_equal + print_final).

Here’s the code:

format ELF64 executable


;=============================================
;================== DATA =====================
;=============================================
segment readable writeable
;=============================================


;=============================================
;                 variables
;=============================================

a dq 26h
b dq 100h 
c dq 4h
d dq 3h


;=============================================
;                 messages
;=============================================

msg_less db 'a < b',0xA,0
msg_more db 'a > b',0xA,0
msg_equal db 'a = b',0xA,0
msg_final db 'Completed successfully',0xA,0


;=============================================
;               message sizes
;=============================================

msg_more_size = $-msg_more
msg_less_size = $-msg_less
msg_equal_size = $-msg_equal
msg_final_size = $-msg_final


;=============================================
;================== CODE =====================
;=============================================
segment readable executable
;=============================================

entry $

_begin:
    mov rcx,[a]
    cmp rcx,[b]

    jl  print_less
    jg  print_more
    je  print_equal

_final:
    mov edx,msg_final_size
    lea rsi,[msg_final]

    mov edi,1   ; STDOUT
    mov eax,1   ; sys_write
    syscall

    jmp syscall_exit


;=============================================
;             print message segment
;=============================================

print_less:
    mov edx,msg_less_size
    lea rsi,[msg_less]
    jmp syscall_msg

print_more:
    mov edx,msg_more_size
    lea rsi,[msg_more]
    jmp syscall_msg

print_equal:
    mov edx,msg_equal_size
    lea rsi,[msg_equal]
    jmp syscall_msg


;=============================================
;               syscall segment
;=============================================

syscall_msg:
    mov edi,1   ; STDOUT
    mov eax,1   ; sys_write
    syscall

    jmp _final

syscall_exit:
    xor edi,edi ; exit code 0
    mov eax,60  ; sys_exit
    syscall

output:

[look@me ~]$ fasm ~/workspace/ASM/ASM1/asm.asm && ~/workspace/ASM/ASM1/asm
flat assembler  version 1.70.03  (16384 kilobytes memory)
3 passes, 364 bytes.
a < b
a > b
a = b
Completed successfully
Completed successfully
  • 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-11T09:22:27+00:00Added an answer on June 11, 2026 at 9:22 am

    Your length calculations are incorrect. For instance the value of msg_more_size would be:

    msg_more_size = msg_equal-msg_more
    

    $ is actually denotes where your current code location is. So $-msg_more means almost the whole string.

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

Sidebar

Related Questions

There have been multiple questions regarding this topic but I have never really settled
There is a constructor of lucene Field: Field(String name, String value, Store store, Index
There are often times when you know for a fact that your loop will
I know there's a lot of other questions out there that deal with this
There is something strange happening. Param interceptor is the one in charge to take
There is something I miss with the notion of Synchronizing code in Android. Scenario
There's a webpage with something annoying on it which I'd like to hide every
There is a moment in my app, that I need to force to show
There is a column that exists in 2 tables. In table 1, this column
There's a Rails 3.2.3 web application which doesn't use any database. But in spite

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.