home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 14327 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  3.7 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!creiman
  2. From: creiman@Apple.COM (Charlie Reiman)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: MacsBug symbols from assembler code?
  5. Message-ID: <71479@apple.Apple.COM>
  6. Date: 21 Aug 92 17:19:11 GMT
  7. References: <1992Aug20.155733.6869@daimi.aau.dk> <1992Aug21.030941.6506@bilby.cs.uwa.edu.au>
  8. Organization: Apple Computer Inc., Cupertino, CA
  9. Lines: 105
  10.  
  11. quinn@cs.uwa.edu.au (Quinn) writes:
  12.  
  13. >In article <1992Aug20.155733.6869@daimi.aau.dk> Peter Andersen,
  14. >datpete@daimi.aau.dk writes:
  15. >>Am I missing something?
  16.  
  17. >Hmm.  I had great fun getting MacsBug symbols working consistently
  18. >in my latest Asm project.  Try using the following macro (with
  19. >apologies to those people whose systems don't expand tabs
  20. >properly)...
  21.  
  22. >----------------------------------------------
  23. >    macro
  24. >    MacsBug    &Name,&rts:int
  25. >    lclc    &oldstr
  26. >    gbla    &debug
  27.  
  28. >    if &debug then
  29. >    
  30. >    if &rts then 
  31. >    rts                ; force rts in specific cases
  32. >    endif
  33. >    
  34. >    dc.b    &len(&name)+$80        ; length of string + $80 marks symbol
  35. >&oldstr    setc    &setting('string')
  36. >    string    AsIs
  37. >    dc.b    '&upcase(&Name)'    ; define the string AsIs
  38. >    string    &oldstr
  39. >    align                ; pad to word boundary
  40. >    dc.w    0            ; no literals
  41. >    
  42. >    endif
  43. >    
  44. >    endm
  45.  
  46. This is almost correct :-) If you have the Macsbug manual, the definition
  47. of a procedure is on p. 408. Follow the bouncing ball if you have a copy,
  48. otherwise just mumble through the quote below.
  49.  
  50. Begin quote:
  51.  
  52. A procedure is defined as follows:
  53.  o LINK A6 - This instruction is optional; if it is missing, the start
  54.    of the proche procedure is assumed to be immediately after the preceding
  55.    procedure, or at the start of the heap block. 
  56.  o Procedure code
  57.  o RTS or JMP (a0) or RTD
  58.  o Procedure name
  59.  o Procedcure constants
  60.  
  61. End quote.
  62.  
  63. So the most likely reason you aren't always seeing your symbols is because
  64. you don't have LINK/UNLK pairs. (I usually don't use them since most asm
  65. code I write is just glue. Stack frames are overkill for me. I'm making
  66. the assumption you don't use them much either.)
  67.  
  68. Second problem: You macro only covers one of the 4 styles of symbols.
  69. To paraphrase The Book:
  70.  
  71. Valid symbol characters: [a-zA-Z0-9_%. ] Space is only allowed to pad out
  72. fixed length symbols
  73.  
  74. 8  character names: First byte is $20-$7f or $a0-$ff. If the high bit is
  75. set, ignore it. The next character must have its high bit clear.
  76.  
  77. 16 character names: First byte is $20-$7f or $a0-$ff, as for 8 byte
  78. symbols. The second byte will have its high bit set, however. This symbol
  79. style is used for Object Pascal. The first 8 bytes are the method, the
  80. second 8 the class.
  81.  
  82. Still with me? Good. Now we get to the styles you probably want to use:
  83.  
  84. Short variable length symbol: First byte is $81-$9F. This is the length
  85. with the high bit set. This is immediately followed by the name itself.
  86.  
  87. Long variable length symbol: First byte is $80, followed by a length byte,
  88. followed by the actual name.
  89.  
  90. For both variable length symbols, its a good idea to place the constant
  91. data marker after the symbol. The Book sez: "The first word after the
  92. name specified how many bytes of constant data are present. If there
  93. are no  constants, a length of 0 must be given."
  94.  
  95. In short, a good symbol would be defined like this:
  96.  
  97. MyFunkyProc   PROC
  98.           link a6,#0
  99.           unlk a6
  100.           rts
  101.           dc.b 11+128,'MyFunkyProc'
  102.           dc.w 0000
  103.           ENDP
  104.  
  105. You might be able to use only the long variable length style in your macro
  106. to make life easier on yourself. I haven't tried this but its worth a shot.
  107.  
  108. Have f
  109. Bus Err while trying to execute from $50FFC001.
  110.  
  111.  
  112. -- 
  113. Charlie Reiman - Speaking as an individual, not for Apple Computer.
  114. creiman@apple.com
  115.         "NEW! Posting Lite! 98% fact free!"
  116.