CODE SEGMENT
ASSUME CS:CODE
TABLE1 DB 0,1,4,9,16,25,36,49,64,81,100,121,144,169,186,225
DB 100 DUP(0)
START:
PUSH CS
POP DS
PUSH CS
POP ES
MOV BL,0
@1:
MOV AH,1
INT 21H
CMP AL,13
JE @2
SHL BL,1
MOV BH,BL
SHL BH,1
SHL BH,1
ADD BL,BH
AND AL,0FH
ADD BL,AL
JMP @1
@2:
CALL LFCR
MOV AL,BL
LEA BX,TABLE1
XLAT
CALL DSPAL
MOV AH,4CH
INT 21H
LFCR: PUSH AX
PUSH DX
MOV AH,2
MOV DL,13
INT 21H
MOV DL,10
INT 21H
POP DX
POP AX
RET
;===============================
DSPAL PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSHF
XOR AH,AH
XOR CX,CX
MOV BL,10
@DSPAL1:
DIV BL
INC CX
MOV DL,AH
XOR AH,AH
OR DX,30H
PUSH DX
CMP AL,0
JNE @DSPAL1
MOV AH,2
@DISPAL2:
POP DX
INT 21H
LOOP @DISPAL2
MOV DL,32
INT 21H
POPF
POP DX
POP CX
POP BX
POP AX
RET
DSPAL ENDP
;================================
CODE ENDS
END START