我正在为我的学校做一个装配实验室,并打印已签名和未签名的号码。它不断印刷无限量的" - /"但它应该打印一个数字。数字的偏移量是否为ascii值30h?
Display .EQU 04E9h
NumAddr .EQU 0050h
Main:
mov BX, NumAddr
mov DX, Display
mainLoop:
MOV AH,[BX]
cmp AH, 0h ; is number 0?
JE EndPrt ; if yes we are done
CMP AH,0h
JG posNum ; should jump to posNum if AH is positive
negNum:
mov AL, 2Dh
out DX,AL ; print a negative sign
NEG AH ; turn AH into a positive number
printPos:
MOV AL,[BX]
ADD AL, 30h ; should add required offset to convert to ASCII
out DX,AL
MOV AL, 0Dh
out DX,AL
MOV AL, 0Ah
out DX,AL
inc BX
jmp mainLoop
EndPrt:
HLT
.END Main
答案 0 :(得分:0)
30h
是单个数字的偏移量。 IE浏览器。 (4 + 30h)为34h
,ASCII编码为'4'
。但是对于(17 + 30h),您将获得41h
,即'A'
字符。
如果您想要值为17的两个字符,例如31h' 1'和37h' 7',你必须将数字分成单独的基数 10 (十进制)数字(除以10并收集余数)。