home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pmafire!news.dell.com!swrinde!gatech!news.byu.edu!yvax.byu.edu!physc1.byu.edu!seth
- Newsgroups: comp.sys.mac.programmer
- Subject: Assembly with C question...
- Message-ID: <1992Dec12.232559.265@physc1.byu.edu>
- From: seth@physc1.byu.edu
- Date: 12 Dec 92 23:25:59 -0700
- Distribution: world
- Organization: Brigham Young University
- Lines: 38
-
- Hi. I have a question about assembly language and C. Here is a snippet of
- C code, followed by the same thing disassembled.
-
-
- main()
- {
- Init();
- MakeMenus();
- MakeWindow();
- AddrsSet();
- MakeGrid();
-
-
- main:
- 00000000 JSR $0000(A5)
- 00000004 JSR $0000(A5)
- 00000008 JSR $0000(A5)
- 0000000C JSR $0000(A5)
- 00000010 JSR $0000(A5)
-
-
- My question is, why are all the function calls done in this way? How can I
- tell what the offset relative to a5 is? I am confused. I have till now only
- done assembly in the MDS (sad, sad) assembler. (yes, I was the one whining
- about it a few weeks ago. The class is over, and now I can do assembly with
- the inline assembler of THINK C like so many of you suggested...)
- In the MDS Assembler we always could tell just what our offsets were,
- becaused we used labels. I don't understand how all these function calls can
- be made with an offset of $0000(a5). Isn't a5 the global area? Why are the
- function calls going there anyways? Shouldn't they be going to the code area,
- with offsets relative to the PC? I obviously don't see what is supposed to be
- going on here, and I would appreciate it if one of you assembly gurus would
- enlighten me...
-
- Thanks,
- Seth Leigh
- BYU Physics Dept.
-
-