Hi Fernando,

On Thu, 2013-11-28 at 02:27 +0000, fernando rafael filipuzzi wrote:
> hello,
> 
> I need to view completed assembly code generated by sdcc.

Did you have a look at the .lst file ?
I included the last part of it below :

000000                        363 _main:
                     000007   364   ar7 = 0x07
                     000006   365   ar6 = 0x06
                     000005   366   ar5 = 0x05
                     000004   367   ar4 = 0x04
                     000003   368   ar3 = 0x03
                     000002   369   ar2 = 0x02
                     000001   370   ar1 = 0x01
                     000000   371   ar0 = 0x00
                              372 ; main.c:7: char *c = (char
*)malloc(20 * sizeof(char));
000000 90 00 14         [24]  373   mov dptr,#0x0014
000003 12r00r00         [24]  374   lcall _malloc
000006 AE 82            [24]  375   mov r6,dpl
000008 AF 83            [24]  376   mov r7,dph
00000A 7D 00            [12]  377   mov r5,#0x00
                              378 ; main.c:10: strncpy(c,
"inicializando", 6);
00000C 75*00r00         [24]  379   mov _strncpy_PARM_2,#__str_0
00000F 75*01s00         [24]  380   mov (_strncpy_PARM_2 + 1),#(__str_0
>> 8)
000012 75*02 80         [24]  381   mov (_strncpy_PARM_2 + 2),#0x80
000015 75*00 06         [24]  382   mov _strncpy_PARM_3,#0x06
000018 75*01 00         [24]  383   mov (_strncpy_PARM_3 + 1),#0x00
00001B 8E 82            [24]  384   mov dpl,r6
00001D 8F 83            [24]  385   mov dph,r7
00001F 8D F0            [24]  386   mov b,r5
000021 12r00r00         [24]  387   lcall _strncpy
                              388 ; main.c:11: while(1)
000024                        389 00102$:
000024 80 FE            [24]  390   sjmp 00102$
                              391   .area CSEG    (CODE)
                              392   .area CONST   (CODE)
000000                        393 __str_0:
000000 69 6E 69 63 69 61 6C   394   .ascii "inicializando"
       69 7A 61 6E 64 6F
00000D 00                     395   .db 0x00



I have sdcc setup for 8051/8052 code generation only :

#include <8052.h>
#include <stdlib.h>
#include <string.h>

void main(void)
{
        char *c = (char *)malloc(20 * sizeof(char));
//      char c[20];

        strncpy(c, "inicializando", 6);
        while(1)
        {
        }
}


sdcc main.c

SDCC : mcs51 3.3.1 #8894 (17 Oct 2013) (Linux)

I also tried without the malloc function, the resulting hex file
is shorter.

Roelof



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to