0

Today I was designing a poster for a friend that said 'eat (burger), sleep ("ZZZ"), code (</>), repeat'
For the 'repeat' part I want to use the assembly instruction 'EB', I know that "EB FE" will jump to the same line (infinite loop) but am I right in saying that "EB FB" will jump me back to the beginning of the poster?

If not how would I do that and is there a 'more nerdy' way of doing a repeat? (thats not a 'while loop')

3
  • IMO, hex offsets don't work as a joke/pun unless they say something when read as plaintext (as in e.g. 0xBADF00D). Anyway, to calculate the real offset you would need to know the length of the instructions eat and sleep and you can't since they're not real instructions :) Commented Sep 8, 2014 at 10:29
  • Ah fair enough, That makes sense. Any suggestions for a substitute? Commented Sep 8, 2014 at 10:32
  • EB FB will jump back 5 bytes, i.e. -5, relative to next instruction immediately after EB FB Commented Jul 8, 2017 at 7:08

1 Answer 1

5

EB FB would jump 3 bytes back, relative to the start of the jump instruction.

test.asm:

start: nop nop nop jmp start 


C:\nasm>nasm -f bin -o test.com test.asm C:\nasm>ndisasm test.com 00000000 90 nop 00000001 90 nop 00000002 90 nop 00000003 EBFB jmp short 0x0 
Sign up to request clarification or add additional context in comments.

1 Comment

Ah thank you! that answers my question but as '500-internal server error' pointed out, without knowing the length of the 'eat, sleep, code' instructions theres no way of knowing how far back to jump.. so I'm still open to suggestions for another way!