
Сообщение от
lvd
devpac на амиге: локальные метки == .metka, ограничены обычными. Ещё удобнее, чем цифры only - так как можно и .1 .2 .3 писать, так и .label .metka
В SjASM тоже есть локальные метки. Только, что цифры как локальные метки теперь не поддерживаются - определяются как директива повтора строки (как в Шторм)

Сообщение от
elf/2
так может довести это похожее до ума? имхо цифры менее удобны в качестве мнемонических обозначений...
кроме того остальные плюсы цифровые метки не покрывают
Реализаций данной функции ассемблеров может быть много, например вот как это сделано в WLA DX:
Код:
3.3. Labels
Labels are ordinary strings (which can also end to a ':'). Labels starting
with "_" are considered to be local labels and do not show outside sections
where they were defined, or outside object files, if they were not defined
inside a section.
Here are few examples of different labels:
VBI_IRQ:
VBI_IRQ2
_VBI_LOOP:
main:
Note that when you place ':' in front of the label string when referring to
it, you'll get the bank number of the label, instead of the label's address.
Here's an example:
LD A, :LOOP
.BANK 2 SLOT 0
LOOP:
Here "LD A, :LOOP" will be replaced with "LD A, 2" as the label LOOP is
inside the bank number two.
When you are referring to a label and you are adding something to its address
(or subtracting, any arithmetics apply) the result will always be bytes.
.org 20
DATA: .dw 100, 200, 300
ld a, DATA+1
^^^^^^ = r
So here the result r will be the address of DATA plus one, here 21. Some x86
assemblers would give here 22 as the result r as DATA points to an array
or machine words, but WLA isn't that smart (and some people including me
think this is the better solution).
You can also use -, --, ---, +, ++, +++, ... as un-named labels.
Labels consisting of '-' are meant for reverse jumps and labels consisting
of '+' are meant for forward jumps. You can reuse un-named labels as much
as you wish inside your source code. Here's an example of this:
dec e
beq ++ ; jump -> ?
dec e
beq + ; jump -> %
ld d, 14
--- ld a, 10 ; !
-- ld b, c ; #
- dec b ; *
jp nz, - ; jump -> *
dec c
jp nz, -- ; jump -> #
dec d
jp nz, --- ; jump -> !
ld a, 20
- dec a ; $
jp nz, - ; jump -> $
+ halt ; %
++ nop ; ?
Note that "__" (that's two underline characters) serves also as a un-named
label. You can refer to this label from both directions. Use "_b" when
you are jumping backwards and "_f" when you are jumping forwards label "__".
Example:
dec e
jp z, _f ; jump -> *
dec e
__ ldi a, (hl) ; *
dec e
jp nz, _b ; jump -> *