Setting system time?

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2009
Posts: 27
Reputation: Goalatio is an unknown quantity at this point 
Solved Threads: 0
Goalatio Goalatio is offline Offline
Light Poster

Setting system time?

 
0
  #1
26 Days Ago
Hey guys, I am on the Windows OS using NASM16, and I'd like to know how to set the system time..

Code so far:

  1. [org 0100h] ;COM format
  2. %include "Lib_1\Lib1.asm"
  3.  
  4. ;settime Hour minute second date month year
  5. ;settime "6" "35" "00" "06" "01" "09"
  6.  
  7. ;--------------------
  8. ;Lib1.asm
  9. ;string - Displays a string
  10. ;arg - pull arguments off the stack
  11. ;exit - exits with set ERRORLEVEL code
  12. ;--------------------
  13.  
  14. [section .text]
  15.  
  16. mov byte [bx], '0' ;Use BX as our byte counter
  17.  
  18. ;-----------------------------
  19. ;Add string terminators to buffers
  20. ;-----------------------------
  21. mov byte [hourbuffer + 2], '$'
  22. ;-----------------------------
  23.  
  24.  
  25. ;-----------------------------
  26. START:
  27. push bx ;Save the BYTE counter
  28. arg ;Pull all the arguments off the stack
  29. mov si,bx ;Put the arguments into SI
  30. lodsb ;Advance one character in SI
  31. pop bx ;Restore the BYTE counter
  32. cmp al,'"' ;Check if the first character is a "
  33. je near GETHOUR ;If it was a " (quote), branch and get the hour
  34.  
  35. jmp near ERROR ;If it was not a quote, flag an error
  36. ;-----------------------------
  37.  
  38.  
  39. ;-----------------------------
  40. ;GETHOUR - gets the passed hour argument
  41. ;-----------------------------
  42. GETHOUR:
  43. cmp bx,3 ;Check if the hour buffer is full
  44. je ERROR ;Flag an error
  45.  
  46. push bx ;Save the BYTE counter
  47. lodsb ;Advance once more in SI
  48. pop bx ;Restore the BYTE counter
  49. cmp al, '"' ;Check for a " (quote)
  50. je GETHOUR2 ;Branch to last part of this command if true
  51. mov byte [hourbuffer + bx],al ;Move the value in AL into the buffer
  52. inc bx ;Increase the BYTE counter once
  53. jmp near GETHOUR
  54.  
  55. ;----
  56. GETHOUR2:
  57. string hours ;Display "Hours:"
  58. string hourbuffer ;Display the hour buffer
  59. exit 0
  60.  
  61. ;-----------------------------
  62.  
  63.  
  64.  
  65. ;-----------------------------
  66. ;ERROR - Error catcher
  67. ;-----------------------------
  68. ERROR:
  69. string syntaxerror ;Display correct command syntax
  70. exit 1 ;Exit with ERRORLEVEL of 1
  71. ;-----------------------------
  72.  
  73. [section .data]
  74. ;-----------------------------
  75. ;hourbuffer - holds the HOUR value
  76. ;-----------------------------
  77. hourbuffer times 3 db 0
  78. ;-----------------------------
  79.  
  80. hours db "Hours:", "$"
  81.  
  82. ;-----------------------------
  83. ;syntaxerror - displays correct command syntax
  84. ;-----------------------------
  85. syntaxerror db 13, 10, "Invalid syntax, use: ", '[settime "Hour minute second date month year"]', 13, 10, "$"
  86. ;-----------------------------
It's passion that drives me.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC