[Coco] Direct page register question

Dave Philipsen dave at davebiz.com
Tue Oct 30 15:32:21 EDT 2018



> On Oct 30, 2018, at 1:45 PM, Salvador Garcia via Coco <coco at maltedmedia.com> wrote:
> 
> My quest to learn 6809asm continues and now I am looking at the DP register.
> 
> For example, if I am loading the A register like the following:
> 
> LDA $85
> 
> Will this automatically use the DP register?

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.

Dave

> 
> If I have modified the DP register before the above line and forget to reset it, and I want the byte at address $0085 will the above line fail if the DP is anything but zero?
> 
> Thanks always! Salvador
> 
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco



More information about the Coco mailing list