tema

mail@pastecode.io avatar
unknown
assembly_x86
2 months ago
1.2 kB
2
Indexable
Never
//Cerinta 0



.data



	mLines: .space 4

	nCols: .space 4

	p: .space 4

	x: .space 4

	y: .space 4

	i: .space 4

	j: .space 4

	matrix: .space 1600

	formatPrintf: .asciz "%d "

	endl: .asciz "\n"

	formatScanf: .asciz "%d"

	

.text



.global main



main:



	push $mLines

	push $formatScanf

	call scanf

	addl $8, %esp

	

	mov $0, %ecx

	lea matrix, %edi

	//lea matrix, %edi

	

et_p:



	cmp p, %ecx

	je et_cont

	

	push %ecx

	push $x

	push $formatScanf

	call scanf

	addl $8, %esp

	//mov %ecx, y

	//nu sunt sigur

	pop %ecx

	

	mov x, %eax

	mull nCols

	addl y, %eax

	

	movl $1, (%edi, %eax, 4)

	

et_cont:



	movl $0, i

	movl $0, j

		

for_lines:



	mov i, %ecx

	cmp %ecx, mLines

	je et_exit

	

	movl $0, j

	

for_col:	

	

	mov j, %ecx

	cmp nCols, %ecx

	je et_cont_for_lines

	

	//aici se scrie cod

	//afisare:

	

	movl i, %eax

	mull nCols

	movl (%edi, %eax, 4), %ebx

	

	push %ebx

	push $formatPrintf

	call printf

	addl $8, %esp

	

	//afisare

	incl j

	jmp for_col

	

et_cont_for_lines:

	

	push $endl

	call printf

	addl $4, %esp

	

	push $0

	call fflush

	pop %ebx

	

	incl i

	jmp for_lines

	

et_exit:



	movl $1, %eax

	movl $0, %ebx

	int $0x80

	

	

	

	

Leave a Comment