1 2 下一页 在 masm32.inc 中有这样几个函数的声明: byt2bin_ex PROTO :BYTE, :DWORD wrd2bin_ex PROTO :WORD, :DWORD dw2bin_ex PROTO :DWORD, :DWORD dw2hex_ex PROTO :DWORD, :DWORD bin2byte_ex PROTO :DWORD
byt2bin_ex: 从 Byte 数到二进制字符串 ; Test19_1.asm .386 .model flat, stdcall include Windows.inc include kernel32.inc include masm32.inc include debug.inc includelib kernel32.lib includelib masm32.lib includelib debug.lib .data szBin db 8 dup(0), 0 ;这是接收二进制字符串的缓冲区, 需分配好空间 bVal db 3 .code main proc ;查看数字的二进制信息 invoke byt2bin_ex, 2, addr szBin PrintString szBin ;00000010 ;查看变量 bVal 的二进制信息 invoke byt2bin_ex, bVal, addr szBin PrintString szBin ;00000011 ;查看寄存器 al 的二进制信息 mov al, 0feh invoke byt2bin_ex, al, addr szBin PrintString szBin ;11111110 ret main endp end main
wrd2bin_ex: 从 Word 数到二进制字符串 ; Test19_2.asm .386 .model flat, stdcall include Windows.inc include kernel32.inc include masm32.inc include debug.inc includelib kernel32.lib includelib masm32.lib includelib debug.lib .data szBin db 16 dup(0), 0 ;这是接收二进制字符串的缓冲区, 需分配好空间 dwVal dw 3 .code main proc ;查看数字的二进制信息 invoke wrd2bin_ex, 2, addr szBin PrintString szBin ;0000000000000010 ;查看变量 dwVal 的二进制信息 invoke wrd2bin_ex, dwVal, addr szBin PrintString szBin ;0000000000000011 ;查看寄存器 ax 的二进制信息 mov ax, 0fffeh invoke wrd2bin_ex, ax, addr szBin PrintString szBin ;1111111111111110 ret main endp end main (责任编辑:admin)
|