Answer the question
In order to leave comments, you need to log in
How to convert binary array to decimal number in masm32 and output it to console?
So far I have only reached this code, but I don’t understand how to do the rest:
.model small
.stack 100h
.data
array db 0,0,0,0,1,1,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1
len = $-array+1
.code
start
end start
Answer the question
In order to leave comments, you need to log in
If I understand the task correctly, then the algorithm can be as follows:
xor eax, eax ; eax = 0
xor bx, bx ; bx = 0
cycle:
sal eax ; сдвинули влево
neg bx
mov cl, array[len][bx] ; получаем байт с конца массива
neg bx
cmp cl, 0
je set0
set1: inc eax ; 1 бит в 1
set0: nop ; после сдвига 1 бит и так = 0
inc bx
cmp bx, len
jle cycle
; eax = число из битов* массива array
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question