把字節(jié)按位輸出小函數(shù)(c內(nèi)嵌asm)

字號(hào):

為了調(diào)試處理單色位圖的程序?qū)懙囊粋€(gè)小函數(shù),還不錯(cuò)哦,新手朋友大家一起來看看吧。
    int byte8_2_int(char a,char pos)// a 為要位所在的字節(jié),考試大提示: pos為要輸出哪一位
    {
    char reti=0;
    __asm
    {
    mov al, a
    mov cl,pos
    shr al,cl
    and al,0x01
    cmp al,0x00
    jnz set1
    jmp A_Exit
    set1:
    xor ax,ax
    mov al,0x01
    mov reti,al
    }
    A_Exit:
    return reti;
    }