Image Map Image Map
Page 5 of 5 FirstFirst 12345
Results 41 to 42 of 42

Thread: Floating point info code for 8088 wanted

  1. #41
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    33,358
    Blog Entries
    18

    Default

    You can easily solve this problem two ways. The first is to initialize the timer to 0 before you start your loop. That way, you know what the initial value is and you need only check the current value of the timer. No wrap-around issues.

    The other way is to correct the count before comparing. Suppose BX has the initial count and AX has the count just read:

    Code:
        sub     ax,bx         ; current-initial
        jnc      lab1         ; if current > initial
        add     ax,terminal   ; terminal count of the timer;  could be ffffh
    lab1:
         cmp     ax,desired   ; check the now-corrected difference
         ...

  2. #42

    Default

    Quote Originally Posted by Chuck(G) View Post
    The first is to initialize the timer to 0 before you start your loop.
    It seems that I did not mention that I would be using timer 0. IMHO I cannot use the other timers because another program or even a part of the actual program may need them. So that only leaves me to use timer 0. And it is obviously that I cannot set it to zero because that would mess up the timing.

    The other way is to correct the count before comparing.
    The way you do it makes me think why I hadn't think of such a simple and elegant solution?
    Many thanks!
    With kind regards / met vriendelijke groet, Ruud Baltissen

    www.baltissen.org

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
  •