Assembly program demonstrating integer variable definition, loading, incrementing, and saving in 32-bit x86 NASM syntax on Linux user mode.
; x86 32-bit assembly program that defines and uses an integer variable
section .data
mia_variabile dd 10 ; Definition of a 32-bit integer variable initialized to 10
section .text
global _start ; Program entry point
_start:
; Load the value of mia_variabile into the EAX register
mov eax, [mia_variabile] ; EAX = mia_variabile
; Increment the value of EAX by 1
add eax, 1 ; EAX = EAX + 1
; Save the new value of EAX into mia_variabile
mov [mia_variabile], eax ; mia_variabile = EAX
; Program termination with exit syscall
mov eax, 1 ; syscall number 1 = sys_exit
mov ebx, 0 ; exit code 0
int 0x80 ; kernel callProcessor: x86 32-bit
Assembler: NASM (Netwide Assembler)
Operating system: Linux (to run the program in user mode)
Variable: defined in the data section as a 32-bit integer
I/O: no input/output, the program modifies the variable in memory
Software configuration: no external dependencies, compile with 'nasm -f elf32 programma.asm' and link with 'ld -m elf_i386 -o programma programma.o'
Arduino: not applicable in this generic assembly example for PC