急!!!微机原理课本里面的汇编语言例子,用MASMPlus运行错误。请问错在哪里?
NAME EX1
PAGE 50,70
DAT SEGMENT PARA 'DAT'
A1 DB 12H,34H,56H,78H,9AH
DB 0BCH,0DEH,0F0H
B1=$-A1
B2=B1*2
A2 DB B2 DUP(?)
DAT ENDS
STAC SEGMENT PARA STACK 'STA'
STA1 DW 100 DUP(?)
STAC ENDS
CODE SEGMENT PARA 'CODE'
ASSUME CS:CODE,DS:DAT
ASSUME SS:STAC,ES:DAT
STAR PROC FAR
PUSH DS
XOR AX,AX
MOV AX,DAT
MOV DS,AX
MOV ES,AX
LEA SI,A1
LEA DI,A2
MOV CX,B1
G1:MOV BL,2
MOV AL,[SI]
MOV BH,AL
PUSH CX
MOV CL,4
ROR AL,CL
POP CX
G2:AND AL,0F0H
DAA
ADD AL,0F0H
ADC AL,40H
MOV [DI],AL
INC DI
MOV AL,BH
DEC BL
JNC G2
INC SI
LOOP G1
MOV SI,OFFSET A2
MOV CX,B2
CALL P1
RET
P1 PROC
MOV BL,2
G: MOV DL,[SI]
MOV AH,2
INT 21H
INC SI
DEC BL
JNZ T
MOV DL,''
MOV AH,2
INT 21H
MOV BL,2
T: LOOP G
RET
P1 ENDP
CODE ENDS
END STAR
运行之后有提示:fatal error A1010: unmatched block nesting : STAR
答案:修改如下:
NAME EX1
PAGE 50,70
DAT SEGMENT PARA 'DAT'
A1 DB 12H,34H,56H,78H,9AH
DB 0BCH,0DEH,0F0H
B1=$-A1
B2=B1*2
A2 DB B2 DUP(?)
DAT ENDS
STAC SEGMENT PARA STACK 'STA'
STA1 DW 100 DUP(?)
STAC ENDS
CODE SEGMENT PARA 'CODE'
ASSUME CS:CODE,DS:DAT
ASSUME SS:STAC,ES:DAT
STAR PROC FAR
PUSH DS
XOR AX,AX
MOV AX,DAT
MOV DS,AX
MOV ES,AX
LEA SI,A1
LEA DI,A2
MOV CX,B1
G1:MOV BL,2
MOV AL,[SI]
MOV BH,AL
PUSH CX
MOV CL,4
ROR AL,CL
POP CX
G2:AND AL,0F0H
DAA
ADD AL,0F0H
ADC AL,40H
MOV [DI],AL
INC DI
MOV AL,BH
DEC BL
JNC G2
INC SI
LOOP G1
MOV SI,OFFSET A2
MOV CX,B2
CALL P1
RET
STAR ENDP
P1 PROC
MOV BL,2
G: MOV DL,[SI]
MOV AH,2
INT 21H
INC SI
DEC BL
JNZ T
MOV DL,' '
MOV AH,2
INT 21H
MOV BL,2
T: LOOP G
RET
P1 ENDP
CODE ENDS
END STAR
错误提示是消失了,但是本程序是什么功能?
其他:貌似不用改,是正确的
=================
MOV SI,OFFSET A2
MOV CX,B2
CALL P1
RET
star endp
上一个:急急............求c语言编译成汇编语言...
下一个:求翻译汇编语言指令