菜单

内嵌汇编

2019年8月2日 - 4166am金沙下载
void transform_hex(int num,char *dst)
{
    char buffer[512];
    char ch_num1 = '0' ;
    char ch_num2 = 'A' ;
    __asm__(

        "MOV R5,%0\\n"
        "MOV R6,%1\\n"
        "MOV R7,%2\\n"
        "MOV R8,%3\\n"
"loop :AND R9,R8, #0x0f\\n"
        "CMP R9,#10\\n"
        "ADD R9,R9,%1\\n"
        "STRLT R9,[R5]\\n"
        "SUB R9,R9,#10\\n"
        "SUB R9,R9,%1\\n"
        "ADD R9,R9,%2\\n"
        "STRGE R9,[R5]\\n"
        "ADD R5,R5,#0x1\\n"
        "LSR R8,R8,#4\\n"
        "CMP R8,#0\\n"
        "BNE loop\\n"
        "MOV R4,%4\\n"
        "MOV R10,%1\\n"
        "STRB R10,[R4]\\n"
        "ADD R4,R4,#1\\n"
        "MOV R10,#120\\n"
        "STRB R10,[R4]\\n"
        "ADD R4,R4,#1\\n"
        "SUB R5,R5,#1\\n"
"copy:LDRB R10,[R5]\\n"
        "STRB R10,[R4]\\n"
        "SUB R5,R5,#1\\n"
        "ADD R4,R4,#1\\n"
        "CMP R5,%0\\n"
        "BGE copy\\n"
        "MOV R10,#0\\n"
        "STRB R10,[R4]"
        :
        :"r"(buffer),"r"(ch_num1),"r"(ch_num2),"r"(num),"r"(dst)
        );
}
//该片段来自于http://outofmemory.cn

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图