Tomas
Tomas

Reputation: 31

TASM extra characters when calling subroutine

So I have this subroutine:

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

I try to call it using

call print_msg, offset msg_description

but on this line, tasm says "extra characters on line". How to fix this? Thank you.

Upvotes: 1

Views: 4402

Answers (1)

Jester
Jester

Reputation: 58762

call only takes a single operand, the address of the subroutine. You need to pass arguments by hand, according to whatever convention tasm uses if you declare a proc like you did. Assuming it uses the usual stack based convention, you will need something like:

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

Upvotes: 3

Related Questions