多模块连接程序的 参数传递问题
如以下两个程序:sy29.asm和sy28.asm,用存储器传递参数对吗?(运行结果:不能传递),为什么
sy29.asm: ;将dx,ax置数,并存入0:200h和0:202h两个字单元中,传递参数
extrn divdw:far
DATAS SEGMENT
;此处输入数据段代码
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
main proc far
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
push ds
mov ax,0
push ax
MOV AX,DATAS
MOV DS,AX
mov ax,0ffffh
mov dx,0ffffh
mov bx,0
mov es,bx
mov di,200h
mov word ptr es:[di],ax
inc di
inc di
mov word ptr es:[di],dx
call far ptr divdw ;调用divdw
ret
main endp
CODES ENDS
END START
sy28.asm: ;从0:200h和0:202h中取出ax,dx并运算,转换为十进制数并显示
public divdw
DATAS SEGMENT
db 100 dup(?) ;储存转换后的十进制数
DATAS ENDS
STACKS SEGMENT
STACKS ENDS
CODES SEGMENT
divdw proc far
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
mov si,0
mov ax,0 ;从0:200h和0:202h中取出ax,dx
mov es,ax
mov di,200h
mov ax,es:[di]
inc di
inc di
mov dx,es:[di]
mov cx,10 ;除数
lop:push bx ;运算并储存
mov bx,ax
mov ax,dx
mov dx,0
div cx
push ax
mov ax,bx
div cx
mov ds:[si],dl
pop dx
pop bx
inc si
cmp ax,0
jne lop
mov ax,0b800h ;显示
mov es,ax
mov di,0
mov cx,si
dec si
s1: mov al,ds:[si]
add al,30h
mov byte ptr es:[di],al
inc di
inc di
dec si
loop s1
ret
divdw endp
CODES ENDS
END START