Untitled

mail@pastecode.io avatar
unknown
assembly_x86
2 years ago
935 B
18
Indexable
Never
include win64.inc                ; biblioteca cu structuri si functii Win x64
option win64:3
option literals:on

lpLIST TYPEDEF ptr LIST

LIST STRUCT
	number QWORD NULL
	next_node lpLIST NULL
LIST ENDS

.data                
	list_head lpLIST NULL
	hStdOut HANDLE ?   

.code                            ; Sergmentul de cod (program)

  main proc uses rbx                     ; functia principala "main" 
	mov hStdOut, GetStdHandle(STD_OUTPUT_HANDLE)
	.if (hStdOut == INVALID_HANDLE_VALUE)
		echo "Error reading Standard Output Handle"
		exit(-1)
	.endif
	mov rcx, 20
	lea rdx, list_head
	call Add_to_sorted_list
	

   exit(0)
   ret
  main endp                     ; sfarsitul functiei main

 ; alte functii/proceduri
 Add_to_sorted_list proc uses rbx
	mov rbx, malloc(sizeof(LIST))
	mov [rbx].LIST.number, rcx
	mov [rbx].LIST.next_node, rdx
	mov list_head, rbx
	ret
 Add_to_sorted_list endp
end