Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!anaconda.cis.ohio-state.edu!meekins From: meekins@anaconda.cis.ohio-state.edu (Tim Meekins) Newsgroups: comp.sys.apple2 Subject: Re: Arrrgh, why's this not working? Message-ID: <133716@tut.cis.ohio-state.edu> Date: 12 Jun 91 23:48:33 GMT References: <1181@spool.mu.edu> Sender: news@tut.cis.ohio-state.edu Organization: The Ohio State University, Department of Computer and Information Science Lines: 100 In article <1181@spool.mu.edu> jake@labpca.mscs.mu.edu (Jake Buchholz) writes: > > >ORCA/M ASM65816 1.1.1 9 Jun 1991 14:18:47 > >Pass 1: rpt >Pass 2: rpt > 0014 + PH2 &CHAR >Error RPT.ASM 22 Unidentified Operation > The macro ph2 wasn't found, after it got expanded by COUT macro. This is strange since PL2. Just to make sure you get all the macros, do the following: 1. change both of your 'mcopy's to a single 'mcopy rpt.mac' 2. From the orca shell type 'macgen rpt.asm rpt.mac 2/ainclude/m16=' This will create a file for you called rpt.mac which contains only the macros used in your program. If it says it couldn't find a macro, and gives you a prompt. Type '2/ainclude/m16=' again. (there are better ways...) >Another question would be whether or not I'm passing the parameters correctly. >(Either this kind of thing doesn't show up in the manuals (Orca/C or Orca/M) >or my retina's been burnt out by this screen worse than I've expected...) > OK. This is the part you really screwed up. It's a good thing it didn't compile or you would have crashed after running it :( {fingers crossed, this isn't that easy to explain} placing 'dc' at the beginning of your routine is actually placing data at the beginning of the function. When the function is called, these data will be interpreted as actually assembly instructions, BRK in this case. Data items need to placed at the end. But again, you probably knew that. What you didn't know is how to set up a stack frame. This is very tricky if you're not familiar with assembly. In fact, I'm not going to discuss stack frames right now, but I'll follow up if you or anyone else wants to know how to so... To keep things simple, you need a macro which will build the stack frame for. I don't have Orca/C, but Orca/Pascal included an assembly macro called 'subroutine' which will build these stack frames. Try and find it in your Orca/C manual, not the Orca/M manual. It should be there. Since your code doesn't have local variable storage I'll skip that. Put the following as the first line in your code (after removing your dc's) subroutine(t1:2,t2:2) or something like that (I just killed your source and forgot the variable names and length). This will automatically set up a stack frame and actually generate EQU's for t1 and t2 to correspond to stack space. Since you have no return values just use the following at the end, in place of RTL: return If you can't find these macros with Orca/C, let me know. I created a disk of public domain (shareware actually) macros for Orca/M. I can mail you the subroutine and return macros and documentation. Note: If you get into assembly in the future, your code is missing something else needed by the 65816: phb phk plb your code here plb (don't worry, subroutine *should* take of this, or at least *mine* does) This is important if your assembly function resides in another bank than it was called from. Your function will still be expecting the data bank to be in the caller's bank, not the function. phk/plb sets the data bank to the function's. phb/plb saves and restirs the callers data bank. Of couse, this is all trivial since your function doesn't acces any data in the bank anyways. If you need more help, just ask! -- ++------------S-U-P-P-O-R-T---S-H-A-R-E-W-A-R-E---O-R---D-I-E-!-----------++ || Tim Meekins || Snail Mail: || Apple II || || meekins@cis.ohio-state.edu || 8372 Morris Rd. || Forever! || \\___timm@pro-tcc.cts.com________/\____Hilliard, OH 43026__/\_____________//