LOGBOOK

HELP

Quiz Entry - updated: 2026.07.10

What is the "dot symbol" (.) in assembly and what is it useful for?

. is the location counter — it always equals the address of the very spot the assembler is currently writing to.

A byte strip spelling Hello, world! with the hstr marker at address 0x1000 on the left and the location counter dot at 0x100E on the right, annotated hlen = . - hstr = 14.

* The location counter advances one byte per emitted character; subtracting the start label yields the string length as a compile-time constant. *

Think of the assembler as walking left-to-right through your file, placing bytes into memory and advancing a cursor. That cursor's address is .. Because you can do arithmetic with it, you can compute things like a string's length at assembly time, with zero runtime cost:

hstr:
    .ascii "Hello, world!\n"
hlen = . - hstr

Step by step:

  1. hstr: records the current address (say 0x1000).
  2. .ascii "Hello, world!\n" writes 14 bytes — the location counter advances to 0x100E.
  3. Now . equals 0x100E, so hlen = . - hstr = 0x100E - 0x1000 = 14.

hlen becomes a compile-time constant baked into the binary — no runtime strlen() needed. Edit the string and reassemble, and hlen updates itself automatically.

Tip: This is exactly how the classic hand-written "Hello, world" passes a count to the write syscall without hardcoding a magic number.

Go deeper:

From Quiz: REVE1 / Translation of C to Assembly | Updated: Jul 10, 2026