nihonium
/
mipt_clang
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

131 lines
1.3 KiB
NASM

3 years ago
global main
extern scanf
extern printf
3 years ago
<<<<<<< Updated upstream
3 years ago
section .text
main:
xor ebx, ebx
loop1:
cmp ebx, 8
jge nya1
inc ebx
; read element
lea edx, [a + 1*ebx]
push edx
push template
call scanf
add esp, 8
push word [edx]
push output
call printf
add esp, 8
jmp loop1
nya1:
; xor ebx, ebx
;
;loop2:
; cmp ebx, 8
; jge nya2
; inc ebx
;
; ; read element
; push b
; push template
; call scanf
; add esp, 8
;
; jmp loop1
;
;nya1:
; xor ebx, ebx
;loop3:
; output
; push word [a]
; push output
; call printf
; add esp, 8
xor eax, eax
ret
section .data
template db "%d", 0
output db "%d", 10, 0
t db "%d", 10, 0
section .bss
a resw 8
b resw 8
3 years ago
=======
section .text
main:
xor ebx, ebx
loop1:
cmp ebx, 8
je nya1
lea eax, [a + ebx]
push eax
push input
call scanf
add esp, 8
inc ebx
jmp loop1
nya1:
xor ebx, ebx
loop2:
cmp ebx, 8
je nya2
lea eax, [b + ebx]
push eax
push input
call scanf
add esp, 8
inc ebx
jmp loop2
nya2:
movq mm0, [a]
movq mm1, [b]
paddsb mm0, mm1
movq [a], mm0
xor ebx, ebx
loop3:
cmp ebx, 8
je nya3
lea eax, [a + ebx]
mov dl, byte [eax]
push edx
push output
call printf
add esp, 8
inc ebx
jmp loop3
nya3:
push EOL
call printf
add esp, 4
dbg: xor eax, eax
ret
section .data
input dd "%hhu", 0
output dd "%hhu ", 0
EOL dd 10
section .bss
a resb 8
b resb 8
>>>>>>> Stashed changes