neilsf / xc-basic3

A BASIC cross compiler for MOS 6502-based machines
MIT License
44 stars 5 forks source link

ASM blocks cannot access type data #184

Closed Jest0r closed 2 years ago

Jest0r commented 2 years ago

When using ASM blocks, type variables cannot be accessed.

Simple type example:

type pixel
  x as byte
  y as byte
end type

dim p as pixel 
dim a as byte
dim b as byte

a = 3
b = 4

ASM
  lda {a}
  sta {p.x}
  lda {b}
  sta {p.y}
END ASM

Same for type methods:

type pixel
  x as byte
  y as byte
  sub setcoords(a as byte, b as byte) static
    ASM
      lda {a}
      sta {THIS.x}
      lda {b}
      sta {THIS.y}
    END ASM
  end sub
end type

Both of these examples will give a "Not enough args passed to Macro." Error

neilsf commented 2 years ago

No, this is not implemented and it isn't planned at all. It's too complicated and sometimes can't even be done in compile-time (e. g THIS is an address that changes in runtime). Sorry.

Jest0r commented 2 years ago

No prob. A different error message or a mention in the doc would be great, though.