tebe6502/Mad-Assembler

Getting length of struct throwing errors, but LST seems to show correct output

Closed this issue · 1 comments

I'm trying to get the length of a struct, according to the docs, it's just lda #structName, but I can't get that to work.

Simplified case:

foo .struct
  x .word
  .ends

  org $1000
start
  lda #foo
  sta $80
  rts

  run start

When I compile, I get the error:

$ mads -o:foo.xex -l -t foo.asm
  lda #foo
foo.asm (7) ERROR: Could not use FOO in this context
Writing listing file...

The LST file seems to be correct though:

mads 2.1.7
Source: foo.asm
     1                          foo .struct
     2 = 0000                     x .word
     3                            .ends
     4
     5                            org $1000
     6                          start
     7 FFFF> 1000-1004> A9 02     lda #foo
     8 1002 85 80                 sta $80
     9 1004 60                    rts
    10
    11 02E0-02E1> 00 10           run start

If I add more fields to the struct, the value is updating correctly in the lst file.

As per conversation here: https://forums.atariage.com/topic/352982-mads-struct-size-use-len-or-sizeof/

I can fix this with using .len or .sizeof