Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;*****************************Tick
  2. ;C declaration: void Tick(int miniTicks);
  3. ;Output: null.
  4. ;Input:
  5. ;   miniTicks: The amount of mini ticks (0.055 seconds) to delay.
  6. ;Explanation: Delays the program for (miniTicks*0.055) seconds.
  7. proc Tick
  8. Clock equ es:6Ch
  9. ;Create a new stack frame.
  10. push bp
  11. mov bp, sp
  12. ;Save the state of the registers.
  13. push ax
  14. push cx
  15. push es
  16. ;Wait for first change in timer
  17. mov ax, 40h
  18. mov es, ax
  19. mov ax, [Clock]
  20. Utility_Tick_FirstTick:
  21.     cmp ax, [Clock]
  22. je Utility_Tick_FirstTick
  23. ;Wait for (miniTicks) changes in the clock.
  24. mov cx, [bp+4]
  25. Utility_Tick_DelayLoop:
  26.     mov ax, [Clock]
  27.     Utility_Tick_clock_tick:
  28.     cmp ax, [Clock]
  29.     je Utility_Tick_clock_tick
  30. loop Utility_Tick_DelayLoop
  31. ;Retrieve the old state of the registers.
  32. pop es
  33. pop cx
  34. pop ax
  35. ;Delete the new stack frame.
  36. pop bp
  37. ;Return to the calling part of the program and 'delete' the parameters.
  38. retn 2
  39. endp Tick
  40. ;*****************************Tick^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement