Code:
.section .data
mat:
.int 1,3,7,2
.section .bss
.lcomm mat1, 40
.section .text
.globl _start
_start:
nop
movl $0, %ecx
calcDet:
movl mat(,%ecx,4), %eax
add $2, %ecx
movl mat(,%ecx,4), %ebx
mul %ebx
cmp $3, %ecx
je inverte
pushl %eax
dec %ecx
jmp calcDet
inverte:
pop %ebx
sub %eax, %ebx
movl $0, %ecx
diagPrin:
movl mat(,%ecx,4), %eax
cmp $0, %eax
je gamb3
div %ebx
gamb3:
cmp $2, %ecx
je executa
add $2, %ecx
movl %eax, mat1(,%ecx,4)
jmp diagPrin
executa:
sub $2, %ecx
movl %eax, mat1(,%ecx,4)
inc %ecx
inverteSinal:
movl mat(,%ecx,4), %eax
cmp $0, %eax
je gamb
div %ebx
gamb:
movl $-1, %edx
mul %edx
movl %eax, mat1(,%ecx,4)
add $2, %ecx
movl mat(,%ecx,4), %eax
cmp $0, %eax
je gamb2
div %ebx <-----------------------------ERROR
gamb2:
mul %edx
movl %eax, mat1(,%ecx,4)
fim:
movl $1, %eax
movl $0, %ebx
int $0x80
PS: This code tries to do the inverse of the matrix {1,3,7,2}
Bookmarks