INT 1A time

Programming, for all ages and all languages.
Post Reply
User avatar
Holus
Member
Member
Posts: 51
Joined: Thu Jan 27, 2011 5:57 pm

INT 1A time

Post by Holus »

There are some interrupt that give you a date or a time.
This is very strange. It give you a decimal value in a hex output.

AH = 0Ch
CH = hours (BCD)
CL = minutes (BCD)
DH = seconds (BCD)
DL = day of month (BCD)

I made a function to convert a 2 BYTE value to a output on screen. But can I get date and time more easy??

Code: Select all

HEX2DATE: ; INPUT AX=VALUE 
	PUSH AX
	XOR CL,CL
DATELOOP:	
	POP AX
	PUSH AX
	SHL AX,CL
	SHR AX,12
	ADD AL,48
	MOV AH,0Eh
	INT 10h 
	ADD CL,4
	CMP CL,16
	JNE DATELOOP
	POP AX
RET
I do not want to use this code if i do not have to!
Computer says NOOOO
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: INT 1A time

Post by Combuster »

You're out of luck, real hardware stores BCDs as well.

Apart from that, I doubt writing a driver is ever going to be easier than asking the bios.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply