ASCII ADJUSTMENT INSTRUCTIONS
CODE SEGMENT
ASSUME CS:CODE
START: MOV AX,31H
ADD AX,39H
AAA
ADD AX,3030H
MOV BL,9
MOV AX,0702H
AAD
DIV BL
MOV AL,5
MOV CL,5
MUL CL
AAM
ADD AX,3030H
MOV AX,38H
SUB AX,31H
AAS
AX,3030H
MOV AH,4CH
INT 21H
CODE ENDS
END START
BINARY TO BCD CONVERSION
DATA SEGMENT
BIN DW 01A9H
BCD DB 2 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,BIN
MOV CL,64H
DIV CL
MOV BCD+1,AL
MOV AL,AH
MOV AH,00H
MOV CL,0AH
DIV CL
MOV CL,04
ROR AL,CL
ADD AL,AH
MOV AH,4CH
INT 21H
CODE ENDS
END START
Input: binary--------01A9
Output: bcd------------425
BCD TO BINARY CONVERSION
DATA SEGMENT
BCD DW 27H
BIN DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,BCD
AND AX,07H
MOV BX,AX
MOV AX,BCD
AND AX,0F0H
MOV CX,0AH
MUL CX
ADD AX,BX
MOV BIN,AX
MOV AH,4CH
INT 21H
CODE ENDS
END START
Input: BCD-------------27
Output:------------------1B