ASM'de lokal isim verme

Başlatan z, 03 Mart 2013, 17:10:57

z

ASM yazımda bol bol label gerekiyor. Bazen programın farklı farklı yerlerinde anlaşılırlığı bozmamak adına aynı labelı kullanma istiyacı duyuyorum.

Mesela sık kullandığım etiketlerden birisi wait. Mecburen etiketlerime wait1, wait2...waitn gibi isimler veriyorum.

Fakat macro yazımlarda olduğu gibi aynı label'in farklı farklı yerlerde kullanmanın bir yolu olması lazım. Bu basit bir pseudo kod ile aşılabilir diye düşünüyorum.

İstediğimi gerçekleştirmenin bir  yolu varmı?

Mesela aşağıdaki mantık ile bu aşılabilir. Yeterki derleyicide benzeri bir tanım olsun.

pesudo kod_blok_başı

wait
     ..........
     ..........
     B   wait

pesudo kod_blok_sonu

pesudo kod_blok_başı

wait
     ..........
     ..........
     B   wait

pesudo kod_blok_sonu
Bana e^st de diyebilirsiniz.   www.cncdesigner.com

z

Hocam sağolasın, Keil için sormuştum. Hazır bilen varsa arama derdinden kurtulayım istedim.

Bir de proc içinde de yapabilmeyi isterim. Yani proceduru komple lokal hale getirmek değilde parca parca lokalleştirmek isterim.
Bana e^st de diyebilirsiniz.   www.cncdesigner.com

mufitsozen

#2
ozur soruyu yanlis anlamisim :-[

Local Label bahsi yardimci olabilir.

http://www.keil.com/support/man/docs/armasm/armasm_Caccjfff.htm

Local labels are a subclass of label. A local label is a number in the range 0-99, optionally followed by a name. Unlike other labels, a local label can be defined many times and the same number can be used for more than one local label in an area.

Local labels do not appear in the object file. This means that, for example, a debugger cannot set a breakpoint directly on a local label, like it can for labels kept using the KEEP directive.

A local label can be used in place of symbol in source lines in an assembly language module:

    on its own, that is, where there is no instruction or directive

    on a line that contains an instruction

    on a line that contains a code- or data-generating directive.

A local label is generally used where you might use a PC-relative label.

Local labels are typically used for loops and conditional code within a routine, or for small subroutines that are only used locally. They are particularly useful when you are generating labels in macros.

The scope of local labels is limited by the AREA directive. Use the ROUT directive to limit the scope of local labels more tightly. A reference to a local label refers to a matching label within the same scope. If there is no matching label within the scope in either direction, the assembler generates an error message and the assembly fails.

You can use the same number for more than one local label even within the same scope. By default, the assembler links a local label reference to:

    the most recent local label of the same number, if there is one within the scope

    the next following local label of the same number, if there is not a preceding one within the scope.

Use the optional parameters to modify this search pattern if required.


ROUT Direktifi ile local labelin scope'unu limitleyebilirsiniz (normal olarak AREA direktifi gecerli)
http://www.keil.com/support/man/docs/armasmref/armasmref_cacdfghg.htm

ROUT direktifi programin herhangi bir yerinde kullanilabilir dolayisi ile bir procedure vb ile kisitli olmazsiniz hatta bu islemi bir makro ile yazarak yada code'un belirli bolumlerini ROUT ile isaretliyerek ayni labeli tekrar tekrar kullanabilirsiniz.

Bir noktaya dikkat local labellar debug ederken problem cikarir. Object icinde yer almadigindan buralara bp koyamazsiniz (bildigim kadari ile)
Aptalca bir soru yoktur ve hiç kimse soru sormayı bırakana kadar aptal olmaz.

Kabil ATICI

aynı sorun bende var çözüm olarak _karakterini kullnıyorum.

wait_1 , wait_yaz_2 gibi.
Bu şekilde temel etiket aynı kalıyor sadece uzantı ile nerede kullandığımıda etiketlemiş oluyorum...
ambar7