INT 21H ½â
¢ÙCX=2180H£¬CF=1B ¢Ú[SI]=80H£¬[SI+1]=21H ¢Û[SI]=01H£¬MEM=32700H ¢Ü[SI]=00H£¬ZFCFPF=111B ¢ÝAX£½000FH£¬CFAF=00B ¢ÞAX=0105H£¬CFAF£½11B ¢ßAL=5EH£¬CFAF=00B ¢àAL=64H ¢áBX£½0008H ¢âAX£½0018H ¢ÏAX£½FF18H
¢ÐAX£½FFE3H£¬DX=0000H µÚ4Õ ϰÌâ¼°²Î¿¼½â´ð
1£®ÊÔ±àÒ»³ÌÐò£¬°ÑµØÖ·Æ«ÒÆÁ¿Îª100Hµ¥Ôª¿ªÊ¼µÄ256¸öµ¥Ôª·Ö±ðдÈë00H£¬01H£¬02H£¬03H£¬¡£¬FFHÊý¾Ý¡£ ½â Ô´³ÌÐòÈçÏ DATA
SEGMENT ORG 100H DB 256 DUP(?) EQU $£BUF1
BUF1 COUNT
DATA STK
ENDS
SEGMENT STACK DB 100 DUP(£¿) ENDS
STK
CODE SEGMENT
ASSUME CS£ºCODE£¬DS£ºDATA
START£º MOV AX£¬DATA
MOV DS£¬AX
MOV SI£¬OFFSET BUF1 £»‘á LEA SI£¬BUF1 MOV CX£¬COUNT XOR AL£¬AL
NEXT£º
MOV [SI]£¬AL
£»»ò MOV AL£¬00H
INC AL INC SI LOOP NEXT MOV AH£¬4CH INT 21 H
CODE
2£®Í³¼ÆÉÏÌâдÈëµÄÊý¾Ý¿éÖÐ0ÔªËØ¡¢ÕýÔªËØ¡¢¸ºÔªËصĸöÊý£¬²¢·Ö±ð°Ñͳ¼Æ½á¹ûËÍÈëÉÏÊöÊý¾Ý¿éÖ®ºóµÄÈý¸öµ¥ÔªÖС£
ENDS END START
½â DATA
SEGMENT ORG 100H
£»¹²256¸öÊý¾Ý
BUF1 DB 00H£¬01H£®02H£¬¡£¬0FEH£¬0FFH COUNT EOU$£BUF1
DB 3 DUP(£¿)
DATA ENDS STK SEGMENT STACK DB 100 DUP(£¿) STK
ENDS
CODE SEGMENT
ASSUME CS£ºCODE£¬DS£ºDATA
START: MOV AX£¬DATA
MOV DS£¬AX
MOV S1£¬OFFSET BUF1 MOC CX£¬COUNT XOR BX£¬BX
XOR DH£¬DH
NEXT2: MOV AL£¬[SI]
CMP AL£¬0 JZ ZER0 JS NEGAT
BLÓëBH·Ö±ð´æ·ÅÕý¡¢¸ºÔªËصĸöÊý DH¼Ä´æÆ÷´æ·Å0ÔªËظöÊý
ÈôZF=1£¬ÔòΪ0£¬×ªÖÁZERO£¬DH+1 SF=0ÔòΪ¸ºÊý£¬BH+1
£»£»
£»£»ÈôINC BL
JMP NEXT3
£»¼È²»ÊÇ0ÓÖ²»ÊǸº£¬ÔòΪÕýÊý£¬BL+1
ZERO£º INC DH
JMP NEXT3
£»0µÄ¸öÊý¼Ó1
NEGAT£ºINC BH NEXT3: INC SI
£»¸ºÊý¸öÊý¼Ó1 £»Ð޸ĵØÖ·Ö¸ÕëSI £»Î´Í꣬¼ÌÐøÑ»·
£»´æÈë0ÔªËظöÊýͳ¼Æ½á¹û
LOOP NEXT2 MOV [SI]£¬DH INC SI
MOV [SI]£¬BX MOV AH£¬4CH INT 21H
£»´æÈëÕý¡¢¸ºÊý¸öÊýͳ¼Æ½á¹û
CODE ENDS
4£®°ÑµØÖ·Æ«ÒÆÁ¿ÎªSTRG1µ¥Ôª¿ªÊ¼µÄ128¸öµ¥ÔªµÄÄÚÈÝ´«Ë͵½µØÖ·Æ«ÒÆÁ¿ÎªSTRG2¿ªÊ¼µÄµ¥ÔªÖС£ ½â
DATA SEGMENT
STRGl DB XXH£¬XXH£¬XXH£¬¡£®XXH £»1 28¸öÊý¾Ý COUNT EOU$£STRGl STRG2 DB 128 DUP(?)
END START