Changeset 155 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/Timer.asm


Ignore:
Timestamp:
May 1, 2011, 6:44:29 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • AH=4h again uses VERIFY command (copy-pasting had changed it to WRITE).
  • Timeout should now work on all overflow situations.
  • Cleaned code a bit.
File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/Timer.asm

    r150 r155  
    66
    77;--------------------------------------------------------------------
    8 ; HTimer_InitializeTimeoutWithTicksInCX
     8; Timer_InitializeTimeoutWithTicksInCL
    99;   Parameters:
    10 ;       CX:     Timeout value in system timer ticks
     10;       CL:     Timeout value in system timer ticks
    1111;       DS:     Segment to RAMVARS
    1212;   Returns:
     
    1616;--------------------------------------------------------------------
    1717ALIGN JUMP_ALIGN
    18 HTimer_InitializeTimeoutWithTicksInCX:
    19     mov     [RAMVARS.wTimeoutCounter], cx   ; Store timeout ticks
     18Timer_InitializeTimeoutWithTicksInCL:
     19    mov     [RAMVARS.bTimeoutTicksLeft], cl     ; Ticks until timeout
    2020    call    ReadTimeFromBdaToCX
    21     add     [RAMVARS.wTimeoutCounter], cx   ; End time for timeout
     21    mov     [RAMVARS.bLastTimeoutUpdate], cl    ; Start time
    2222    ret
    2323
    2424
    2525;--------------------------------------------------------------------
    26 ; HTimer_SetCFifTimeout
     26; Timer_SetCFifTimeout
    2727;   Parameters:
    2828;       DS:     Segment to RAMVARS
     
    3434;--------------------------------------------------------------------
    3535ALIGN JUMP_ALIGN
    36 HTimer_SetCFifTimeout:
     36Timer_SetCFifTimeout:
    3737    call    ReadTimeFromBdaToCX
    38     cmp     [RAMVARS.wTimeoutCounter], cx
     38    cmp     cl, [RAMVARS.bLastTimeoutUpdate]
     39    je      SHORT .StillPollingTheSameTick
     40    mov     [RAMVARS.bLastTimeoutUpdate], cl
     41    sub     BYTE [RAMVARS.bTimeoutTicksLeft], 1 ; DEC does not update CF
     42.StillPollingTheSameTick:
    3943    ret
    4044
     
    4448; RTC resolution is 977 microsecs.
    4549;
    46 ; HTimer_DelayMicrosecondsFromAX
     50; Timer_DelayMicrosecondsFromAX
    4751;   Parameters:
    4852;       AX:     Number of microsecs to wait
     
    5256;       AX
    5357;--------------------------------------------------------------------
    54 HTimer_DelayMicrosecondsFromAX:
     58Timer_DelayMicrosecondsFromAX:
    5559%ifndef USE_AT
    5660    mov     ax, 2
     
    6973    pop     dx
    7074    mov     ax, 1                               ; Prepare to wait 1 timer tick
    71     jc      SHORT HTimer_DelayTimerTicksFromAX  ; Event Wait was unsupported or busy
     75    jc      SHORT Timer_DelayTimerTicksFromAX   ; Event Wait was unsupported or busy
    7276    ret
    7377%endif
     
    7882; will occur at 54.9 ms intervals.
    7983;
    80 ; HTimer_DelayTimerTicksFromAX
     84; Timer_DelayTimerTicksFromAX
    8185;   Parameters:
    8286;       AX:     Number of timer ticks to wait
     
    8690;       AX
    8791;--------------------------------------------------------------------
    88 HTimer_DelayTimerTicksFromAX:
     92Timer_DelayTimerTicksFromAX:
    8993    sti                             ; Make sure that interrupts are enabled
    9094    call    ReadTimeFromBdaToCX
     
    9397    call    ReadTimeFromBdaToCX
    9498    cmp     cx, ax
    95     jb      SHORT .WaitLoop         ; Loop until end time is reached
     99    jne     SHORT .WaitLoop         ; Loop until end time is reached
    96100    ret
    97101
Note: See TracChangeset for help on using the changeset viewer.