Message board for the users of flat assembler.
> OS Construction > Time INT 1aH
hello ... How do I display the time through hello ... How do I display the time through INT 1aH? the code please.
|10 Mar 2011, 17:21||
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
push eax ; don't want to trash a & b several times a sec
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
The DexOS function GetTime loads the time into register eax
|11 Mar 2011, 05:02||
|12 Mar 2011, 15:54||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.