wiki:Sperimentazione 2

Version 15 (modified by Mattia Monga, 7 years ago) ( diff )

--

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
Note: See TracWiki for help on using the wiki.