gnupic: Possible gpasm or gplink bug?
Subject:
Possible gpasm or gplink bug?
From:
Julian Green ####@####.####
Date:
12 Nov 2005 13:24:11 +0000
Message-Id: <20051112131105.L38958-100000@pschulz.london.corp.yahoo.com>
I am working on a project for the 16f871 and have run into an issue
involving setting up a value for the FSR register.
The code Im doing is fairly simple:
movlw msg_to
addwf RxState, w
movwf FSR
msg_to - is defined as:
serial_u udata_shr
msg_to res 1
In the map file msg_to is given the address 0xa0 which is strange since
this is outside RAM space.
msg_to 0x0000a0 data extern serial_fbw.asm
and the code that gets generated is loading the FSR with value 0xa0, To
fix the problem I can add some runtime code to mask the value to be within
RAM range:
000028 30a0 movlw 0xa0 movlw msg_buff
000029 397f andlw 0x7f andlw 0x7f
00002a 0728 addwf 0x28, w addwf RxState, w
00002b 0084 movwf 0x4 movwf FSR
However when the msg_to register is addressed in a more conventional way
the address is 0x20...
000033 00a0 movwf 0x20 movwf msg_to
... so is the assembler or linker using the top bit of the address for
something and not masking off when used in a literal context?
Julian