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.
69 lines
655 B
NASM
69 lines
655 B
NASM
3 years ago
|
global main
|
||
|
extern scanf
|
||
|
extern printf
|
||
|
|
||
|
|
||
|
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
|