【汇编】从键盘输入一个字符串,将其中的数字字符在下一行原样显示,而其他字符则不显示。 字符串,将其中的数字字符在下一行原样显示,而其他字符则不显示。ASSUME CS:CC,DS:QQQQ SEGMENTSTR DB 100,?100 DUP('$')MSG1 DB 'Input the string:',13,10,'$'MSG2 DB 13,10,'OUT is:',13,10,'$'QQ ENDSCC SEGMENTSTART:MOV AX,QQMOV DS,AXLEA DX,MSG1MOV AH,9INT 21HLEA DX,STRMOV AH,0AHINT 21HLEA DX,MSG2MOV AH,9INT 21HMOV CL,STR+1MOV CH,0CMP CX,0JNZ CALJMP EXITCAL:MOV BX,0LOP:MOV DL,STR[BX+2]CMP DL,'0'JB NEXTCMP DL,'9'JA NEXTMOV AH,2INT 21HNEXT:INC BXLOOP LOPEXIT:MOV AH,4CHINT 21HCC ENDSEND START
汇编从键盘输入一个数字,求其平方 data?segment?x?db?10?db?db?10?dup(0)y?dw?0?istr?db?'Input?a?numbe():$'?crlf?db?0dh,0ah,'$'data?endsassume?cs:code,ds:datacode?segmentstart:。
汇编从键盘输入一个数字,求其平方 dup(0)ds,axlea:x[2+bx]and a numbe();dxax,0x to numberconvert2bin ah,90c0;proc mov ax;lea dx;code,ds;inc cxcmp ah,0ahmov ah;xchg?ah,4chcx,cxmov lea dx;mul dlxchg ax;mov al;y dw 0db string x db 10db;'Input,int 21hdxint 21hconvert push ax,datamov crlfsegmentstart:mov dx,0e30h'ax,yymov 10 mov ch;div bxxor,0mov call db:dx,istrmov cl,x[1]mov al,0fhxor dx;bx,10Q0;0ah;crlf dl,10mov print(ax)in decimalprint proc nearxor inc bxloop c0retconvert2bin endpbx,axmul jnz Q0Q1;y;int 21h10hloop Q1retprint endpcode endsend db,'$'data endsassume cs;mov ah;0dh;bx,0nearprintmov,pop axint yadd xmov istr axbxdatacode 21hcall convert2bin9intdata segment