home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14546 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  2.7 KB

  1. Path: sparky!uunet!usc!sdd.hp.com!uakari.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!NewsWatcher!user
  2. From: REEKES@applelink.apple.com (Jim Reekes)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: MacsBug symbols from assembler code?
  5. Message-ID: <REEKES-240892122200@90.10.20.67>
  6. Date: 24 Aug 92 19:22:58 GMT
  7. References: <1992Aug20.155733.6869@daimi.aau.dk> <1992Aug21.030941.6506@bilby.cs.uwa.edu.au>
  8. Sender: usenet@Apple.COM
  9. Followup-To: comp.sys.mac.programmer
  10. Organization: Apple Computer, Inc.
  11. Lines: 87
  12.  
  13. In article <1992Aug21.030941.6506@bilby.cs.uwa.edu.au>, quinn@cs.uwa.edu.au
  14. (Quinn) wrote:
  15. > In article <1992Aug20.155733.6869@daimi.aau.dk> Peter Andersen,
  16. > datpete@daimi.aau.dk writes:
  17. > >Am I missing something?
  18. > Hmm.  I had great fun getting MacsBug symbols working consistently
  19. > in my latest Asm project.  Try using the following macro (with
  20. > apologies to those people whose systems don't expand tabs
  21. > properly)...
  22. > ----------------------------------------------
  23. >     macro
  24. >     MacsBug    &Name,&rts:int
  25. >     lclc    &oldstr
  26. >     gbla    &debug
  27. >     if &debug then
  28. >     
  29. >     if &rts then 
  30. >     rts                ; force rts in specific cases
  31. >     endif
  32. >     
  33. >     dc.b    &len(&name)+$80        ; length of string + $80 marks symbol
  34. > &oldstr    setc    &setting('string')
  35. >     string    AsIs
  36. >     dc.b    '&upcase(&Name)'    ; define the string AsIs
  37. >     string    &oldstr
  38. >     align                ; pad to word boundary
  39. >     dc.w    0            ; no literals
  40. >     
  41. >     endif
  42. >     
  43. >     endm
  44. > ----------------------------------------------
  45.  
  46. Here's the macro I currently use.
  47.  
  48.  
  49.  
  50.    macro
  51.     symbol      &routineName=&SysMod,&size=0
  52.     lclc        &name, &oldString
  53.  
  54.     IF &TYPE('DEBUG') <> 'UNDEFINED' THEN
  55.         rts
  56.         if &routineName[1:1] = '''' then
  57.             &name: setc &eval(&routineName)
  58.         else
  59.             &name: setc &routineName
  60.         endif
  61.  
  62.         &oldString: setc &setting('string')
  63.         string asis
  64.         if &len(&name) < 32 then
  65.             dc.b &len(&name)+$80,'&name'
  66.         else
  67.             dc.b $80,&len(&name),'&name'
  68.         endif
  69.         string &oldString
  70.         align
  71.         dc.w &size
  72.     endif
  73.  
  74.     endm
  75.  
  76.  
  77. Just becareful where you add this.
  78.  
  79. It needs the RTS because sometimes you write Asm routines without a
  80. Link/Unlink.  The usage should be like this.
  81.  
  82. SomeRoutine   proc
  83.               ...
  84.               ...
  85.               ...
  86.               symbol "SomeRoutine"
  87.               endp
  88.  
  89.  
  90. -----------------------------------------------------------------------
  91. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  92.                              |          Sound Manager Expert
  93. Apple Computer, Inc.         | RAll opinions expressed are mine, and do
  94. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  95. Cupertino, CA 95014          |       employer, Apple Computer Inc.S
  96.