Page 1 of 1

"Illegal instruction" - nothing works

Posted: Tue Jan 26, 2010 1:52 pm
by Merdini
I just installed TASM and before that, i tried FASM.
I get "Illegal instruction" on the first line even though there is nothing work.

Something as simple as:

Code: Select all

DOSSEG
.MODEL SMALL
.STACK 100h
.DATA
HelloMessage DB 'Hello, world',13,10,'$'
.CODE
mov ax,@data
mov ds,ax
mov ah,9
nov dx, OFFSET HelloMessage
int 21h
mov ah,4ch
int 21h
END
Any ideas?
I use windows obviously.

Re: "Illegal instruction" - nothing works

Posted: Tue Jan 26, 2010 2:11 pm
by Love4Boobies
I may be mistaken but IIRC you had to do something like

Code: Select all

.code
somelabel:
end somelabel
I know there are two ways of specifying the entry point using that syntax but I'm not sure yours is one of them. I've used MASM in the past; I know TASM is somewhat different and I know nothing about FASM. Hope I helped.

Re: "Illegal instruction" - nothing works

Posted: Tue Jan 26, 2010 2:30 pm
by Merdini
Thanks for you help.

Whatever i try, i get the "illegal instruction" error on the first line :?

EDIT:
Okay, i think im doing some other things wrong aswell.
Im just starting to learn Assembly, and the following code:

Code: Select all

.model small
.stack
.data
message   db "Hello world, I'm learning Assembly !!!", "$"
.code
main   proc
   mov   ax,seg message
   mov   ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
main   endp
end main
gets a error on the first line. This is what i've been told about the first line:
.model small : Lines that start with a "." are used to provide the assembler with infomation. The word(s) behind it say what kind of info. In this case it just tells the assembler the program is small and doesn't need a lot of memory.

What can the problem be?

EDIT2:
It worked now with TASM =)

Re: "Illegal instruction" - nothing works

Posted: Wed Jan 27, 2010 12:33 am
by Thomas
Hi,
The words with dot are called Assembler directives that are used to instruct the assembler than the machine.You should consider learning to use the DEBUG utility and figure out what went wrong ( since you are doing real mode assembly).{Most possible cause of your error message is you not setting up the segment registers properly.}

{Please do excuse my poor english}
--Thomas

Re: "Illegal instruction" - nothing works

Posted: Thu Jan 28, 2010 3:28 am
by qw
Shouldn't "DOSSEG" be ".DOSSEG"?

Re: "Illegal instruction" - nothing works

Posted: Sat Jan 30, 2010 1:24 am
by Love4Boobies
I looked up a FASM example and it didn't look anything like MASM. You should probably know that each assembler is different; assembly, unlike C, is not a standard language. You'll need to learn each assembler's syntax. For the one you're using I suggest using JWasm.