| | |
Setting system time?
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2009
Posts: 27
Reputation:
Solved Threads: 0
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:
Code so far:
Assembly Syntax (Toggle Plain Text)
[org 0100h] ;COM format %include "Lib_1\Lib1.asm" ;settime Hour minute second date month year ;settime "6" "35" "00" "06" "01" "09" ;-------------------- ;Lib1.asm ;string - Displays a string ;arg - pull arguments off the stack ;exit - exits with set ERRORLEVEL code ;-------------------- [section .text] mov byte [bx], '0' ;Use BX as our byte counter ;----------------------------- ;Add string terminators to buffers ;----------------------------- mov byte [hourbuffer + 2], '$' ;----------------------------- ;----------------------------- START: push bx ;Save the BYTE counter arg ;Pull all the arguments off the stack mov si,bx ;Put the arguments into SI lodsb ;Advance one character in SI pop bx ;Restore the BYTE counter cmp al,'"' ;Check if the first character is a " je near GETHOUR ;If it was a " (quote), branch and get the hour jmp near ERROR ;If it was not a quote, flag an error ;----------------------------- ;----------------------------- ;GETHOUR - gets the passed hour argument ;----------------------------- GETHOUR: cmp bx,3 ;Check if the hour buffer is full je ERROR ;Flag an error push bx ;Save the BYTE counter lodsb ;Advance once more in SI pop bx ;Restore the BYTE counter cmp al, '"' ;Check for a " (quote) je GETHOUR2 ;Branch to last part of this command if true mov byte [hourbuffer + bx],al ;Move the value in AL into the buffer inc bx ;Increase the BYTE counter once jmp near GETHOUR ;---- GETHOUR2: string hours ;Display "Hours:" string hourbuffer ;Display the hour buffer exit 0 ;----------------------------- ;----------------------------- ;ERROR - Error catcher ;----------------------------- ERROR: string syntaxerror ;Display correct command syntax exit 1 ;Exit with ERRORLEVEL of 1 ;----------------------------- [section .data] ;----------------------------- ;hourbuffer - holds the HOUR value ;----------------------------- hourbuffer times 3 db 0 ;----------------------------- hours db "Hours:", "$" ;----------------------------- ;syntaxerror - displays correct command syntax ;----------------------------- syntaxerror db 13, 10, "Invalid syntax, use: ", '[settime "Hour minute second date month year"]', 13, 10, "$" ;-----------------------------
It's passion that drives me.
![]() |
Similar Threads
- request for java code to set the system time zone (Java)
- Sleep method nad System time (C++)
- Aquarium Program- Help setting system time etc... (C++)
- Display System Time in VC++.net (Game Development)
- system time reset detection (C)
- Setting system date and time using c++ (C++)
Other Threads in the Assembly Forum
- Previous Thread: Assembly MIPS help
- Next Thread: Acessing register?
| Thread Tools | Search this Thread |





