输入一个数n,输出n行星号
程序运行:
代码:
datas segmentline_number_max_len db 0ffhline_number db 0, 100h dup(?)input_line_number_prompt db 'input line number:$'output db 0dh,0ah,'**********$'output_err db 0dh,0ah,'input errorr$'
datas endsstacks segment stackdb 100h dup(?)stacks endscodes segmentassume cs:codes,ds:datas,ss:stacks
SKIPLINES proc far
start:push dsmov ax,0hpush axmov ax,datas ;初始化dsmov ds,axlea dx,input_line_number_prompt ;输入提示mov ah,9int 21hlea dx, line_number_max_len ;输入要打印长度mov ah,10int 21hcmp line_number[0],0 ;将字符串转成数字jz errmov ax,0mov dx,0mov di,10mov si,1mov cl,line_number[0]mov ch,0 s:mov bl,line_number[si]cmp bl,'0'jb errcmp bl,'9'ja errsub bl,30hmov bh,0 mul diadd ax,bxinc si loop s mov cx,ax ;输出多行字符串s1:lea dx,outputmov ah,9int 21hloop s1 jmp exiterr:lea dx,output_errmov ah,9int 21hexit:retSKIPLINES endp
codes endsend SKIPLINES