[Coco] Direct page register question

Ciaran Anscomb cocomalt at 6809.org.uk
Wed Oct 31 02:50:18 EDT 2018


Mark McDougall wrote:
> On 31/10/2018 7:25 AM, Zippster wrote:
> 
> > I prefer to just use the ‘<‘. It doesn’t hurt to be explicit
> > after all here. Also if you’re using a label, it makes it more
> > obvious (to me at least) that direct addressing is being used.
> 
> I'm in Zippster's court. SETDP is fraught with danger.

I've definitely had tricky bugs that turned out to be a call from a
routine with a different DP because I didn't include it within the pair
of SETDPs.

I still like using it though: I've written things where the amount of
data exceeded DP and I just wanted the assembler to speed up as much of
it as it could.  Especially in self-modifying code where *most* of it
sits within one page (sorry to those will allergies that just came out
in hives at the mention of self modifying code.  Oops, did it again).

Also nice if you revisit some routine that, say, does a lot of IO (so
you want to temporarily set DP=$FF).  You can just put SETDPs around
it, add DP manipulation to the code itself, but not have to faff about
modifying every reference to an IO address.

So: fine if you know what you're doing!  But sticking to explicit forcing
of DP addressing is also fine - do what thou wilt shall be the whole of
the law - though be aware that most assemblers will still assume that
it's zero without any SETDP, so there's still a (less common) case where
they'll do something automagically and trip you up.

..ciaran


More information about the Coco mailing list