%include "asm_io.inc"
;
; initialized data is put in the .data segment
;
segment .data

	
;
; uninitialized data is put in the .bss segment
;
segment .bss
nb1 resd 1
nb2 resd 1

;
; code is put in the .text segment
;
segment .text
        global  asm_main
asm_main:
        enter   0,0               ; mise en place 
        pusha

	mov dword [nb1],1
	mov dword [nb2],2
	
	mov eax, nb1
	mov ebx, nb2
        mov ecx, 0
	mov edx, 0
	
	call swap

	mov eax, [nb1]
	mov ebx, [nb2]
	
        popa
        mov     eax, 0            ; retour vers le C
        leave                     
        ret


swap    :
	push ecx
	push edx

	mov ecx,[eax]
	mov edx,[ebx]
	mov [eax],edx
	mov [ebx],ecx

	pop edx
	pop ecx
	ret