Quantcast
Channel: x86 Assembly - Programmers Heaven
Viewing all articles
Browse latest Browse all 152

ERROR: ILLEGAL IMMEDIATE IN JMP INSTRUCTION

$
0
0
Hi to every body,

i have searched around all internet and i can't find a response to solve this error. It is good to say that i'm new, and learning by my self from a book.

well, the problem:

i'm working with: tasm 4.1 , turbo link version 7.1.30.1 and turbo debugger 5.0

this is my file "ej3.asm":
--------ej3.asm-----------
.model tiny
.code
org 100h
main:

mov al , 19h
mov ah , 20h

jmp 100h
int 20h
end main
-------end of file------

also i have writen a .bat file in order to automatizate my proceses.it is called "compile.bat" and it looks like this:

-------compile.bat---------
tasm ej3.asm ;to build the .obj file
pause
tlink /t ej3.obj ;to create the .com file
pause
td ej3 ;to review and check/learn what really happens
pause
------end of file-----------

ok, as you can see the code is really simple!:S.

BUT, when i run the compile.bat file or i type "tasm ej3.asm" in the shell, this error appears:

Asembling file: ej3.asm
**Error** ej3.asm(8) Illegal immediate
Error messages: 1
Warning messages: None
Passes: 1
Remaining memory: 447k

the instruction JMP is in the line 8, i have tried changing to "jmp 100", "jmp 0100", "jmp 0100h","jmp 0101","jmp 0101h" and it do not works.
In theory this instructions are valid, because they JMP make a should jump to (change the IP register) the specified instrucion, in this case the instruction placed in 0100 position.

Also i have tried changing to "jmp cs:0100h" it works ( ther is no ERROR and the program jumps), BUT , it is readed as "jmp cs:[0100h]" (i can see it in the debugger) so the program jump to another place, a really really far a way place. also i have tried with "cs:[100]","ds:[100]","ds:[100h]","ds:[101]", an so on. in the debugger i can see that cs and ds are pointing to the same place.

also, i have tried with "jmp main" and IT WORKS!! but, as far as know the error must not appear. and it is so complicated to make code writing a label "main, p0 , and so on" to every codeline.

so.....

what is wrong in all this?
how can i solve the problem?
why the error??
thanks for the help.





Viewing all articles
Browse latest Browse all 152

Trending Articles