Announcement

Collapse
No announcement yet.

ASM Sample request

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ASM Sample request

    I'd like to compare to a friends Python assembler, and use PB to just run a time test...

    Basically want it in ASM however...and I don't do ASM well (Or at all for that matter)...

    Must decrement from one billion to zero and then spit out how long it took...

    I'll probably actually write the code in PB/CC vs PBDLL, don't know that it matters either way...

    A chance for a ASM programmer to see what PB is capable of, don't let me down!! LOL


    Scott


    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    A PB Asm example (don't have an asm32 compiler myself)
    Code:
    #Compile Exe
    #include "win32api.inc"
    Function PbMain () As Long
      Local lTimer As Double
      SetPriorityClass GetCurrentProcess, %HIGH_PRIORITY_CLASS  'To speed things up a bit
      lTimer = Timer
      ! mov eax, 1000000000
    deceax:
      ! dec eax
      ! jne deceax
      MsgBox "Elapsed time: " + Str$(Timer - lTimer) + " seconds"
    End Function
    ------------------
    Peter.
    mailto[email protected][email protected]</A>



    [This message has been edited by Peter Lameijn (edited September 26, 2000).]
    Regards,
    Peter

    "Simplicity is a prerequisite for reliability"

    Comment


    • #3
      I think it'll run a bit faster if you use cmp to check for zero, like:
      Code:
        ! mov eax, 1000000000
      
        deceax:           ' label - start of loop
          ! dec eax       ; decrease value
          ! cmp eax, 0    ; compare with zero
          ! jne deceax    ; if not equal to zero, jump to label

      ------------------

      Comment


      • #4
        Actually using Peter's way was 4.5 seconds to the 6.7 on the last example.

        But, point is, we're there, he was bragging 4 seconds or so, so tomorrow we will find out for sure

        I thank you very much !, who knows, maybe we'll have another PB user here soon LOL


        Scott


        ------------------
        Scott
        mailto:[email protected][email protected]</A>
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          This was interesting. I use an old Intel P120 computer here as
          Internet machine and when I did a quick test, using cmp was about
          twice as fast. Took the code over to a newer 550 MHz machine and,
          like you say, Peter's original code without cmp was a bit faster.
          Both machines with the same version of Win98.

          What's up? How is it possible to optimize code when it behaves
          differently in different machines, like this? Maybe one must
          detect what processor it has and use different approaches
          depending upon the results, to get best optimization for all
          kinds of processors?

          BTW, just tested a simple DO/LOOP variant and it was just as fast..


          ------------------

          Comment

          Working...
          X