David Harris wrote: >Hi- >So, does this mean that you explicitly segment you code using absolute addresses in >the code? If, you expand a routine and extend off the page, do you have to >manually resegment the code? (if so, yuck) Hi David, I was describing how I "specifically" handle page switching in assembler, in order that PC transfers execute correctly. The directions that I gave are what I found to work, although it is not quite the same as what Mchp "seems" to describe in their datasheets. Other people use macros for page switching, and this issue has been regurgitated umpteen on piclist. I have no idea how various compilers do it. I don't use absolute addresses, but rather 4 ORG statements, at 0000h, 0800h, 1000h, and 1800h. Specific code goes into each. The assembler keeps you from running past the end of a 2k page. - dan michaels www.oricomtech.com =================== >Dan Michaels wrote: > >> At 07:33 AM 3/21/01 MST, you wrote: >> >> >Reading over the specs, it targets the chips I am using (how lucky am I for >> >that?), so the question begs to be asked...if my target assembly has the >> >16F874, can I not build my own ICD? I thought someone had done this, since it >> >simply interfaces to MPLAB. >> > >> >> Dear "Hardware Engineer" [whoever the h*ck you really are], >> >> About 1 year ago exactly, there was a truly heroically-proportioned >> stampede on piclist as someone discovered how to make a "Free ICD". >> Made the stampede to napster look dull. So try checking back then >> in the piclist archives for more info. >> =============== >> >> > >> >But I have to go back...why isnt this working? I did a call to a display >> >routine in page 2, set the bits...didnt do ANY calls or goto's in the called >> >routine yet it won't work. Come on...this should be simple right? Of course >> >once I get the ICD it will be obvious no doubt. >> > >> >> The way I access higher code pages from page 0 is to set PCLATH >> bits 3 and 4 as appropriate, immediately perform a call to the page, >> once in the page execute and call code that resides "only" in that >> page, use a standard < return > when I want to go back to the original >> page, and then "immediately" set PCLATH bits 3 and 4 back to their >> original values. In short, normal bookkeeping requires that I do >> "no" manipulation of PCLATH in the called page. >> >> OTOH, for more complicated code, once in the higher page, I do >> call routines in other pages using exactly the same protocol. >> Adjust PCLATH bits in the "calling" page and then re-adjust them >> on return. I only ever use calls [no goto's] and the PCLATH bits >> are always treated in a symmetrical fashion, no matter what. >> >> I am sure this would work with goto's, but I try to stay away >> from generating spaghetti code where possible - ie, it's probably >> more difficult to keep things straight across pages when using >> goto's. >> >> - dan michaels >> www.oricomtech.com >> =================== -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body