如何转换二进制文件汇编86为十进制? [英] how to convert binary to decimal in asm x86?
本文介绍了如何转换二进制文件汇编86为十进制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道什么是错我的DISPLAY_IN_DECIMAL编码。
他们不停地给我这个错误。
装配:coa.asm
coa.asm(314):错误A2006:未定义的符号:decimalArray
DISPLAY_IN_DECIMAL(3):宏调用从
coa.asm(314):主线code
preSS任意键继续。 。 。
我想这可能是有毛病我decimalArray,但我不知道是什么。
这是code部分在那里我完成所有我的二进制显示。似乎没有任何错误。
计数器0分贝
点¯xDB 00000000B
ÿDB 00000000B deciamlArray字节8 DUP('') decimalResult分贝?
DEC1分贝? 。code
DISPLAY_IN_BINARY MACRO结果
当地L5,printBinary,print0,PRINT1,nextBit PUSH AX
MOV等,导致
MOV CX,8 printBinary:
TEST人,10000000b; 1 10000000b表明该位被比较,并打印出
JZ print0
JNZ PRINT1 PRINT1:
displayResult1;如果结果不位等于0,打印1
SHL人,1
JMP nextBit print0:;如果结果为0,打印0的位
displayResult0
SHL人,1
JMP nextBit nextBit:
LOOP printBinary POP AX
ENDM
但是,当我尝试对我的工作小数他们给了我刚才的权利上述错误。
我想这可能是有毛病我decimalArray,但我不知道。
DISPLAY_IN_DECIMAL MACRO结果
本地的L1,L2,L3
MOV SI,OFFSET结果
MOV DI,OFFSET decimalArray
MOV decimalResult,0
MOV CX,8 L1:
MOV AL,[SI]
CMP AL,'1'
JE L2
JMP L3
L2:
MOV AL,0
MOV AL,[DI]
ADD decimalResult,AL
JMP L3
L3:
INC SI
INC DI
LOOP L1
MOVZX AX,decimalResult
MOV BL,10
DIV BL
MOV BX,AX
MOV DH,BH
MOV DEC1,BL
MOVZX AX,DEC1
MOV BL,10
DIV BL
MOV BX,AX MOV AH,02H;打印结果
MOV DL,BL
ADD DL,30H
INT 21H
MOV DL,BH
ADD DL,30H
INT 21H
MOV DL,DH
ADD DL,30H
INT 21H
ENDM
解决方案
有在你的code笔误:
deciamlArray字节8 DUP('')
应该是:
decimalArray字节8 DUP('')
I have no idea what is wrong with my coding in DISPLAY_IN_DECIMAL. They kept giving me this error.
Assembling: coa.asm
coa.asm(314) : error A2006:undefined symbol : decimalArray
DISPLAY_IN_DECIMAL(3): Macro Called From
coa.asm(314): Main Line Code
Press any key to continue . . .
I thought it might be something wrong with my decimalArray but I'm not sure what.
This is the code part where I finish all of my binary display. Nothing seems wrong.
counter db 0
X db 00000000B
Y db 00000000B
deciamlArray byte 8 DUP (' ')
decimalResult db ?
dec1 db ?
.code
DISPLAY_IN_BINARY MACRO result
local L5, printBinary, print0, print1, nextBit
PUSH ax
MOV al, result
MOV cx, 8
printBinary:
TEST al, 10000000b ;1 in 10000000b indicate that the bit to be compare and print out
JZ print0
JNZ print1
print1:
displayResult1 ;If bit of result not equal to 0 ,print 1
SHL al, 1
JMP nextBit
print0: ;If bit of result = 0,print 0
displayResult0
SHL al, 1
JMP nextBit
nextBit:
LOOP printBinary
POP ax
ENDM
But when I try to work on my decimal they gave me the error stated right above just now. I thought it might be something wrong with my decimalArray but I'm not sure.
DISPLAY_IN_DECIMAL MACRO result
local L1,L2,L3
MOV SI, OFFSET result
MOV DI, OFFSET decimalArray
MOV decimalResult, 0
MOV CX, 8
L1:
MOV AL, [SI]
CMP AL, '1'
JE L2
JMP L3
L2 :
MOV AL, 0
MOV AL, [DI]
ADD decimalResult, AL
JMP L3
L3:
INC SI
INC DI
LOOP L1
MOVZX AX, decimalResult
MOV BL, 10
DIV BL
MOV BX, AX
MOV DH, BH
MOV dec1, BL
MOVZX AX, dec1
MOV BL, 10
DIV BL
MOV BX, AX
MOV AH, 02H ; print results
MOV DL, BL
ADD DL, 30H
INT 21H
MOV DL, BH
ADD DL, 30H
INT 21H
MOV DL, DH
ADD DL, 30H
INT 21H
ENDM
解决方案
There's a typo in your code:
deciamlArray byte 8 DUP (' ')
should be:
decimalArray byte 8 DUP (' ')
这篇关于如何转换二进制文件汇编86为十进制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文