Lets go over how to create local variables inside of a pure assembly source code. Much like always, you will start with a *.asm file that looks like this: source code SECTION .data SECTION .bss SECTION .text global main ;make main available to operating system(os) main: ;create the stack frame push ebp push mov ebp, esp ;destroy the stack frame mov esp, ebp pop ebp ret So, the above is the general layout of an NASM source file. Our goal here is to create a local variable inside of the main method. The only way to create a local variable is by using the stack. Why? Because we can only declare variable in storage locations and the only available storage locations are: text, bss, and data. However, text section is only for code, so it is out of the question. The bss and data sections are appealing, but to declare our "local" variable in these sections will defeat the purpose of these varia...
I blog to share what I know and have experienced with others.