assembly "mov" instruction
assembly, instruction-set, mov
Solution
movl $10,24(%esp)
means: move a literal decimal-10 long (4-bytes) into a 4-byte memory location that begins at the address pointed to by (the `esp` register plus decimal 24)--basically it is a local variable.
Problem
I'm learning assembly by comparing a c program to its assembly equivalent. Here is the code. ``` .file "ex3.c" .section .rodata .LC0: .string "I am %d years old.\n" .LC1: .string "I am %d inches tall.\n" .text .globl main .type main, @function main: pushl %ebp //establish stack frame// movl %esp, %ebp //move esp into ebp, all contents saved down stack// andl $-16, %esp //16 from esp for local var space// subl $32, %esp//stack frame reserving - 32 bytes// movl $10, 24(%esp) movl $72, 28(%esp) movl 24(%esp), %eax movl %eax, 4(%esp) movl $.LC0, (%esp) call printf movl 28(%esp), %eax movl %eax, 4(%esp) movl $.LC1, (%esp) call printf movl $0, %eax leave ret .size main, .-main .ident "GCC: (Ubuntu 4.8.2-19ubuntu1) 4.8.2" .section .note.GNU-stack,"",@progbits ``` For this line: ``` movl $10, 24(%esp) ``` If I understand it correctly it is saying move the value of 10 into the esp register. But what is the 24 doing? I don't think it is moved into esp because a value to be moved is denoted by "$" (i think)