home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!cs.uoregon.edu!news.uoregon.edu!nntp.uoregon.edu!cie.uoregon.edu!jlavin
- From: jlavin@cie.uoregon.edu (Jeff Lavin)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Assembler problem (Macro68)
- Message-ID: <1992Nov5.071820.3926@nntp.uoregon.edu>
- Date: 5 Nov 92 07:18:20 GMT
- Article-I.D.: nntp.1992Nov5.071820.3926
- References: <1992Nov3.190743.540@news.uit.no>
- Sender: news@nntp.uoregon.edu
- Organization: The Puzzle Factory
- Lines: 60
-
- In article <1992Nov3.190743.540@news.uit.no>, borgen@stud.cs.uit.no (Borge Noest) writes:
- >Does the following code look good to you?
- >
- >yes equ 0
- >no equ -1
- >
- >jump equ yes
- >
- > moveq #0,d0
- >
- > beq .weee
- >
- > if jump
- >.weee moveq #1,d1
- > elseif
- >.weee moveq #2,d1
- > endc
- >
- > rts
- >
- >------
- >
- >Well, Macro68 v3.170 doesn't like it (can't find .weee).
- >ArgAsm and DevPac accepts it (doing the moveq #1,d1 variant).
- >
- >Is my code bogus? Have I missed something about Macro68?
- >
- >Thanks in advance.
-
- There are 2 problems here: The one causing most of the trouble is the ELSEIF
- directive. Macro68 doesn't have an ELSEIF directive, although you could
- define one in the macro68custom file. In this particular example, 'IF jump'
- is always going to evaluate false. Macro68 does not check code inside a
- false conditional block for validity. Therefore, the block above actually is
- assembled as:
-
- if jump
- .weee moveq #1,d1
- .weee moveq #2,d1
- endc
-
- and the labels are never seen at all. If the ELSEIF statement is changed to
- ELSE (or a directive named ELSEIF is defined in the macro68custom file), the
- file will assemble correctly.
-
- The second problem is more one of programming style. It is generally not a
- good idea to use IF. In this case, Macro68 is actually evaluating the value
- of the label, which is zero. However, in a more complex example this may not
- do what you want, or expect. It is better to use specific conditions such as
- IFEQ, IFNE, IFGE, etc.
-
- I hope that this was of help, and that it will enable you to get the most
- from Macro68. Because you are not located in North America, you will need to
- contact DigiSoft for customer support. They can be reached at:
- cbmaus!cbmozq!digisoft!paulc@cbmvax.cbm.commodore.com
- --
- The Puzzle Factory, Inc. | Jeff Lavin -- jlavin@cie.uoregon.edu
- Veneta, Oregon |-------------------------------------
- Voice : (503) 935-3709 | Remainder of signature line
- Data : (503) 935-7883 | under construction.
-