home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!creiman
- From: creiman@Apple.COM (Charlie Reiman)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: MacsBug symbols from assembler code?
- Message-ID: <71479@apple.Apple.COM>
- Date: 21 Aug 92 17:19:11 GMT
- References: <1992Aug20.155733.6869@daimi.aau.dk> <1992Aug21.030941.6506@bilby.cs.uwa.edu.au>
- Organization: Apple Computer Inc., Cupertino, CA
- Lines: 105
-
- quinn@cs.uwa.edu.au (Quinn) writes:
-
- >In article <1992Aug20.155733.6869@daimi.aau.dk> Peter Andersen,
- >datpete@daimi.aau.dk writes:
- >>Am I missing something?
-
- >Hmm. I had great fun getting MacsBug symbols working consistently
- >in my latest Asm project. Try using the following macro (with
- >apologies to those people whose systems don't expand tabs
- >properly)...
-
- >----------------------------------------------
- > macro
- > MacsBug &Name,&rts:int
- > lclc &oldstr
- > gbla &debug
-
- > if &debug then
- >
- > if &rts then
- > rts ; force rts in specific cases
- > endif
- >
- > dc.b &len(&name)+$80 ; length of string + $80 marks symbol
- >&oldstr setc &setting('string')
- > string AsIs
- > dc.b '&upcase(&Name)' ; define the string AsIs
- > string &oldstr
- > align ; pad to word boundary
- > dc.w 0 ; no literals
- >
- > endif
- >
- > endm
-
- This is almost correct :-) If you have the Macsbug manual, the definition
- of a procedure is on p. 408. Follow the bouncing ball if you have a copy,
- otherwise just mumble through the quote below.
-
- Begin quote:
-
- A procedure is defined as follows:
- o LINK A6 - This instruction is optional; if it is missing, the start
- of the proche procedure is assumed to be immediately after the preceding
- procedure, or at the start of the heap block.
- o Procedure code
- o RTS or JMP (a0) or RTD
- o Procedure name
- o Procedcure constants
-
- End quote.
-
- So the most likely reason you aren't always seeing your symbols is because
- you don't have LINK/UNLK pairs. (I usually don't use them since most asm
- code I write is just glue. Stack frames are overkill for me. I'm making
- the assumption you don't use them much either.)
-
- Second problem: You macro only covers one of the 4 styles of symbols.
- To paraphrase The Book:
-
- Valid symbol characters: [a-zA-Z0-9_%. ] Space is only allowed to pad out
- fixed length symbols
-
- 8 character names: First byte is $20-$7f or $a0-$ff. If the high bit is
- set, ignore it. The next character must have its high bit clear.
-
- 16 character names: First byte is $20-$7f or $a0-$ff, as for 8 byte
- symbols. The second byte will have its high bit set, however. This symbol
- style is used for Object Pascal. The first 8 bytes are the method, the
- second 8 the class.
-
- Still with me? Good. Now we get to the styles you probably want to use:
-
- Short variable length symbol: First byte is $81-$9F. This is the length
- with the high bit set. This is immediately followed by the name itself.
-
- Long variable length symbol: First byte is $80, followed by a length byte,
- followed by the actual name.
-
- For both variable length symbols, its a good idea to place the constant
- data marker after the symbol. The Book sez: "The first word after the
- name specified how many bytes of constant data are present. If there
- are no constants, a length of 0 must be given."
-
- In short, a good symbol would be defined like this:
-
- MyFunkyProc PROC
- link a6,#0
- unlk a6
- rts
- dc.b 11+128,'MyFunkyProc'
- dc.w 0000
- ENDP
-
- You might be able to use only the long variable length style in your macro
- to make life easier on yourself. I haven't tried this but its worth a shot.
-
- Have f
- Bus Err while trying to execute from $50FFC001.
-
-
- --
- Charlie Reiman - Speaking as an individual, not for Apple Computer.
- creiman@apple.com
- "NEW! Posting Lite! 98% fact free!"
-