flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Time INT 1aH

Author
Thread Post new topic Reply to topic
MegaCoder



Joined: 31 Jan 2011
Posts: 13
Location: Russia
MegaCoder 10 Mar 2011, 17:21
hello ... How do I display the time through hello ... How do I display the time through INT 1aH? the code please.
Post 10 Mar 2011, 17:21
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
roboman



Joined: 03 Dec 2006
Posts: 122
Location: USA
roboman 11 Mar 2011, 05:02
I'm guessing your home work wants you to use a function of INT 1aH to get the time. That would likely be function 02H that you are looking for. You load 02H into register AH then call INT 1aH. That will load the time
into register CX and the seconds into DH as well as setting a flag in DL if it's daylight savings time. That leaves you with figuring out how to print something on the screen and that depends a great deal on what os you are using and what kind of support it offers in printing numbers and text. Also depends on what graphics / text mode you are in....

Here's the source for a clock program I did for DexOS http://home.comcast.net/~dexos/time.zip


clock:
push eax ; don't want to trash a & b several times a sec
push bx
call [GetTime] ; ask the computer what time it is
shr eax,8 ; Blow off seconds
cmp ax,word[old_time] ; has the time changed
je done ; no need to reprint the same time
mov word[old_time],ax ; make a bew old time
mov bx,ax ; store the time in ebx
shr al,4 ; blow off the low digit of the min
add al,48 ; change it to ascii
mov [0xb7b08],al ; write to screen
mov al,00001111b ; mask to dump other part of min
and al,bl ; put other digit of min in al
add al,48 ; change to ascii
mov [0xb7b0a],al ; write to screen
mov al,bh ; get the hour from bx
shr al,4 ; blow off low digit
add al,48 ; change to acii
mov [0xb7b02],al ; put high digit of hour on screen
mov al,00001111b ; mask to dump high didit of hour
and al,bh ; put low didit of hour in al
add al,48 ; make ascii
mov [0xb7b04],al ; put it on screen
mov al,':' ; gotta have a colen
mov [0xb7b06],al ; on the screen
done:
pop bx
pop eax

The DexOS function GetTime loads the time into register eax
Post 11 Mar 2011, 05:02
View user's profile Send private message Visit poster's website Reply with quote
MegaCoder



Joined: 31 Jan 2011
Posts: 13
Location: Russia
MegaCoder 12 Mar 2011, 15:54
Thanks ...
Post 12 Mar 2011, 15:54
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.