Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/30/04 10:10
Read: times


 
#84095 - C Code t o Assembly
Responding to: ???'s previous message
Hi Shahzad,

The tool to convert C to assembler is your compiler, that's what the compiler does. Writing the code in assembler in the first place can be a little more efficient.

Are you sure that its code memory you are running out of? What imediatley stikes me about your code is that you are using a lot of unsigned long variables (4 bytes each) which will take up a lot of data space. See if some of those variables could be unsigned short (2 bytes each) or even single character variables.

A good place to start would be the DaysInPriorMonths variable. Since the maximum value of any element is 31 you could use unsigned chars. Since only February changes I would place two constant tables in the code memory rather than building the table each time the code is run.
e.g.
unsigned char code DaysInLeapYear[] = { 31, 29, 31, 30 ... etc.
unsigned char code DaysInNonLeapYear[] = { 31, 28, 31, 30 ... etc.
You may find this is more efficient in both code and data memory than building the table each time through.

Hope this helps

Paul

List of 22 messages in thread
TopicAuthorDate
C Code t o Assembly            01/01/70 00:00      
   C to Asm            01/01/70 00:00      
   C Code t o Assembly            01/01/70 00:00      
      only one table            01/01/70 00:00      
   Need some more details            01/01/70 00:00      
      Not even true !            01/01/70 00:00      
      Answer is Wrong!!            01/01/70 00:00      
   Re : previous 3 replies and Paul            01/01/70 00:00      
      Previously on 8052.com            01/01/70 00:00      
      Overflow            01/01/70 00:00      
      just one array            01/01/70 00:00      
         too limited, Paul            01/01/70 00:00      
         Nothing to do with scope            01/01/70 00:00      
            Agreed            01/01/70 00:00      
   No success !            01/01/70 00:00      
   Re: Peter            01/01/70 00:00      
   to assembly            01/01/70 00:00      
   Example code            01/01/70 00:00      
   Any unused functions in your program?            01/01/70 00:00      
   query            01/01/70 00:00      
      Off-Topic - start a new thread            01/01/70 00:00      
         ... and use a _descriptive_ subject!            01/01/70 00:00      

Back to Subject List