aboutsummaryrefslogtreecommitdiff
path: root/sem3/osc/miniproject/cnasm/test.asm
blob: 77a3572e24120c4f18b51a05ebe2a6bbd3aa0b36 (plain)
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
37
38
39
global _start

section .data
        align 2
        ; String, which is just a collection of bytes, 0xA is newline
        str:     db 'Hello, world!',0xA
        strLen:  equ $-str

section .bss

section .text
        _start:

        mov     edx, strLen     ; Arg three: the length of the string
        mov     ecx, str        ; Arg two: the address of the string
        mov     ebx, 1          ; Arg one: file descriptor, in this case stdout
        mov     eax, 4          ; Syscall number, in this case the 
        int     0x80            ; Interrupt 0x80        

		if ( hej = 10 ) {
			mov     ebx, 0          ; Arg one: the status
			mov     eax, 1          ; Syscall number:
			if(cool) {
				int     0x80
			}
		} else {
			while( lol ) {
				mov hej, 0
			}
		}
		while( lol ) {
			mov hej, 0
		}

		hej

		for(mov a, 0( a < 100( a++ ) {
			test
		}