Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!nntp-server.caltech.edu!toddpw From: toddpw@nntp-server.caltech.edu (Todd P. Whitesel) Newsgroups: comp.sys.apple2 Subject: Re: relocatable code Message-ID: <1990Dec21.015040.18202@nntp-server.caltech.edu> Date: 21 Dec 90 01:50:40 GMT References: <282@generic.UUCP> Organization: California Institute of Technology, Pasadena Lines: 33 ericmcg@pnet91.cts.com (Eric Mcgillicuddy) writes: >using ABS,X would be fine for data, but what about code? ABS,X works for both data and code. I wrote an init that fixes ZipGS Appletalk problems and it's position independent. It patches out a few vectors and uses ABS,X to self-modify a pair of JMP long instructions so it can call the original contents of the vectors. A lot of assembly programmers do a PHK/PLB when they set up and use short addressing modes to get at code and direct page or long to get at data. My point was that you can very easily use X or Y to point at a 64K block that absolute addressing gives you immediate access to -- without a lot of LDY's. >I suggest that bank aligning code segments and only using short (6502) >addressing modes would be a valid solution. Sure it would work, but it defeats the purpose. The goal was position independent code that didn't need relocation or bank-alignment. Using absolute code segments IS a valid solution if you aren't worried about the effects on memory of all those bank aligned blocks. If you are writing a big program and intentionally write it so that it sits comfortably in a few bank aligned spaces then that's great -- but I prefer solutions that are still environment friendly for both small and large projects. >BTW, thanks Todd for spelling 'voila' correctly. 'Wahla' could easily result >in the separation of Quebec at this slight of the French language. :) Actually, my first attempt at spelling that was 'Wallah' in the 2nd grade -- in a collage/report no less -- I was corrected immediately and haven't messed it up since. (That's the truth folks) Todd Whitesel toddpw @ tybalt.caltech.edu