.lcomm var1 8 .global _start _start: # load the address of "var1" into register %eax movl $2,%eax # eax = 2 movl $var1,%ebx movb $0xcd,1(%ebx,%eax,2) # ((char*)var1)[eax] = 0xcd # ebx is the base register, and it has the address of var1 # eax is the index register, and it is initialized to 2 # the scaling factor is 2 # the displacement is 1 # the effective address is: # %ebx(base reg) + 1(displacement) + (%eax (index reg) * 2 (scaling factor)) # address of var1 + 1 + (2 * 2) # address of var1 + 5 # the sixth byte from var1 will be initialized to 0xcd movl $0, %ebx movl $1, %eax int $0x80