home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!smurf.sub.org!easix!quax.GUN.de!peti.GUN.de!simons
- From: simons@peti.GUN.de (Peter Simons)
- Message-ID: <1409.ANN@peti.GUN.de>
- Date: Sat, 15 Aug 1992 16:42:34 CET
- Organization: * Private Amiga Site Bonn *
- Newsgroups: comp.sys.amiga.programmer
- Distribution: world
- Subject: Re: Is this legal assembly code?
- References: <1992Aug11.122845.15395@mits.mdata.fi>
- X-Newsreader: Ann 0.9
- Lines: 57
-
- In article <1992Aug11.122845.15395@mits.mdata.fi>,
- rkaivola@mits.mdata.fi (Risto Kaivola) writes:
-
- RK> I would like to know if the following assembly language program
- RK> is legal or illegal:
- RK>
- RK> IFEQ label1-label2
- RK> rts
- RK> ENDC
- RK>
- RK> rts
- RK> label1
- RK> move.l a0,a0
- RK> label2 rts
- RK> END
- RK>
- RK> [...] I tried this on A68k (version 2.71, I think), and it
- RK> complained of a duplicate symbol. Would you try it on your
- RK> assembler and tell me what it thinks of it, please? [...]
-
- This code is not really illegal, but not many assemblers will
- assemble this correctly. The problem is the forward-reference!
- The value of the labels will change if any changes to the
- code-size occur during the assembling-passes.
-
- Example:
- GO MACRO
- IFGE (\1-*)-127
- bra.b \1
- ELSE
- bra \1
- ENDC
- ENDM
- .
- .
- .
-
- GO testlabel
- .
- .
- .
- move.l #0,d0
- label bsr _foobar
-
- Most assemblers will evaluate the labels in pass 1 and optimize
- the "move.l" to "moveq" in pass 2, which will make the code
- shorter!!!
-
- The only assembler - I know - that supports forward-references is
- Macro68k, but you have to disable *ALL* optimizations!
-
- bye, Peter
-
-
- --
- Peter Simons FIDO-Net USE-Net
- +49 (0)228-746061 Voice 2:2402/320.5 simons@peti.GUN.de
-