home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / programm / 15384 < prev    next >
Encoding:
Internet Message Format  |  1992-11-04  |  2.4 KB

  1. Path: sparky!uunet!ogicse!cs.uoregon.edu!news.uoregon.edu!nntp.uoregon.edu!cie.uoregon.edu!jlavin
  2. From: jlavin@cie.uoregon.edu (Jeff Lavin)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Assembler problem (Macro68)
  5. Message-ID: <1992Nov5.071820.3926@nntp.uoregon.edu>
  6. Date: 5 Nov 92 07:18:20 GMT
  7. Article-I.D.: nntp.1992Nov5.071820.3926
  8. References: <1992Nov3.190743.540@news.uit.no>
  9. Sender: news@nntp.uoregon.edu
  10. Organization: The Puzzle Factory
  11. Lines: 60
  12.  
  13. In article <1992Nov3.190743.540@news.uit.no>, borgen@stud.cs.uit.no (Borge Noest) writes:
  14. >Does the following code look good to you?
  15. >
  16. >yes    equ    0
  17. >no    equ    -1
  18. >
  19. >jump    equ    yes
  20. >
  21. >    moveq    #0,d0
  22. >
  23. >    beq    .weee
  24. >
  25. >    if    jump
  26. >.weee    moveq    #1,d1
  27. >    elseif
  28. >.weee    moveq    #2,d1
  29. >    endc
  30. >
  31. >    rts
  32. >
  33. >------
  34. >
  35. >Well, Macro68 v3.170 doesn't like it (can't find .weee).
  36. >ArgAsm and DevPac accepts it (doing the moveq #1,d1 variant).
  37. >
  38. >Is my code bogus? Have I missed something about Macro68?
  39. >
  40. >Thanks in advance.
  41.  
  42. There are 2 problems here: The one causing most of the trouble is the ELSEIF
  43. directive.  Macro68 doesn't have an ELSEIF directive, although you could
  44. define one in the macro68custom file.  In this particular example, 'IF jump'
  45. is always going to evaluate false.  Macro68 does not check code inside a
  46. false conditional block for validity.  Therefore, the block above actually is
  47. assembled as:
  48.  
  49.     if    jump
  50. .weee    moveq    #1,d1
  51. .weee    moveq    #2,d1
  52.     endc
  53.  
  54. and the labels are never seen at all.  If the ELSEIF statement is changed to
  55. ELSE (or a directive named ELSEIF is defined in the macro68custom file), the
  56. file will assemble correctly.
  57.  
  58. The second problem is more one of programming style.  It is generally not a
  59. good idea to use IF.  In this case, Macro68 is actually evaluating the value
  60. of the label, which is zero.  However, in a more complex example this may not
  61. do what you want, or expect.  It is better to use specific conditions such as
  62. IFEQ, IFNE, IFGE, etc.
  63.  
  64. I hope that this was of help, and that it will enable you to get the most
  65. from Macro68.  Because you are not located in North America, you will need to
  66. contact DigiSoft for customer support.  They can be reached at:
  67.   cbmaus!cbmozq!digisoft!paulc@cbmvax.cbm.commodore.com
  68. -- 
  69. The Puzzle Factory, Inc.  | Jeff Lavin -- jlavin@cie.uoregon.edu
  70. Veneta, Oregon            |-------------------------------------
  71. Voice : (503) 935-3709    | Remainder of signature line
  72. Data  : (503) 935-7883    | under construction.
  73.