用汇编写的程序怎样进行编译?
EXTRNLOAD:FAR,SAVE:FARNEQU20SSEGSEGMENTSTACKDB256DUP(?)SSEGENDSDSEGSEGMENTSOURCEDBNDU...
EXTRN LOAD:FAR,SAVE:FAR
N EQU 20
SSEG SEGMENT STACK
DB 256 DUP (?)
SSEG ENDS
DSEG SEGMENT
SOURCE DB N DUP (?)
RESULT DB N+2 DUP (0)
NAME0 DB 'INPUT.DAT',0
NAME1 DB 'OUTPUT.DAT',0
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG,SS:SSEG
START PROC FAR
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DSEG
MOV DS,AX
LEA DX,SOURCE
LEA SI,NAME0
MOV CX,N
CALL LOAD
LEA SI,SOURCE
LEA DI,RESULT
MOV DL,[SI]
MOV DH,DL
MOV [DI],DL
INC SI
INC DI
MOV CX,N-1
AGAIN: MOV AL,[SI]
CMP AL,DH
JBE MIN
MOV DH,AL
JMP NEXT
MIN: CMP AL,DL
JAE NEXT
MOV DL,AL
NEXT: MOV [DI],AL
INC SI
INC DI
LOOP AGAIN
MOV [DI],DL
MOV [DI+1],DH
LEA DX,RESULT
LEA SI,NAME1
MOV CX,N+2
CALL SAVE
RET
START ENDP
CSEG ENDS
END START 展开
N EQU 20
SSEG SEGMENT STACK
DB 256 DUP (?)
SSEG ENDS
DSEG SEGMENT
SOURCE DB N DUP (?)
RESULT DB N+2 DUP (0)
NAME0 DB 'INPUT.DAT',0
NAME1 DB 'OUTPUT.DAT',0
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG,SS:SSEG
START PROC FAR
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DSEG
MOV DS,AX
LEA DX,SOURCE
LEA SI,NAME0
MOV CX,N
CALL LOAD
LEA SI,SOURCE
LEA DI,RESULT
MOV DL,[SI]
MOV DH,DL
MOV [DI],DL
INC SI
INC DI
MOV CX,N-1
AGAIN: MOV AL,[SI]
CMP AL,DH
JBE MIN
MOV DH,AL
JMP NEXT
MIN: CMP AL,DL
JAE NEXT
MOV DL,AL
NEXT: MOV [DI],AL
INC SI
INC DI
LOOP AGAIN
MOV [DI],DL
MOV [DI+1],DH
LEA DX,RESULT
LEA SI,NAME1
MOV CX,N+2
CALL SAVE
RET
START ENDP
CSEG ENDS
END START 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询