-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincercare_matrice.s
More file actions
65 lines (56 loc) · 926 Bytes
/
Copy pathincercare_matrice.s
File metadata and controls
65 lines (56 loc) · 926 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<<<<<<< HEAD
=======
#blueprint pentru citit matrice si parcurgerea ei in general
>>>>>>> master
.data
n: .space 4
v: .space 40000
read_format: .asciz "%ld"
print_format: .asciz "V[%ld][%ld] = %ld"
buffer_clear: .asciz "\n"
.text
.globl main
main:
citire_n:
pushl $n
pushl $read_format
call scanf
subl $8, %esp
#ecx va fi pentru coloana
#ebx va fi pentru linie. Totusi formula va fi %eax(%esi, %ecx, 4) pt ca voi face 4*%ebx
lea v, %esi
xorl %ebx, %ebx
for1:
cmpl n, %ebx
je afisare
pushl %ebx
movl %ebx, %eax
movl $16, %ebx
mull %ebx
popl %ebx
xorl %ecx, %ecx
addl %eax, %esi
for2:
cmpl n, %ecx
je after_for2
pushl %ecx
pushl %eax
lea (%esi, %ecx, 4), %eax
pushl %eax
pushl $read_format
call scanf
after:
addl $8, %esp
popl %eax
popl %ecx
incl %ecx
jmp for2
after_for2:
subl %eax, %esi
incl %ebx
jmp for1
afisare:
exit:
movl $1, %eax
xorl %ebx, %ebx
int $0x80