How can I write a short bitwise code as jmp $ without directives?

63 views Asked by At

I have a one line program in assembly

`jmp $

When compiling the program

nasm -f bin jmp$.s -o a.out

It generates a file a.out in binary. Seeing him with xxd a.out

00000000: ebfe

My understanding is that logically jmp $, for this particular case, should be the same as jmp -2 or jmp 0. Compiling both cases and looking shows me

00000000: e9fb ff

Which effectively do the same logically, but take up a bit more. According to the intel manual vol 2 chapter 3 section 3.3 jmp. The difference of the two is that one is that BE is JMP rel8 and E9m is JMP rel16.

My goal is that I don't want to use assembler directives, I just want to use assembly Intructions and I want to make the shortest bitwise statement possible. I want ebfe as a result but without using directives, what should I do? Please. Thanks.

0

There are 0 answers