data segment
a1 db '87'
len dw $-a1
b1 dw 0
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
lea si,a1
lea di,b1
mov cx,len
call asc2bin
mov ax,4c00h
int 21h
si-source ascii string
di-binary's variable
cx-ascii's length
asc2bin proc near
mov bl, 10
L0:
mov ax, [di]
mul bl
mov dl, [si]
and dl, 0Fh
add al, dl
adc ah,0
mov [di],ax
inc si
loop L0
ret
asc2bin endp
code ends
end start
延时时间和你设的频率有关,这里把PUSH AX POP AX循环100次,在乘以循环周期就是延时时间,至于用AX,BX无关紧要,只要最后恢复现场就好。当然没问题,++——一样可以,NoP也没问题,LOOP也算时间
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)