输入字符串以$结束然后输出字母个数
程序运行:
代码:
datas segment buff db 100h dup(?)letter_count dw 0nextline db 0dh,0ah,'$'datas ends
codes segment
assume cs:codes,ds:datas
main proc far push dsmov ax,0push ax mov ax,datasmov ds,axs:mov ah,1int 21h cmp al,'$'jz breakmov buff,aland al,11011111bcmp al,'A'jb nextcmp al,'Z'ja nextinc letter_countnext:jmp sbreak: lea dx,nextlinemov ah,9int 21hmov ax,letter_countcall todecimalret
main endptodecimal proc near uses ax bx cx dxmov bx,10mov cx,0s:mov dx,0div bxpush dxinc cxor ax,axjnz ss1:pop dxadd dl,30hmov ah,2int 21hloop s1ret
todecimal endpcodes endsend main