I found this little bug today while working with my 18F4685, trying to use the functions in code space above 64K...and it ONLY applies to PBP 2.50A (and above I'm sure whenever it comes out) and will most likely apply to most other little routines like this running on PICs with more than 64K (i.e. 18F4685, 18F8722, and so on), like the @printstr, @copystr, whatever, whether sending to a graphic LCD, serial port, whatever.
Code:
ASM ;printstr to color LCD macro, '@ printstr x,y, "string to lcd at x,y"
printstr macro clcdx, clcdy, clcdstr
local clcdthestring, clcdoverstr
bra clcdoverstr
clcdthestring
data clcdstr,0
clcdoverstr
MOVE?CB clcdx, _clcdpx
MOVE?CB clcdy, _clcdpy
MOVE?CW clcdthestring, _clcdaddr
L?CALL _clcdstringout
endm
ENDASM
The 3rd line from the end: MOVE?CW clcdthestring, _clcdaddr won't grab the upper bit of the PC and ends up reading the codespace at the lower 64K block instead of the upper 64K block.
The fix is simple enough.
Declare clcdaddr as LONG rather than WORD, and change MOVE?CW to MOVE?CN. All it does it changes moving a WORD to moving a LONG.
All better...
Bookmarks