Answer the question
In order to leave comments, you need to log in
How to get an element of a character array in assembler?
There is a code below. I want to count the number of brackets "(" and ")". And everything seems to be fine, but in this line
mov cl, [eax + esi];//помещаем значение А[esi] в cl
char *A = new char[100];
strcpy(A, "1+2*(3-4)+(5*(6+7)-9)");
char left = 0, right = 0;
_asm{
mov eax, A; //адрес А в eax
mov esi, 0; //счетчик в 0
mov al, 0; //тут будем считать "(", код 28h
mov ah, 0; //а тут считать ")", код 29h
newiter:
mov cl, [eax + esi];//помещаем значение А[esi] в cl ВОТ ТУТ ПРОБЛЕМА!!!
cmp cl, 28h//сравниваем
je m1;//если равны, то в m1
cmp cl, 29h//сравниваем
je m2;//если равны, то в m2
cmp cl, 29h//снова сравниваем
jne m3;//если не равны, то в m3
m1:
inc al;
inc esi;
cmp esi, 21;
jne newiter;
m2:
inc ah;
inc esi;
cmp esi, 21;
jne newiter;
m3:
inc esi;
cmp esi, 21;
jne newiter;
mov left, al;
mov right, ah;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question