微机原理问题!高手求答

2024-11-25 18:10:42
推荐回答(1个)
回答1:

; multi-segment executable file template.
data segment
ABC DB 09FH,026H,012H,05AH,023H;
BCD DB 074H,0D3H,054H,043H,07DH;
CBA DB 5 DUP(0);
pkey db "press any key...$"
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax

MOV CX,5;规定执行次数
MOV SI,OFFSET BCD;
MOV DI,OFFSET ABC;
MOV BP,OFFSET CBA;

M: MOV AL,[SI];
MOV BL,[DI];
ADD AL,BL;

MOV DS:[BP],AL;
INC BP;
INC SI;
INC DI;
DEC CX;

JCXZ N;
JMP M;

N: lea dx, pkey
mov ah, 9
int 21h ; output string at ds:dx

; wait for any key....
mov ah, 1
int 21h

mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.