a simple boxe timer (code included)


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Great,... Yes.

    IF AND THEN --- compile to 159 words.
    Select case --- compile to 58 words.

    I will have to compere all statements. eg. FOR/NEXT loops. while/Wend, GOTO, GOSUB/RETURN, HI/LOW, TOGGLE.
    For time of Execution speed and code space.


    .

  2. #2
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by precision View Post
    I will have to compere all statements. eg. FOR/NEXT loops. while/Wend, GOTO, GOSUB/RETURN, HI/LOW, TOGGLE.
    For time of Execution speed and code space.
    while / wend (same as "do / loop" but without a condition) -- will always be faster than "for next loops" Main reason is because there is no counter, there's no constantly incrementing or decrementing after each iteration.

    But I encourage you to conduct your tests and post the results here.

    Trent Jackson

  3. #3
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Another thing also, the "AND" operator -- try to avoid it at all costs.

    Code:
    if b1 = 100 then
       if b2 = 200 then
          Thank Mr Jackson for these invaluable tips
       end if
    end if
    is much better than ...

    Code:
    if b1 = 100 and b2 = 200 then
      do something ...
    end if
    You might save a few bytes of code space, it'll run faster too.

    Can anyone tell me why?

    Trent Jackson

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    IF you're actually asking a question vs. just talking out your.............................
    then...
    Code:
    if b1 = 100 then
       if b2 = 200 then
          Thank Mr Jackson for these invaluable tips
       end if
    end if
    2 comparisons, 3 jumps

    Code:
    if b1 = 100 and b2 = 200 then
      do something ...
    end if
    3 'nested' comparisons (2 + 1), couple of extra 'state' bits to save in the middle of it all, plus 4 jumps

    IF you're posing a question for the class from the podium, then nevermind...

  5. #5
    Join Date
    Jun 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    here the 0.3 version.

    contains some bug fixes, the most important:
    in 0.2 timer values are contained in BYTE VAR, big values could not be showed (in 0.3 WORD type is used).

    regards,
    hOZONE
    Attached Files Attached Files

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. Replies: 5
    Last Post: - 24th February 2009, 18:55
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 22:05
  5. Timer Accuracy
    By GEEZER in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 31st March 2005, 05:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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