Using assembler to realize the number of "zeros" in the 16-bit binary number in the statistical register AX

could you tell me what"s wrong with my writing like this? there is no result at run time

data segment

data ends

stack segment stack
dw 20h dup(?)
top label word
stack ends

code segment
  assume ds:data,ss:stack,cs:code
  p proc far

  mov ax,data
  mov ds,ax

  mov ax,stack
  mov ss,ax
  mov sp,top

  mov ax,0000111100001111b;ax

  xor dl,dl;dl0
  mov bx,10h;16

judge:
  test ax,01h
  jz when0;ax0when0

when1:
  dec bx
  jz printf;bx=0
  shr ax,1
  jmp judge

when0:
  inc dl;dl0
  dec bx;bx1
  jz printf
  shr ax,1
  jmp judge

printf:
  mov ah,02h
  int 21h

exit:
  mov ah,4ch
  int 21h

  p endp
code ends
  end p

C asm
Mar.17,2021
Menu