Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;*****************************Tick
- ;C declaration: void Tick(int miniTicks);
- ;Output: null.
- ;Input:
- ; miniTicks: The amount of mini ticks (0.055 seconds) to delay.
- ;Explanation: Delays the program for (miniTicks*0.055) seconds.
- proc Tick
- Clock equ es:6Ch
- ;Create a new stack frame.
- push bp
- mov bp, sp
- ;Save the state of the registers.
- push ax
- push cx
- push es
- ;Wait for first change in timer
- mov ax, 40h
- mov es, ax
- mov ax, [Clock]
- Utility_Tick_FirstTick:
- cmp ax, [Clock]
- je Utility_Tick_FirstTick
- ;Wait for (miniTicks) changes in the clock.
- mov cx, [bp+4]
- Utility_Tick_DelayLoop:
- mov ax, [Clock]
- Utility_Tick_clock_tick:
- cmp ax, [Clock]
- je Utility_Tick_clock_tick
- loop Utility_Tick_DelayLoop
- ;Retrieve the old state of the registers.
- pop es
- pop cx
- pop ax
- ;Delete the new stack frame.
- pop bp
- ;Return to the calling part of the program and 'delete' the parameters.
- retn 2
- endp Tick
- ;*****************************Tick^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement