asar icon indicating copy to clipboard operation
asar copied to clipboard

Namespaced structs' element fields are inaccessible

Open exodustx0 opened this issue 10 months ago • 0 comments

asar 1.90
arch spc700
norom

org $0000

namespace DSP
	struct V $00
		.VOLL: skip 1
		.VOLR: skip 1
		.PITCH: skip 2
		.SRCN: skip 1
		.ADSR1: skip 1
		.ADSR2: skip 1
		.GAIN: skip 1
		.ENVX: skip 1
		.OUTX: skip 1
	endstruct align $10
namespace off

db V
db V[1]
db DSP_V.VOLR
db DSP_V[3].SRCN

This produces error: (Estruct_not_found): Struct 'DSP_V' wasn't found. [db DSP_V[3].SRCN]. The first three db instructions compile; removing the fourth db causes Asar to "correctly" produce 00 10 01.

The cause is that struct field labels are saved with namespace, but struct labels are not. Since they are resolved together when accessing a struct element's field, these fields are entirely inaccessible.

exodustx0 avatar Dec 29 '24 04:12 exodustx0