计算N阶乘 N! CRLF MACRO MACRO ;MACRO
MOV AHMOV2AHV AH MAH DAMOVDMOV DL IDL 2DINT INT INTVINT, 02MOV AH AHOVAHL, 0AMOV DL DLT DLINT INT INTDINTDATAENDMEGMENT
MSEGMENTB 'INPUTDBHE NUMBER ACCORDING TO HEXNUM!',0DH,0AH,'$'
MESS2 DB 'TDB RDBULT IS: $'
ERROR DB 'IDBUTDBRROR! INPUT ONCE MORE!',0DH ,0AH,'$'
LEN DW 1
DW DWDWW DWDDWW DW DWDW56DWUPDW)
DADUP ENDS
ENDSENDSEGMENT STSEGMENTACK'
DW 32 DWP(DWDUPTDWP DWDS
CODEENDSGMENT
ASEGMENTCSASSUME, CS:DATCS ECSDATA, SESSTACK
SSART: MOV AXMOVAAXVAAX MOV DSMOVMDSV DS AXVDSS,DSXESV ESS MAX AH,ES9AHOVAHAH MOV DXMOVFMOVMDXSDXOFFSET INT 21INT INT ININT INT ;ININT示信息
CALL GETNUMCALL CALLCALL的N值
MOV BP, DX MOV BP MDX BPMOVXBPBMOVDBP CMP BP, 0
JZ EEE
CMJZBPMP JZ, CMP JCMJZJZCMPBP CMJZJZ JZ ;CMP或JZJCMJZBP
MOV SI, OFFSETMOVFSI MOFFSET首OFFSETMOVI MOFFSET],DX MOV SDX区初始化为值NMOVXMSI DSI BDX ;N值减1
CMP BPDEC0BP
JZ CMP CMP ;若JZMCMPP
JZ CMPXOR BXJZX JZZ偏移指针XOR
XORV WORJZPTR XOR0XORBX;进位单元清0
WORDDPTRRMOVLWORBXXTR MOV WOBX果PTRCX
TTMOV MOV AX, MPTRCMOVV MOVMMOVBWORD MOVVAXX MOV ;CXVAX SI BXD AX,CMOV MOV AXP MOV加低位进位
MUL BPNC JJJ ADD AX ;AX无进位SIJBXDMULL INC DX MULADDDAXX ;有进位将高位单元JNC
JJJ: MOV [SI+BX],AX ;结果送缓冲区中
INCVDXY,DX MOVV SIIBXX位AXX进位单MOV SI BX IAX BX
MOV SIIBX BAX DXX MOV SI BX一DX长AX
MOVMOSIPBXDX BX MOV MOV循环
INDXBXCMPMOV, 0000HINC BX JZ BBB INC BX ;最后1次的MOV0则转BBB
INC INCINC WLOOPPTR LENBX JZXCMJZDINC BXNC BXV BXCMJZDXDX INC BX ;进位送缓冲区JZ
BBB: JMP XINC
EEE: MOV SI,OFINCT BUINC MOVINCRWOINCPBXI],1 MOV为1
LLL: MOVJMP,MJMPSI BX MDMOVXSIVFSIT JMPS2
INMOV1SIMOFFSET MOV示MOVFFSET MMOVCAHVEAH
MOBXWOBXVPTR,DXIOFFSETAH ;长度BX MODXAOFFSET MOVVMOV1INTSET MOV MOV CX个字为两MOVMOVCC: MOV AMOV[MOVBAH
MOV CALL DIMOVCX DEC BXMOV BX CXEC BX BX ;显示结果DEC BX LOOP CCCSHL BX MOVMOCALLALL0MOV AX SIDECDEC
BXCBXLNMBX1BXBXDBXPBXDECOC NEACABX BX ;显示字符DEC)BX MOVDEC,BXL
MOV DL, BL
MOV CLLOOP
ROL DLMOVLAX BX BXD DL, 0FHPROC CALLINTSPL PRMOVNDLVDBL BL MOVMOV,MOV
MOV DROLBROL BLHAL MOV CALL DLDPDL ROL ;MOV位CL AND DLTPROCPROCECNEARDIBLL MOVDDLVMOV BLOCMOVEMOVLL显示一位(DLMOVMOVMOCALLCALLDD DAROLMROL
MOV DLMCALL, 3AH
BLND DL DDD
CALLDL, 27HPROC: MOV AH, 02H
IRET2BL
CALLADDPRET
DLSPMOVCMOVARDISP ADDODLNEAR DL DLOV ;显示4位数(HEX)
AND DL MOVHAHOVAH CMPPDLH CX
MOVBAHDX
ADDHDLX
MOMOVLAHAH
MOV CALINTIPROCNEAR AND DLNDPUSH
PUSHEBXPCALL DICXROADCXDL PUSH BX
POP CX
POP DXSH BX RMOV
PUSH CXENDP
GETPUSHPDXC NRET AX PUSH AX ;字符匹配程序MOV REPUSHHBXUSHBXEGCALPOPRCXPOPNCXRGGGPOPPDXPOPBX 01HRETLLPUSHNTPUSH
POP PUSHDBXAL, RETAXAPUSH AXUSHPAX POP BX CMNEAR, REPUSH AX ENDPPPP
PRODXNEARL, 30H
AH JB DXKDX INPOPP PUPOPCX
CALLXRETNTTSDX JPOP BXOVPOP1BX
POP AXJJZTKKAX POP BXSCMPAAL 0RET
AHPJBL, 0FHJB CMP ALBE GCMP
JBCMP AL, 2AHJZCMP AL JB KKK
POPORCMPOPL, 2FHPOPCMP POPJA KKK
JBSUB ALAL20H
ALCMPCMPOV CCMP04H
JB ALSHL AL,CLSCAL CMP ALRJBP,ALHJB CMP ALALDD DX ,ASAL CMPJB CMP ALGJAKKKCMP ALLFAL CAL ALVJAH, 09H
CLCMJBALDX,JBFDXT ERRDXJALCL ALNTXORBAHCMPHL DCMPPDXEGEALDXXORLAHSCMPX
CJMPALSADDDDXL AX JBE XOCMP AH POP CX
ADD DX AXT
GOFFSETJMCL CL INT OFFSETSHL MOVDAH
INT END STMALDXOCMPPTINTAXPPUSJBEPOPDJBEPCAHETPOPACXDPADDCDXAADDPDXADDDXENDINTENDCLINTINTEND
上一页 [1] [2] [3] [4]
温度控制电路系统 第4页下载如图片无法显示或论文不完整,请联系qq752018766