What does the dollar symbol mean in

jz $+2

(This is IDA output.)


The dollar symbol in this instance means "current position." This is the position this instruction begins at, and then plus two bytes. This instruction is two bytes, so it jumps to the next instruction past this one. It's effectively garbage.

  • 3
    it can also be a sign of conditionally-compiled code that is not present in that configuration (maybe in debug mode, there is a message printed in some circumstances, and the branch would skip it). – peter ferrie Aug 5 '13 at 20:33
  • It's also present in a lot in non-optimized code (like 1990 16bit x86 game code) in switch statements where the last item also "jumps to the end" even though it is at the end already. – Simeon Pilgrim Oct 10 '13 at 3:57
  • Especially in older MS-DOS programs, statements like this were often used betwen inb/outb instructions, to give some time to external hardware that was slower than the processor. – Guntram Blohm Dec 28 '14 at 14:58
  • On some assemblers for the 6502, the symbol * is used to refer to the starting address of the current instruction, and $ is used to refer to the address of the following instruction. So BNE *-3 or BNE $-5 would loop to an instruction that starts 3 bytes before the BNE, while BEQ *+2 or BEQ $ would execute the same next instruction whether the condition was true or not, but take an extra cycle if the Z flag is set (note that page crossings are measured based upon the address of the instruction after the branch, so BEQ $ would never take an extra cycle for a page crossing.) – supercat Dec 4 '20 at 22:36

Jump two bytes forward from current position when zero flag == NULL Opcode for this 74 00 which is two bytes

seg000:00000000 74 00                    jz      short $+2
seg000:00000002 74 00                    jz      short $+2

so effectively it will jump to next instruction whether the condition is met or not garbage mostly used in obfuscation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.