Author Topic: my executbales are illegal to my comp?!?  (Read 8120 times)

nobody

  • Guest
my executbales are illegal to my comp?!?
« on: February 12, 2005, 02:37:27 AM »
creating this simple hello world prog:

org 100h
    mov dx,msg
    mov ah,9
    int 21h
    mov ah,4Ch
    int 21h
    msg db 'Hello, World!',0Dh,0Ah,'$'

when i executed it, the computer threw a security error. it said it was going to perform an illegal instruction

nasm64developer

  • Guest
Re: my executbales are illegal to my comp?!?
« Reply #1 on: February 15, 2005, 02:22:02 PM »
INT 21h function 09h expects DS:DX to point
to the string. So... where did you load DS?

nobody

  • Guest
Re: my executbales are illegal to my comp?!?
« Reply #2 on: October 26, 2005, 05:58:56 PM »
DS is set to the current segment in com files that's not the problem, the problem is that you need to put the offset of msg to dx, not msg itself.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: my executbales are illegal to my comp?!?
« Reply #3 on: October 28, 2005, 01:25:34 PM »
True, the dos loader sets up ds (for a .com file only!), so that's not the problem. And "mov dx, msg" *does* put the offset in dx, not "msg itself" (I assume you mean "contents" - the letters "H" and "e" - Nasm would want "mov dx, [msg]" for that!), so that isn't the problem, either.

The code, as given, looks perfectly allright - for a dos .com file. So the problem would seem to be that "my comp" doesn't like dos .com files... for some reason... Trying it in Linux would result in "can't execute binary file", rather than "illegal operation"... Windows, while it won't run 16-bit code directly, should recognize a .com file and run it as a vm86 task... Damned if I know what the problem is!

If the original poster is still around (unlikely), and hasn't long since solved the problem (even less likely), what command-line did you give Nasm to assemble this, what OS are you running, and exactly what does the error-message say?

Best,
Frank