Display the number in BX on the screen in binary form.

problem

Display the number in BX on the screen in binary form.

Code

code segment
assume cs:code
main proc far
start:
  mov bx,011001100110b  ;假设bx中的数为011001100110,最多也只有可能有16个
  mov cx,16
L1:
  rol bx,1       ;逻辑右移16次
  mov ax,bx      
  and ax,1b      ;每次把bx的最低位送入ax中
  mov dl,al       ;再把al输出
  add dl,30h
  mov ah,02h
  int 21h
  loop L1
  
  mov ax,4c00h
  int 21h
main endp
code ends
end start

operation result

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43475285/article/details/106299938