t-edson/P65Pas

Generating wrong code 2 - absolute variables

Opened this issue · 0 comments

The snipet is this:

var
  r0:  word absolute $02;
  r1:  word absolute $04;
  r2:  word absolute $06;
...
procedure Copy;
  var Src: word absolute $02;  // this declarations are only for convenience
      Dst: word absolute r1;
begin
    asm 
          LDA (Src), Y
          STA (Dst), Y

It generates the following code:

      $082B B1 02    LDA ($02),Y 
      $082D 91 00    STA ($00),Y   ; this is wrong should be STA ($04), Y

so when constant is used - it works fine, but if a declaration is used, it always generate $00