ASSUME CS:CODE, DS:DATA, SS:STACK1
DATA SEGMENT
SERIES DB 74H,29H,4AH,3BH
BCD_OUT DW 04H DUP(0H)
BCD EQU 04H
DATA ENDS
STACK1 SEGMENT
BALARAM DW 40H DUP(0H)
TOP_STACK LABEL WORD
STACK1 ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, STACK1
MOV SS, AX
LEA SI, SERIES
LEA DI, BCD_OUT
LEA SP, TOP_STACK
MOV CH, BCD
CALL BIN_BCD
MOV AH, 4CH
INT 21H
BIN_BCD PROC NEAR
PUSHF
PUSH AX
PUSH BX
PUSH CX
NXT_VALUE: MOV AL, [SI]
MOV AH, 0H
MOV CL, 64H
DIV CL
MOV BH, AL
MOV AL, AH
MOV AH, 0H
MOV CL, 0AH
DIV CL
MOV CL, 04H
ROR AL, CL
MOV BL, AH
ADD BL, AL
MOV [DI], AX
INC SI
ADD DI, 02
DEC CH
JNZ NXT_VALUE
POP CX
POP BX
POP AX
POPF
RET
BIN_BCD ENDP
CODE ENDS
END START
DATA SEGMENT
SERIES DB 74H,29H,4AH,3BH
BCD_OUT DW 04H DUP(0H)
BCD EQU 04H
DATA ENDS
STACK1 SEGMENT
BALARAM DW 40H DUP(0H)
TOP_STACK LABEL WORD
STACK1 ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, STACK1
MOV SS, AX
LEA SI, SERIES
LEA DI, BCD_OUT
LEA SP, TOP_STACK
MOV CH, BCD
CALL BIN_BCD
MOV AH, 4CH
INT 21H
BIN_BCD PROC NEAR
PUSHF
PUSH AX
PUSH BX
PUSH CX
NXT_VALUE: MOV AL, [SI]
MOV AH, 0H
MOV CL, 64H
DIV CL
MOV BH, AL
MOV AL, AH
MOV AH, 0H
MOV CL, 0AH
DIV CL
MOV CL, 04H
ROR AL, CL
MOV BL, AH
ADD BL, AL
MOV [DI], AX
INC SI
ADD DI, 02
DEC CH
JNZ NXT_VALUE
POP CX
POP BX
POP AX
POPF
RET
BIN_BCD ENDP
CODE ENDS
END START
No comments:
Post a Comment