DATAS SEGMENT
SJA DB 1,3,5,1,2
SJB DB 2,4,6,2,3
SJC DB 20,40,60,20,10
SJD DB 4,5,6,4,5
SJE DB 5,20,20,20,15
BUF1 DB 10 DUP(' ')
BUF2 DB 10 DUP(' ')
DATAS ENDS
STACKS SEGMENT
DW 10 DUP(0)
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
MOV BX,0
LEA SI,BUF1
LEA DI,BUF2
MOV CX,5
A3: MOV DL,SJA[BX]
MOV AL,SJB[BX]
MUL DL
MOV BP,AX
MOV DL,SJD[BX]
MOV AL,SJC[BX]
CBW
DIV DL
MOV DX,BP
ADD DL,AL
ADC DH,0
SUB DL,SJE[BX]
SBB DH,0
CMP DX,0
JL A1
MOV [SI],DX
JMP A2
A1: MOV [DI],DX
A2: ADD SI,2
ADD DI,2
INC BX
DEC CX
JNZ A3
LEA SI,BUF1
MOV BP,10
A11:MOV AL,[SI+1]
CMP AL,' '
JE A13
MOV BL,AL
MOV CL,4
SHR AL,CL
AND BL,0FH
CMP AL,9
JA A31
ADD AL,30H
JMP A4
A31:ADD AL,37H
A4: MOV DL,AL
MOV AH,2
INT 21H
CMP BL,9
JA A5
ADD BL,30H
JMP A6
A5: ADD BL,37H
A6: MOV DL,BL
MOV AH,2
INT 21H
MOV AL,[SI]
MOV BL,AL
MOV CL,4
SHR AL,CL
AND BL,0FH
CMP AL,9
JA A7
ADD AL,30H
JMP A8
A7: ADD AL,37H
A8: MOV DL,AL
MOV AH,2
INT 21H
CMP BL,9
JA A9
ADD BL,30H
JMP A0
A9: ADD BL,37H
A0: MOV DL,BL
MOV AH,2
INT 21H
MOV DL,' '
MOV AH,2
INT 21H
A13:MOV CX,5
A14:MOV DL,' '
MOV AH,2
INT 21H
LOOP A14
A12:ADD SI,2
DEC BP
JNZ A11
MOV AH,4CH
INT 21H
CODES ENDS
END START
程序很长就不具体解释了,功能区都隔行了的,BUF1和BUF2之间会显示一串空格来分隔。