Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Positive And Negative Count In Array
global _start ; entry point for assembly program %macro display 2 mov rax , 01 ; System Call For Write Function mov rdi , 01 ; STD_OUT --- File Descriptor mov rsi , %1 ; BUFFER mov rdx , %2 ; Count syscall ; invoking OS/Kernel To Do Operation %endmacro section .data ; initialized variable welmsg db 10 , "-----------Welcome--------------" , 10 ; 10 is Newline Character wellen equ $ - welmsg prgaim db 10 , "Positive And Negative Count In Array" , 10 prglen equ $ - prgaim pstmsg db 10 , "Positive Count : " pstlen equ $ - pstmsg negmsg db 10 , "Negative Count : " neglen equ $ - negmsg arr_1 db -55h , 32h , 09h , -22h , 2fh arcnt equ 05 section .bss ; unintialized variable BSS : Block Started By Symbol pstcnt resb 1 negcnt resb 1 section .text ; main code -- program _start : display welmsg , wellen display prgaim , prglen mov rsi , arr_1 mov rcx , arcnt mov bl , 00 mov bh , 00 loop_1 : mov al , [rsi] BT ax , 7 ; Bit Test Result Stored In Carry Flag jc negt_1 inc bl jmp contne negt_1 : inc bh contne : inc rsi loop loop_1 mov [pstcnt] , bl mov [negcnt] , bh add byte [pstcnt] , 30h ; add byte [negcnt] , 30h ; display pstmsg , pstlen display pstcnt , 1 display negmsg , neglen display negcnt , 1 _exit : mov rax , 60 ; System Call For Exit mov rdi , 00 ; syscall ; Invokes OS to exit
run
|
edit
|
history
|
help
0
arithmetic
dsfdsffdafdssd
lecture6-1
recursive
Get number form input and print it
dfdfdfsff
Assembly Program To Add 2 Numbers Isn't Working
afsdfds
fgsgdgfsdgfsdfd
lec4bb