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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:34:49+00:00 2026-06-12T07:34:49+00:00

When disassembling an old .com executable file compiled from a code like this: .model

  • 0

When disassembling an old .com executable file compiled from a code like this:

.model tiny             ; com program
.code                   ; code segment
org 100h                ; code starts at offset 100h    

main proc near
   mov ah,09h           ; function to display a string  
   mov dx,offset message    ; offset ofMessage string terminating with $
   int 21h              ; dos interrupt

   mov ah,4ch           ; function to terminate
   mov al,00
   int 21h              ; Dos Interrupt 
endp 
message db "Hello World $"      ; Message to be displayed terminating with a $
end main

in hex it looks like this:

B4 09 BA 0D 01 CD 21 B4 4C B0 00 CD 21 48 65 6C
6C 6F 20 57 6F 72 6C 64 20 24

how the disassembler knows where the code ends and the string “Hello world” starts?

  • 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-12T07:34:50+00:00Added an answer on June 12, 2026 at 7:34 am

    Disassembler does not know where the code ends and where the data starts in a .com file, because in .com files there is no such distinction. In .com files everything is loaded into the same segment and as DOS runs in real mode and does not have any kind of memory protection at all, you can for example write obfuscated code that looks like regular text and jump into it in your code. For example (possibly crashes DOS, haven’t tested):

    _start: jmp hello
    
    hello:
    db "Hello World!"
    
    ret
    

    So db "Hello World $" is perfectly valid 16-bit code (checked with udcli disassembler that comes with udis86 disassembler library for x86 and x86-64 in Linux:

    $ echo `echo 'Hello World $' | tr -d "\n" | od -An -t xC` | udcli -x -16
    
    0000000000000000 48               dec ax            ; H
    0000000000000001 656c             insb              ; el
    0000000000000003 6c               insb              ; l
    0000000000000004 6f               outsw             ; o
    0000000000000005 20576f           and [bx+0x6f], dl ; <space>Wo
    0000000000000008 726c             jb 0x76           ; rl
    000000000000000a 642024           and [fs:si], ah   ; d<space>$
    

    However, db 0x64 0x20 0x24 is not valid 32-bit or 64-bit code.

    This is 32-bit disassembly of db "Hello World! $":

    $ echo `echo 'Hello World $' | tr -d "\n" | od -An -t xC` | udcli -x -32
    
    0000000000000000 48               dec eax            ; H
    0000000000000001 656c             insb               ; el
    0000000000000003 6c               insb               ; l
    0000000000000004 6f               outsd              ; o
    0000000000000005 20576f           and [edi+0x6f], dl ; <space>Wo
    0000000000000008 726c             jb 0x76            ; rl
    000000000000000a 642024           invalid            ; d<space>$
    

    What a disassembler can do is to use some heuristics and code tracing to decide whether to print some parts of the disassembly as code and some other parts as data. But a disassembler can never know where code ends and where data begins, because in .com files such distinction exists only in the programmer’s head and possibly in source code and in assembler’s limitations, but not in the binary .com file format itself.

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

Sidebar

Related Questions

I have a 64-bit COFF object file (no source code or debug info) from
I'm disassembling a bit of code and I came across: mov eax, cr3 mov
I'm disassembling a firmware using IDA (mipsb processor) I'm seeing this a lot in
I'm currently disassembling a Mach-O executable(the executable runs on Mac OS X, to be
Currently, I'm disassembling a Mach-O executable in IDA Pro. I've gone through and found
I'd like to ask is making connection to mysql in code of client-side application
I am examining the private c++ function hooking code snippet from mobilesubstrate and see
Have found a function address in a DLL. Have no source code for this
So I'm disassembling some code (binary bomb lab) and need some help figuring out
I am disassembling a lot of iOS operation system code now (frameworks, system daemons).

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.