Click here to Skip to main content
15,667,355 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I am a very beginner to assembly programming and trying to figure out how to pass a string as an argument to a function(sub program) in nasm and then print character by character.

Note: 16 bit assembler, utilizing stacks

could you please help me in this regards.
Updated 27-Mar-13 8:54am
Sergey Alexandrovich Kryukov 27-Mar-13 14:58pm    
CPU? Memory model? (Flat? segment-offset?) even the concrete assembler product makes some difference. Basically, you just push the address on stack.

1 solution

Push the address of the string on stack, that's all. All further detail depend on many factors; please see my comment to the question.

Share this answer
[no name] 27-Mar-13 15:02pm    
ok...sorry i missed them. The cpu: Intel and memory model: flat.
Sergey Alexandrovich Kryukov 27-Mar-13 15:11pm    
In 16-bit OS? what is that? Never saw such thing (I heard they were available...). So, do you know by yourself how an address is represented? Flat 16-bit? But then it's only 64K of memory -- are you sure? Is it 90286 or something? :-)

Nevertheless, my advice works. In all non-primitive data structures, you just push the address to stack, and the called function should work with this address...
CPallini 27-Mar-13 16:28pm    
"Flat 16-bit? But then it's only 128K of memory"
My 5, anyway.
Sergey Alexandrovich Kryukov 27-Mar-13 16:37pm    
128K, 64K... hard to imagine, anyway... :-)
Thank you, Carlo...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900