EDWRDQFW—26
D03DAILY — ASM

asm

some x86-64. read it, run it in your head, say what's left in the register.

loading today's snippet…

    how to play

    1. read the snippet top to bottom. registers start at 0, the stack pointer starts at 0x7fff0000.
    2. work out the value the question asks for when the last line has run.
    3. type it in decimal or hex. you get 3 tries, each with a too high / too low hint (unsigned).
    4. flag questions (zf, cf, sf) are a single 0 or 1. one shot.

    faq

    what instructions show up?

    mov, add, sub, imul, and, or, xor, not, neg, shl, shr, sar, inc, dec, lea, cmp with conditional jumps, push, pop, xchg, and small loops. all registers are 64-bit and wrap around like real hardware.

    how do i enter a negative number?

    type it with a minus sign (-14) or as the full 64-bit hex value (0xfffffffffffffff2). both count. too high / too low compares as unsigned, the way the cpu stores it.

    what's the difference between shr and sar?

    both shift right. shr fills the top with zeros (unsigned divide by 2ⁿ). sar copies the sign bit (signed divide by 2ⁿ, rounding toward negative infinity). they only differ when the top bit is set.

    how hard is it?

    monday is a handful of adds and moves. by the weekend you'll see loops, signed/unsigned jumps and flag questions. the step-by-step table after each puzzle shows every register change.

    made by edwrdq