程序如下:
.386
A1 SEGMENT USE16
BUF1 DB '123GOOD'
BUF2 DB 7 DUP(?)
A1 ENDS
B1 SEGMENT USE16 STACK
DB 200 DUP(0)
B1 ENDS
C1 SEGMENT USE16
ASSUME DS:A1,SS:B1,CS:C1
BEGIN: MOV AX,A1
MOV DS,AX
LEA DI,BUF1
MOV BX,7
PART1: PUSH DI
INC DI
DEC BX
JNZ PART1
MOV CX,7
LEA DI,BUF2
PART2: POP BX
MOV [DI],BX
INC DI
DEC CX
JNZ PART2
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
C1 ENDS
END BEGIN
请指教哪里有错啊。
------解决方案--------------------------------------------------------
栈对字操作,所以,这里没必有用栈。
- Assembly code
D:\MASM>type 329.asm;This Program Compiled Sucess by Masm 6.15assume cs:code,ds:datadata segmentbuf1 db '123GOOD'buf2 db buf2-buf1 dup (?) data endscode segmentstart: mov ax,data mov ds,ax mov cx,lengthof buf1 mov si,offset buf1 add si,cx dec si mov di,offset buf2s: mov al,[si] mov [di],al dec si inc di loop s mov byte ptr [di],'$' mov dx,offset buf2 mov ah,9 int 21h mov ah,4ch int 21hcode endsend startD:\MASM>329DOOG321D:\MASM>