Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: floating point on nds...

  1. #1

    floating point on nds...

    hi again :D

    i wanted to display a sinewave on screen but ran into several
    problems, which made me do a simple floatingpoint-testprogram:

    Code:
    Program blah;
    {$APPTYPE ARM9}
    {$DEFINE ARM9}
    {$MODE OBJFPC}
    
    uses
      cTypes;
    
    {$INCLUDE NDS.INC}
    
    Var
      NewX,NewY : Integer;
      a,s,d : integer;
      i : real;
    
      Dummy : String;
    
    Begin
      consoleDemoInit();
      videoSetMode(MODE_FB0);
      vramSetBankA(VRAM_A_LCD);
    
      lcdSwap;
    
      i := 0;
      newy := 0;
    
      for a := 0 to 255 do
      Begin
        newy := trunc(i);
        i:=i+1;
    
        vram_A[(95 + NewY) * 256 + a] := rgb15(31,31,31);
    
        Str(i,Dummy);
        Dummy := Dummy + ' ';
    
        printf(@Dummy+1);
      End;
    
      While True do;
    end.
    This produces:



    ... but when i replace "real" with "integer" it works normally, shown here:




    shouldn't both ways produce the same result, as i only increment
    a variable by 1?

    oh and: is there any other way simple way to output a non-PChar? :D

  2. #2

    floating point on nds...

    This indeed smells like a bug. Francesco, does NDS use fpu opcodes or
    softfpu calls?

    Despite the bug, the Nintendo devices are probably a bit too slow for
    floating point calculations; use an old fashioned sine table.

  3. #3

    floating point on nds...

    Weren't there a fixedpoint unit posted here a while ago?
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  4. #4

    floating point on nds...

    i wanted to create a sinetable, but that gave me odd results ... so i made
    this testprogram.

    err... i guess i found the problem. as far as i understand, the nds does not
    support floating point ... it uses fixed point arithmetics.
    see: http://dev-scene.com/NDS/Tutorials_Day_2

    shame on me for not informing myself enough about the hardware.

    thanks anyway :D

  5. #5

    floating point on nds...

    As far as I remember, Florian activated softfpu on arm compiler some months ago.
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  6. #6

    floating point on nds...

    but... it SHOULD work with i:=i+1, shouldn't it??

    i'm confused.

  7. #7

    floating point on nds...

    I have tested your code and it works as expected here (on no$gba and ideas emulator) with fpc trunk 2.3. Maybe it is a bug related to 2.1.4... :think:
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  8. #8

    floating point on nds...

    i guess you've used arm-linux, right?

    actually, i think i misunderstand something.

    as far as i can see, there is no need to install fpc, as long as ppcarmnds (=fpc4nds),
    devkitpro and libnds are installed...

    how i know? i have downloaded 213 for i386 (which of course, like 214) does
    not natively support ARM (at least i can't select a target for it) ...
    but i thought "ok, just do it" and copied libnds and fpc4nds into the
    directory... and as expected: no change at all.

    what am i doing wrong? i mean, why should i bother installing fpc if it's not
    needed at all?? i can't see where ppcarmnds connects to fpc...

  9. #9

    floating point on nds...

    i wanted to tell you that i've rebuild fpc4nds from ground up and
    that there are no more errors with the code i've posted :D

  10. #10

    floating point on nds...

    Quote Originally Posted by 21o6
    i wanted to tell you that i've rebuild fpc4nds from ground up and
    that there are no more errors with the code i've posted
    Cool
    However, fpc4nds 2.1.4 worked fine too, so I really don't know what appened :?
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •