汇编语言程序实例
汇编语言程序实例 第一份:用汇编语言对4位10进制数加密。密码是0123456789对应为9082746315。 DATA SEGMENT
TABLE DB 39H,30H,38H,32H,37H,34H,36H,33H,31H,35H;密码表
RESULT DB 4 DUP(?);四位十进制数对应的密码
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
MAIN PROC FAR
MOV AX,DATA
MOV DS,AX
MOV ES,AX
LEA BX,TABLE
LEA DI,RESULT
MOV AX,1234;已知的四位十进制数,以下分别求四位十进制数位,并将密码存入RESULT中
MOV SI,1000
CALL NUMBER
MOV SI,100
CALL NUMBER
MOV SI,10
CALL NUMBER
MOV SI,1
CALL NUMBER
LEA DI,RESULT;在屏幕上依次显示四位加密后的十进制数
MOV CX,4
NEXT:
MOV DL,[DI]
MOV AH,2H
INT 21H
INC DI
LOOP NEXT
;按任意键退出
mov ah,1
int 21h
MOV AX,4C00H
INT 21H
MAIN ENDP
NUMBER PROC NEAR
MOV DX,0
DIV SI