Assembly 汇编语言-计算下位机和下位机的数量;大写字母

Assembly 汇编语言-计算下位机和下位机的数量;大写字母,assembly,inline-assembly,Assembly,Inline Assembly,我正试图在VisualStudio中用C语言编写一个内嵌汇编的程序。我正在读取字符串,需要存储变量中的小写字符数和变量中的大写字符数。以下是我迄今为止所做的: void FnlUpperLowerCount(char *inStr) { int UpCount = -99; int LowCount = -99; _asm { mov esi, inStr mov al, [esi] } printf("Th

我正试图在VisualStudio中用C语言编写一个内嵌汇编的程序。我正在读取字符串,需要存储变量中的小写字符数和变量中的大写字符数。以下是我迄今为止所做的:

void FnlUpperLowerCount(char *inStr) {

    int UpCount =  -99;

    int LowCount = -99;

    _asm {

        mov esi, inStr

        mov al, [esi]

    }

    printf("The number of upper case letters   : %d\n",UpCount);

    printf("The number of lower case letters   : %d\n",LowCount);

    return ;

}

我真的不知道该如何进一步。

我不确定我必须使用的确切语法,但我相信它应该是这样的。 我还假设inStr是一个只有字母字符的空终止序列

void FnlUpperLowerCount(char *inStr) {

int UpCount =  0;

int LowCount = 0;

_asm {

    mov esi, inStr

    loop:

    mov al, [esi]

    or al,al

    jz finished

    cmp al,91

    jc capital

    inc LowCount

    jmp cont

    capital:

    inc Upcount

    cont:

    inc esi

    jmp loop

    finished:

}

printf("The number of upper case letters   : %d\n",UpCount);

printf("The number of lower case letters   : %d\n",LowCount);

return ;

}

我会先用C编写它,从那时起,将它转换为asm应该相当简单。
mov esi,inStr   ;To start off initialize  esi point to input string
mov edi,outStr  ;edi point to the output string area

incr:
    mov [edi],al
    add edi,1
    add esi,1
    mov al,[esi]
    inc ecx
    jmp contf

startf:

    mov al,[esi]
    mov ecx,0

contf:

    cmp al,7bh
    jl isdone
    jmp incr

greater1:

    cmp al,61h
    jl incr
    sub al,20h
    jmp incr

isdone:

    cmp al,0
    jg greater1

done:

    mov outStr,edi