Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Using parameter blocks in ASM Message-ID: <47129@apple.Apple.COM> Date: 5 Dec 90 22:46:41 GMT References: <0bLHodC00WBL42hVc=@andrew.cmu.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 30 gd1a+@andrew.cmu.edu (Glen M. Devries) writes: >How does one set up a parameter block in assembly. I need a pointer to >the block and then need to set up the contents. Where can it be? Must it >be in the application heap or can it be in the system heap? You can put the parameter block in a heap block as long as the block is locked for the duration of a call. A more common way is to allocate the space in a stack frame, or if this is an application you're talking about, in the app's global variable space (A5 relative). For example, if you're talking about a Device Manager parameter block, you could do something like this: DoSomething LINK A6,#-ioQElSize ; put pb on the stack MOVEA.L SP,A0 ; and point to it ... ; do whatever with it UNLK A6 ; clean up the stack RTS Obviously if you make an asynchronous call, you can't exit the routine until the call completes, so in that case it would be better to allocate it on the heap or in global space (apps only)... steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ whoami? Steve Christensen snail: Apple Computer, 20525 Mariani Ave, MS-81CS, Cupertino, CA 95035 internet: stevec@apple.com AppleLink: stevec CompuServe: 76174,1712