>________________________________ > De: Jan-Erik Soderholm >Para: Microcontroller discussion list - Public. =20 >Enviado: martes, 7 de agosto de 2012 17:50 >Asunto: Re: [PIC] GPasm question (probably gplink) >=20 > > >John Coppens wrote 2012-08-07 22:20: >> Hi all. >> >> I'm in the midst of a hobby project, which grew larger than expected >> (don't they always). >> >> My project has several relocatable modules, and I noticed some strange >> things. Say main.asm and moda.asm both have a section 'udata' and both >> define several registers. >> >> Now, if I declare something like this in mod_a.asm: >> >> gpr0=A0=A0=A0 udata >> reg1=A0=A0=A0 res=A0=A0=A0 5 >> reg2=A0=A0=A0 res=A0=A0=A0 1 >> >> and then >> >> hdr=A0=A0=A0 equ=A0=A0=A0 reg1+0 >> len=A0=A0=A0 equ=A0=A0=A0 reg1+1 >> ... >> > >I do not think you can mix RES symbols with EQU symbols that way. >They are not of the same "type" so to speak. > >MPASM will give an error on this (even without "+0/1") : > >"Operand contains unresolvable labels or is too complex" > >Note that MPASM expects to know the value of the EQU (and SET) >symbols during assembly-time, the RES symbols are not known >until link-time (MPLINK or other linker). The value of reg1 >is not important for MPASM (and probably GPASM). It's just >a name it passes over to MPLINK (or GPLINK). > >But, a single UDATA section is always continus, so you can do: > >myvars=A0 =A0=A0=A0udata >reg1_hdr=A0=A0=A0res=A0 =A0 1 >reg1_len=A0=A0=A0res=A0 =A0 1 >reg1_rest=A0 res=A0 =A0 3 >reg2=A0 =A0 =A0=A0=A0res=A0 =A0 1 > My 2 cents here.=A0 It has been a while since I don't code fluently in asse= mbly but If I remember correctly I think he could also use overlay data, so= he can place reg1_hdr, reg1_len and reg1_rest starting at the same locatio= n as reg1=20 There were some things to do with the linker like declaring a section and t= hen declaring both vars in the same section or something like that.=A0 As I= said its been a while and I forgot the details.=A0 I could dig more deeply= in my older source codes if needed. Mauricio --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .