P
P
pefbrute2021-06-02 23:29:20
CMS
pefbrute, 2021-06-02 23:29:20

How to move value from eax register to al register?

Hello, I have this code:

.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
 
.code
start
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
end start


And I need to output the resulting value to the console using the al register.
Can you please tell me how to do this and is it possible?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
MasterMike, 2019-02-08
@MasterMike

Aggregator with the possibility of registration and IM on CMS? Oh well.

M
Maxim Timofeev, 2019-02-08
@webinar

Any csm for IM fits your description. But the devil is in the details. And as it usually happens after a detailed review of the TOR, it turns out that not one CMS will work, because you need too many files.

A
Alexey Nikolaev, 2019-02-08
@Heian

OpenCart\UMI

G
galaxy, 2021-06-03
@pefbruteq

al is part of the eax register (lower 8 bits), so the result is already there (if it fits in 8 bits).
For fidelity, you can reset the high bits of eax:
and eax, 0FFh

D
Dorbah, 2021-06-05
@Dorbah

You need to transfer 8 bits to another register and output in hex format

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question