Pract 4
Pract 4
Pract 4
%macro print 2
mov rax,1
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endmacro
section .data
msg db 10,"count number of posite and negative numbers",10
msg_len equ $ - msg
section .bss
output resb 1
section .text
global _start
_start:
print msg,msg_len
mov rsi,array
mov rcx,05
again:
bt qword[rsi],63
jnc pnxt
inc byte[ncnt]
jmp pskip
pnxt: inc byte[pcnt]
pskip: add rsi,08
loop again
print msg1,msg1_len
mov al,[pcnt]
call display
print newline,1
print msg2,msg2_len
mov al,[ncnt]
call display
print newline,1
mov rax,60
mov rdi,0
syscall
display:
mov rbx,rax
;mov ch, 16
;mov cl,04h
mov cx,1004h
ll6:
rol rbx,cl
mov rdx,rbx
and rdx,0fh
add rdx,30h
cmp rdx,039h
jbe skip4
add rdx,7
skip4:
mov byte[output],dl
push rcx
print output,1
pop rcx
dec ch
jnz ll6
ret