Shop OBEX P1 Docs P2 Docs Learn Events
Demo: Access the Propeller ROM — Parallax Forums

Demo: Access the Propeller ROM

ReinhardReinhard Posts: 489
edited 2011-11-09 12:27 in Propeller 1
Hi, a small demo
what can I do, to set the code in a window with scrollbars, like other snippets here in the forum ?
// propeller-elf-gcc   -mlmm -o readLogTable.elf  -Wall readLogTable.c 

#include <stdio.h>
#include <stdarg.h>
#include <math.h>
/* commented because does not fit in lmm
float FractionalToFloat (unsigned short aNumber)
{
     int x;
     float eps = 0.5f;
     float sum = 0.0f;
     for ( x = 0; x < 16; x++)
     {
         if ( (0x8000 >> x)  & aNumber )
         {
            sum = sum + eps;
         }
         eps = eps / 2.0f ;
     }
     return sum;
}
*/
int main()
{
    unsigned short * ptr;
    // ------ any info about the compiler -----------
     printf("sizeof(char)   %d\n",sizeof(char));
    printf("sizeof(short)  %d\n",sizeof(short));
    printf("sizeof(int)    %d\n",sizeof(int));
    printf("sizeof(long)   %d\n",sizeof(long));
    printf("sizeof(float)  %d\n",sizeof(float));
    printf("sizeof(double) %d\n",sizeof(double));
    printf("sizeof(int *) %d\n",sizeof(int *));
    printf("sizeof(long *) %d\n",sizeof(long *));
    puts("hit return . . .");
    getchar();
       // ------ read the log table 0xC000 .. 0xCFFF -------
     ptr = ( unsigned short *)(0xc000);
     while (ptr <= (unsigned short *)0xCFFF)
     {
             //printf( "0x%X: 0x%X -> %f\n",ptr,*ptr,FractionalToFloat(*ptr) );
           printf( "0x%X: 0x%X \n",ptr,*ptr);
           ptr ++;
     }

     
    while (1)
        putchar(getchar());
    return 0;
    }

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2011-11-09 11:52
    Enclose the code between
    and
    
    tags.
  • RonPRonP Posts: 384
    edited 2011-11-09 12:08
    attachment.php?attachmentid=78421&d=1297987572
  • ReinhardReinhard Posts: 489
    edited 2011-11-09 12:18
    Thank you, RonP

    some issues are to complicated for me :nerd:
  • David BetzDavid Betz Posts: 14,516
    edited 2011-11-09 12:20
    Oops, sorry. I guess I didn't think this through. Put your code between [ CODE] and [ /CODE] tags with the space after the first square bracket left out.
  • ReinhardReinhard Posts: 489
    edited 2011-11-09 12:27
    David Betz wrote: »
    Oops, sorry. I guess I didn't think this through. Put your code between [ CODE] and [ /CODE] tags with the space after the first square bracket left out.

    Thank you, David.
    I see.
    I am new here in the forum and a must say all users are very friendly and polite.
    That is not the rule in other forums.

    best regards,
    Reinhard
Sign In or Register to comment.