No, this isn't a preprocessor issue. The preprocessor doesn't 'know' the address of anything. It just manipulates text. -- Bob Ammerman RAm Systems -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Ruben J=F6nsson Sent: Thursday, October 03, 2013 7:14 AM To: Microcontroller discussion list - Public. Subject: Re: [PIC] Load the address of a variable as 2's complement? > Hello, >=20 > Some time ago I wrote an Insertion sort algorithm for Mid-range PICs=20 > and today decided to optimize it as much as possible. For this I need=20 > to load the negative value of an address of a variable. Using 'movlw =20 > 0 - var' or 'addlw 0 - var', where var is a file register is not=20 > accepted by MPASM, and 'Error[151] : Operand contains unresolvable=20 > labels or is too complex' is issued. >=20 > Currently I found 2 workarounds - one needs an extra instruction to=20 > convert the loaded address to a negative number, and the other defines=20 > an absolute address of 'var' in RAM and then a precalculated negative=20 > value of that address is used in the code. >=20 > Both of these do not seem right, so I'm searching for a trick to=20 > negate the address of 'var' in the preprocessor, without triggering an error. >=20 The preprocessor doesn't know the address of var. /Ruben =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Ruben J=F6nsson AB Liros Electronic Box 9124 200 39 Malm=F6 Sweden www.liros.se Tel +46 40142078 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/chang= e your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .