A small example of what causing confuision for me:

ss proc
mov eax, 10
cmp eax, 10
je ns
ss endp

ns proc
;do some stuff
jmp exit
ns endp

I keep getting an error at 'jmp exit' that exit is an undefined label.
Both proc are defined in the same file, both procs are EXTERNDEFed. I did a search, do I need to make labels public? The only reason for breaking it into another proc is clarity. If someone has a suggestion keeping it all in one proc, that would be appreciated too. Thanks.
Posted on 2002-04-10 11:01:03 by ThoughtCriminal
Alright, just figured out the 'all in one proc' way.

But I'm still interested in how can I use a label defined in one proc in another.

Now that I think about, that might be a great way to write spegetti code.
Posted on 2002-04-10 11:15:55 by ThoughtCriminal
exit:: <- Note the extra colon!

Its not just a great way to write spaghetti code, its also a great way to write highly dangerous code which screws over the stack!

Posted on 2002-04-10 12:00:14 by Mirno
Thanks Mirno, now I'm off to program spagetti /jk
Posted on 2002-04-10 12:08:52 by ThoughtCriminal
Be very careful with jumps between procs.. Unless you've got a good reason to use them, don't :).
If the two procs have a different number of parameters and you jump to the other proc, the stack will be corrupted if you return..

Posted on 2002-04-10 12:34:49 by Thomas
Its worse than that Thomas, if there is a uses statement at the start of the proc, if you pop anything off the stack that isn't there because you didn't push it in the original process there will be an earth shattering kaboom...

Posted on 2002-04-10 12:40:26 by Mirno
And you're JMPing to a RET, which is just extra overhead. And I think this screws up branch prediction on some CPUs, slowing things down even more.

It's just generally not a good thing to do. That's why MASM makes it difficult to do. :)
Posted on 2002-04-17 22:12:22 by S/390