code segment
assume cs:code
org 100h
start:
jmp begin
num dw 89ABh ; 要显示的数
h db 4 dup(?),10,13,'$'
begin:
push cs
pop ds
push cs
pop es
lea di,h
mov cx,4
mov ax,num
@1: push cx
mov cx,4
mov dx,0
@@1: shl ax,1
rcl dx,1
loop @@1
cmp dl,10
jge @2
add dl,30H
jmp @3
@2: add dl,37H
@3: mov byte ptr [di],dl
inc di
pop cx
loop @1
lea dx,h
mov ah,9
int 21h
mov ah,4ch
int 21h
code ends
end start