Another Question : Unscoped re-usable labels

Started by Citric, May 12, 2005, 01:02:11 PM

Previous topic - Next topic

Citric

I cant seem to get the Addres of an Unscoped re-usable labels like follows

it complains about an "Unknown mnemonic, instruction, redefinition or directive:-"


     mov ebx,10
1:
     __inner__test__label__ equ 1
     sub ebx,1
     jnz __inner__test__label__


by the way this is only a little test code to try and get it working, it has more use in the real code.

Any Ideas?

Cheers Adam

doomsday

The major problem is that you're using an identifier which is indistinguishable from a number (ie. "1") as a label.  Please get out of this habit as it will cause you lots of pain. :(

When the assembler gets to "jnz 1" what is it supposed to generate?
a) a jump to CS:00000001
b) a jump to the label which you've called "1"

This is ambiguous and thus, for an assembler, bad.

Dunno if it's exactly what you want, but the following would work:

mov  ebx, 10
TestLabel_1:
__My_Test_Label_ equ TestLabel_1
sub  ebx, 1
jnz __My_Test_Label__


regards,
-Brent

Citric

Quote from: doomsday on May 12, 2005, 05:34:20 PM
The major problem is that you're using an identifier which is indistinguishable from a number (ie. "1") as a label. Please get out of this habit as it will cause you lots of pain.

A Quote from the GoAsm Assembler Manual @ http://www.godevtool.com/
Quote
Unscoped re-usable labels
You will often have very insignificant jumps destinations and loops in your code which do not need any name at all. For these you can use a label whose name will not be passed to the debugger as a symbol. This is useful when debugging to limit the symbol table to the most significant names in your code. These labels are made up either of all digits, or one character then one or more digits. You may also use a period as a decimal point which makes it much easier to add new local labels to existing code. The label itself must always end in a colon. Here are examples of unscoped re-usable labels:-

L1:
24:
24.6:

You can even use a single stand-alone colon. You might use this for those extremely insignicant jump destinations in your code.

so i need to use a number, i know it can be bad, but i need an Unscoped re-usable label.

jorgon

Hi Citric

How about


mov ebx,10
1:
sub ebx,1
jnz 1
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

doomsday

Citric,

I'm sorry.  I forgot this was in the GoAsm section and I thought I was looking at MASM code.  My bad :(

regards,
-Brent

Citric

Hi All

The solution to both my question was answered in another topic!

http://www.masmforum.com/simple/index.php?topic=1619.msg12467#msg12467

cheers for the answers

Adam

Mark Jones

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08