Recopilación de preguntas reales 49

Escrito por mí mismo:

Asumir CS: código, DS: datos

Segmento de datos

OUT_TABLE DW PF0, PF1, PF2, PF3, PF4, PF5, PF6 , PF7, PF8, PF9

; Pifang_table

PF0 DB 13, 10, ' 0, 0H $ '

PF1 DB 13, 10, ' 1, 1H $ '

PF2 DB 13, 10, ' 4, 4H $ '

PF3 DB 13, 10, ' 9, 9H $ '

PF4 DB 13, 10,' 16, 10H $ '

PF5 DB 13, 10,' 25, 19H $ '

PF6 DB 13, 10,' 36, 24H $ '

PF7 DB 13, 10, ' 49, 31H $ '

PF8 DB 13, 10, ' 64, 40H $ '

PF9 DB 13, 10, ' 81, 51H $ '

Fin de los datos

Segmento de código

Inicio:

MOV ax, datos

MOV DS, AX

MOV, 1

INT 21H; ingrese un carácter

CMP AL, ' 0 '

Exportación JB

CMP AL, '9'

Exportación JA

Y AL, 0FHAL=0~9

MOV, 0

MOV·BX, ax; BX=0~9

Agregar BX BX

MOV·Ax, [BX]; busque la tabla y obtenga el resultado

LEA DX, OUT_TABLE

Agregar DX, AX

MOV, 9; mostrar

INT 21H

Salir:

MOV AX, 4C00H

INT 21H

Fin del código

Fin del inicio