【发布时间】:2015-02-21 03:48:48
【问题描述】:
,,,,,01011011b 和 11000111b ;;;我试图将结果显示为二进制数字的 ascii 字符串。 我正在使用 shl 指令来隔离每个位并跳转进位。我能打印的都是乱码。有人可以帮忙吗?
.stack 100h
.model small
.386
.data
str1 db 20 dup(?)
lstring EQU 9
.code
main:
mov ax, @data ; initialize DS
mov ds, ax
mov cx, lstring
L1:
mov al,01011011b
and al,11000111b
shl al, 1
mov str1, al
mov ax, 8
loop L1
mov ax, 4000h ; dos service to display...
mov bx, 1 ; to screen
mov cx, lstring ; number of bytes
mov dx, OFFSET str1 ; where to get data
int 21h
MOV AH, 4CH ; return control to DOS
INT 21H
end main
【问题讨论】:
-
“我正在使用 shl 指令来隔离每个位并跳转进位。” 您发布的代码中没有进位跳转。为什么循环的每次迭代都进行
AND计算,而不是一次?mov ax, 8应该做什么? -
是的,整个循环基本不变,9次迭代后的结果和第一次没有区别。