Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 汇编语言如何正确使用WriteBin?_Assembly_X86_Irvine32 - Fatal编程技术网

Assembly 汇编语言如何正确使用WriteBin?

Assembly 汇编语言如何正确使用WriteBin?,assembly,x86,irvine32,Assembly,X86,Irvine32,我正在尝试转换由*和表示的数字“2” ' 通过将一个名为chstrs的数组构造为“0”和“1”,类似于下面的代码 换句话说,我想改变 ' 将结果移动到bitstrs并打印出来 我的问题是,即使我成功地将chstrs转换为bitstrs,我也无法打印正确的答案 这是整个程序之后的chstrs和bitstrs 在我打印了bitstrs之后,结果是这样的 但这才是我真正想要的。我该怎么处理呢 这是我的密码 TITLE Assembly INCLUDE Irvine32.inc main

我正在尝试转换由*和表示的数字“2” ' 通过将一个名为
chstrs
的数组构造为“0”和“1”,类似于下面的代码

换句话说,我想改变 ' 将结果移动到
bitstrs
并打印出来

我的问题是,即使我成功地将
chstrs
转换为
bitstrs
,我也无法打印正确的答案

这是整个程序之后的
chstrs
bitstrs

在我打印了
bitstrs
之后,结果是这样的

但这才是我真正想要的。我该怎么处理呢

这是我的密码

TITLE Assembly 

INCLUDE Irvine32.inc

main          EQU start@0

.data

    chstrs  BYTE "  ***   "     
            BYTE "**   ** "
            BYTE "**   ** "
            BYTE "    **  "
            BYTE "   **   "
            BYTE "  **    "
            BYTE " **     "
            BYTE "********"
    bitstrs BYTE 8 DUP(?)
.code

transform PROC      ;transform ' ' to 0, '*' to 1
    push ecx
    mov ecx, 8
    mov bl, '*'     
L2:
    mov al, [esi]   ;move chrstrs into al
    cmp al, bl      ;compare al and '*'
    jb L3           ;if a is below '*', al=' '
    add al, 7       
    jmp L4
L3: 
    add al, 16  
    jmp L4
L4: 
    mov [edi], al   ;move al to bitstrs after transforming
    inc edi
    inc esi
    loop L2
    pop ecx
    ret
transform ENDP

main PROC
    mov esi, offset chstrs
    mov edi, offset bitstrs
    mov ecx, 8
    
L1:
    call transform
    mov eax, bitstrs
    call writebinb      ;trying to print bitstrs, but I can't do it right
    call crlf
    loop L1
    

    exit
main ENDP
END main

writebinb
接受多个参数。@1201programalam您的意思是什么?我不熟悉ASM语言。是否必须将比特移到更多参数并将其打印出来?
writebinb
函数在
ebx
中获取一个值,该值指定要输出的数字的大小。检查您的文档。