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

Surprizing PCD V4.091 assembly code

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



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

Surprizing PCD V4.091 assembly code
PostPosted: Fri Apr 24, 2009 12:03 am     Reply with quote

Thanks to krogers for supplying the source. You may want to repeat with buffer [4096] !
Code:
....................    char buffer[64] = {0}; 
*
003AA:  CLR     808
003AC:  CLR     80A
003AE:  CLR     80C
003B0:  CLR     80E
003B2:  CLR     810
003B4:  CLR     812
003B6:  CLR     814
003B8:  CLR     816
003BA:  CLR     818
003BC:  CLR     81A
003BE:  CLR     81C
003C0:  CLR     81E
003C2:  CLR     820
003C4:  CLR     822
003C6:  CLR     824
003C8:  CLR     826
003CA:  CLR     828
003CC:  CLR     82A
003CE:  CLR     82C
003D0:  CLR     82E
003D2:  CLR     830
003D4:  CLR     832
003D6:  CLR     834
003D8:  CLR     836
003DA:  CLR     838
003DC:  CLR     83A
003DE:  CLR     83C
003E0:  CLR     83E
003E2:  CLR     840
003E4:  CLR     842
003E6:  CLR     844
003E8:  CLR     846
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Apr 24, 2009 7:03 am     Reply with quote

The code is inefficient, but is according to the ANSI C89 and ISO C99 standards as far as I can see.

Here a quote from the ISO/IEC 9899 chapter 6.7.8
Quote:
27 EXAMPLE 4 The declaration
int z[4][3] = {
{1},{2},{3},{4}
};
initializes the first column of z as specified and initializes the rest with zeros.
This same example is in ANSI C89, chapter 3.5.7

It wouldn't hurt though to ask CCS for implementing a more efficient implementation...
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Apr 24, 2009 9:19 am     Reply with quote

Quote:
The code is inefficient, but is according to the ANSI C89 and ISO C99 standards
Yes, no doubt about it.

Also considering the buffer[4096] case, you may want to call it ridiculous. I would actually expect a code similar to memset(), except for the superfluous MOV #0,W2.
Code:
04C30:  MOV     #1816,W1
04C32:  MOV     #0,W2
04C34:  REPEAT  #7
04C36:  CLR.B   [W1++]
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