[Coco] Direct page register question

Dave Philipsen dave at davebiz.com
Tue Oct 30 16:14:56 EDT 2018


> On Oct 30, 2018, at 2:50 PM, William Astle <lost at l-w.ca> wrote:
> 
>> On 2018-10-30 1:32 p.m., Dave Philipsen wrote:
>> For most assemblers, yes, that will be interpreted as direct addressing since you did not use a 16-bit address.  In fact, most assemblers would also interpret LDA   $0085 as direct addressing too since it is assumed that DP is set to $00.
>> With a good assembler you will almost never need to force direct addressing as the assembler will figure it out and do it for you.  If you decide to use a direct page different than $00 then most assemblers will allow a SETDP directive that will tell the assembler what the new direct page is.  This is only a directive for the assembler.  It does not actually set the DP register so it should be accompanied with the proper LDA #$xx / TFR   A,DP instructions.
> 
> Since Dave didn't mention it explicitly and it might surprise some people, I should mention here that if you do use SETDP to something other than 0, then "LDA $85" will assemble as extended addressing.
> 
> So if you do "SETDP $40", then "LDA $4085" would assemble as direct addressing but "LDA $85" would assemble as extended.
> 
> 
Yeah, I should have been more clear about that.  The LDA  $85 would always be interpreted as a full 16-bit address ($0085)  even though you only specified 8 bits. You can’t do a LDA  $85 and assume that the assembler would expand it to LDA   $xx85 where xx=the DP register.


More information about the Coco mailing list