2014-11-22 60 views
1

TASM时,多余的字符所以我有这个子程序:调用子程序

proc print_msg msgptr:word 
    mov dx, [msgptr] 
    mov ah, 9h 
    int 21h 
    ret 
endp 

我尝试使用

call print_msg, offset msg_description 

,但在这条线上,TASM说:“上线额外的字符”来称呼它。如何解决这个问题?谢谢。

回答

1

call只需要一个操作数,子程序的地址。如果您像您一样声明proc,则需要根据任何约定tasm手动传递参数。假设它使用通常的基于堆栈的约定,则需要类似如下内容:

push offset msg_description 
call print_msg 
add sp, 2 ; remove argument if called proc doesn't end with `ret 2`