Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hello: dodawanie.o
- ld -o dodawanie dodawanie.o
- hello.o: dodawanie.s
- as -ggtabs -o dodawanie.o dodawanie.s
- lub
- gcc dodawanie.s -o dodawanie -g
- DODAWANIE
- //DZIALA!!
- //pomyslec nad napisaniem tego prosciej...
- SYSEXIT = 1
- EXIT_SUCCESS = 0
- SYSREAD = 3
- SYSWRITE = 4
- STDIN = 0
- STDOUT = 1
- size = 512
- .bss
- .lcomm bufor,size
- .data
- liczba1: .long 0xFFFFFFFF,0xF0000000,0x00000000,0xF0000000
- liczba2: .long 0x00000000,0x10000000,0x00000000,0xF0000001
- .text
- .global _start
- _start:
- movl $3, %edi
- movl $0, %ecx
- clc
- pushf
- loop_start:
- movl liczba1(,%edi,4), %eax
- movl liczba2(,%edi,4), %ebx
- popf
- adcl %ebx, %eax
- pushl %eax
- pushf
- cmpl $0, %edi
- je carry
- decl %edi
- jmp loop_start
- carry:
- xorl %ecx, %ecx
- popf
- rcll $1, %ecx
- pushl %ecx
- exit:
- movl $SYSEXIT, %eax
- movl $EXIT_SUCCESS,%ebx
- int $0x80
- ODEJMOWANIE
- //DZIALA!!
- //pomyslec nad napisaniem tego prosciej...
- SYSEXIT = 1
- EXIT_SUCCESS = 0
- SYSREAD = 3
- SYSWRITE = 4
- STDIN = 0
- STDOUT = 1
- size = 512
- .bss
- .lcomm bufor,size
- .data
- liczba1: .long 0xFFFFFFFF,0xF0000000,0x00000000,0xF0000000
- liczba2: .long 0x00000000,0x10000000,0x00000000,0xF0000001
- .text
- .global _start
- _start:
- movl $3, %edi
- movl $0, %ecx
- clc
- pushf
- loop_start:
- movl liczba1(,%edi,4), %eax
- movl liczba2(,%edi,4), %ebx
- notl %eax
- popf
- adcl %ebx, %eax
- notl %eax
- pushl %eax
- pushf
- cmpl $0, %edi
- je carry
- decl %edi
- jmp loop_start
- carry:
- andl %edx, %edx
- xorl %ecx, %ecx
- popf
- adcl %ecx, %edx
- negl %edx
- pushl %edx
- exit:
- movl $SYSEXIT, %eax
- movl $EXIT_SUCCESS,%ebx
- int $0x80
- MNOŻENIE
- SYSEXIT = 1
- EXIT_SUCCESS = 0
- SYSREAD = 3
- SYSWRITE = 4
- STDIN = 0
- STDOUT = 1
- LICZBA1_OSTATNI = 3
- LICZBA2_OSTATNI = 3
- .data
- liczba1: .long 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF
- liczba2: .long 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF
- .text
- .global _start
- _start:
- movl $0, %edi
- fill_stack_with_zeros:
- push $0
- cmpl $LICZBA1_OSTATNI, %edi
- je loop_start
- incl %edi
- jmp fill_stack_with_zeros
- loop_start:
- movl $LICZBA2_OSTATNI, %esi
- movl liczba1(,%edi, 4), %ebx
- movl $0, %ecx
- multiply:
- movl liczba2(,%esi,4), %eax
- movl $0, %edx
- mul %ebx
- addl %ecx, %eax
- adcl $0, %edx
- movl %edx, %ecx
- movl (%esp,%esi,4), %edx
- addl %edx, %eax
- movl %eax, (%esp, %esi, 4)
- adcl $0, %ecx
- cmpl $0, %esi
- je carry
- decl %esi
- jmp multiply
- carry:
- pushl %ecx
- cmpl $0, %edi
- je exit
- decl %edi
- jmp loop_start
- exit:
- movl $SYSEXIT, %eax
- movl $EXIT_SUCCESS,%ebx
- int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement