aboutsummaryrefslogtreecommitdiff
path: root/prog1.asm
blob: ea9f9d0d1093e6367c742a1911c56b7235b77514 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
global _start

section .data
	MAXLOOP db 10

section .text

; while edx <= ecx
loop:
	cmp ecx, edx
	jle exit

	; ebx++
	add edx, 1
	
	; loop()
	jmp loop

exit:
	; exit value is in edx, move it to ebx
	mov ebx, edx
	
	; clear registers
	mov edx, 0
	mov ecx, 0

	; initate exit syscall
	; exit(ebx)
	mov eax, 1
	int 80h
	ret
	
_start:
	mov ecx, [MAXLOOP]
	jmp loop