CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

#build generates wrong address

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ian McCrum



Joined: 26 Oct 2003
Posts: 14
Location: Northern Ireland

View user's profile Send private message Visit poster's website

#build generates wrong address
PostPosted: Sat May 15, 2004 8:45 am     Reply with quote

The code below generates the machine code listed ... the #build address is 4k too low, I had expected the jump at 0xE000 to be at 0xF000.
Is there proper documentation for the #build command?

__

#include <18C801.h>
#build (RESET=0xF000)
#org 0xF020,0xF0FF default
#pragma use fast_io(A)
#pragma byte PORTA=0xF80
#pragma bit LED=PORTA.2

void main() {
do{LED=0;LED=1;}while(1);
}
__

E000 EF10 F078 00001 GOTO F020
...
F020 6AF8 00313 CLRF FF8
F022 8ED0 00314 BSF FD0.7
F024 6AEA 00315 CLRF FEA
F026 6AE9 00316 CLRF FE9
F028 0E07 00317 MOVLW 07
F02A 6EC1 00318 MOVWF FC1
0000 00319 .................... do{LED=0;LED=1;}while(1);
F02C 9480 00320 BCF F80.2
F02E 8480 00321 BSF F80.2
F030 EF16 F078 00322 GOTO F02C
F034 0003 0325 SLEEP

__

oops. just spotted the code doesn't work anyway ... I forgot the TRIS
But it is #build I am wondering about...

TIA
Ian
_________________
Ian McCrum, email address held at
www.eej.ulst.ac.uk/~ian
Ian McCrum



Joined: 26 Oct 2003
Posts: 14
Location: Northern Ireland

View user's profile Send private message Visit poster's website

#build generates wrong address
PostPosted: Sat May 15, 2004 9:00 am     Reply with quote

Just spotted that #build (RESET=0xF000)
will multiply that address by 2, it assumes the operand is a word address
I guess. Now 0xF000 * 2 is 0x1E000, a byte address

And again the #build is only holding a 64k number... <sigh>
a bug?

I am using PCH 3.120
regards
Ian
_________________
Ian McCrum, email address held at
www.eej.ulst.ac.uk/~ian
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group