News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

SHOWTIME

Started by herge, September 24, 2008, 06:43:56 PM

Previous topic - Next topic

herge


Hi All:

A relatively short program that displays the
System Date & Time.


; REM SHOWTIME.ASM  Wednesday, September 24, 2008 2:30 PM
; by herge - Show System Date & Time
include \masm32\include\masm32rt.inc
.data
stm  SYSTEMTIME<>
    org stm; Must be eight words
wYear dw 0
wMonth dw 0
wToDay dw 0 ; Sunday 0 to Saturday 6
wDay    dw 0
wHour   dw 0
wMinute dw 0
wSecond dw 0
wKsecond dw 0
date_buf   db 50 dup (32)
time_buf   db 20 dup (32)
           db 0
dateformat  db " dddd, MMMM, dd, yyyy", 0
timeformat db "hh:mm:ss tt",0
.code
Start:
;  invoke   GetLocalTime, addr stm
;  invoke   GetDateFormat, 0, 0, \
;           ADDR stm, ADDR dateformat, ADDR date_buf, 50
   invoke   GetDateFormat, 0, 0, \
            0, ADDR dateformat, ADDR date_buf, 50
   mov   ecx, offset date_buf
   add   ecx, eax; add length returned by GetDateFormat
   mov   byte ptr [ecx-1], " " ;replace null with space
   invoke   GetTimeFormat, 0, 0, \
            0, ADDR timeformat, ecx, 20
   invoke   MessageBox, 0, addr date_buf, addr date_buf, MB_OK
   invoke ExitProcess, 0
end Start



Regards herge
// Herge born  Brussels, Belgium May 22, 1907
// Died March 3, 1983
// Cartoonist of Tintin and Snowy

Bill Cravener

Quote from: herge on September 24, 2008, 06:43:56 PM
Hi All:

A relatively short program that displays the System Date & Time.

Your learning buddy!!  :bg
My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

herge

 Hi Cycle Saddles:

Yes it is fairly short.
I even changed

dec ecx
mov byte ptr [ecx], " "
inc ecx



mov   byte ptr [ecx-1], " " ;replace null with space


Regards herge
// Herge born  Brussels, Belgium May 22, 1907
// Died March 3, 1983
// Cartoonist of Tintin and Snowy

Bill Cravener

Keep at it herge. Before long you'll be coding thousands of lines of asm code so don't be afraid to post your source code here. I love reading assembly language, its more fun then smoking marijuana.
My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

Mark Jones

...it's a good thing only the Politicians inhale. :U
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08