mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2003-09-28, 22:28   #1
dsouza123
 
dsouza123's Avatar
 
Sep 2002

2×331 Posts
Default Small win32 program to show system uptime and more

A small windows 32-bit program that shows system uptime ( how long has the computer been running since it was turned on ).

Here is a snippet of the code. Written in 32 bit MASM ( MS Windows x86 Assembly Language ). The program also tells the OS and CPU speed in Mhz. The program and asm source is included.

.data
TotDay dd 0
TotHr dd 0
TotMin dd 0
TotMSec dd 0

answer dd 0
DayFactor dd 1000 * 3600 * 24
HrFactor dd 1000 * 3600
MinFactor dd 1000 * 60
SecFactor dd 1000

fmtCaptionMn db " %4lu Mhz UpTime: %3lu days, %2lu hrs, %2lu min",0
szTipBuffer db " ",0
szCaption db "System UpTime",0

.code
;-------------------------------------
; Get time on
;-------------------------------------
invoke GetTickCount
mov TotMSec, eax

; TotDay := TotMSec / DayFactor
mov eax, TotMSec
mov ecx, DayFactor
mov edx, 0
div ecx
mov TotDay, eax

; TotMSec := TotMSec - (TotDay*DayFactor)
mov edx, 0
mov eax, TotDay
mov ecx, DayFactor
mul ecx
mov answer, eax

mov edx, 0
mov eax, TotMSec
mov ecx, answer
sub eax, ecx
mov TotMSec, eax

; TotHr := TotMSec / HrFactor
mov eax, TotMSec
mov ecx, HrFactor
mov edx, 0
div ecx
mov TotHr, eax

; TotMSec := TotMSec - (TotHr*HrFactor)
mov edx, 0
mov eax, TotHr
mov ecx, HrFactor
mul ecx
mov answer, eax

mov edx, 0
mov eax, TotMSec
mov ecx, answer
sub eax, ecx
mov TotMSec, eax


; TotMin := TotMSec / MinFactor
mov eax, TotMSec
mov ecx, MinFactor
mov edx, 0
div ecx
mov TotMin, eax

invoke wsprintf,ADDR szTipBuffer,ADDR fmtCaptionMn,CPUspeed,TotDay,TotHr,TotMin


invoke MessageBox,NULL,ADDR szTipBuffer,ADDR szCaption,MB_OK
Attached Files
File Type: zip uptime.zip (2.5 KB, 717 views)
dsouza123 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command-line program for factoring small numbers James Heinrich Software 22 2011-08-29 16:35
A small factoring program Yamato Factoring 2 2007-11-21 23:29
what is your current uptime? optim Lounge 7 2004-07-24 13:45
small matlab program for results file tom11784 Programming 2 2003-11-29 14:30
Small win32 program, range of time to do a TF dsouza123 Programming 1 2003-10-09 16:04

All times are UTC. The time now is 10:59.


Thu Aug 18 10:59:06 UTC 2022 up 8:27, 0 users, load averages: 1.14, 1.15, 1.08

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔