wiki:Sperimentazione 2

segment .text                   ; segmento "testo" (istruzioni)
global main                     ; nome convenzionale
extern printf, exit

main:
  mov eax, 24
  add eax, 42
  mov [x], eax

  push dword [x]
  push fmt
  call printf

  push 0
  call exit

segment .data                   ; segmento dati
x: 
  dw 0

segment .rodata                 ; segmento dati in sola lettura
fmt: 
  db 'Risultato: %d',10,0

nasm -f elf -o ada.o ada.asm 
gcc -o ada ada.o
./ada

 nasm -f elf -o syscall.o syscall.asm
 gcc -o syscall syscall.o
 ./syscall
Last modified 19 months ago Last modified on Mar 8, 2017, 2:00:54 PM