Author Topic: time  (Read 21118 times)

nobody

  • Guest
time
« on: October 16, 2004, 10:33:02 PM »
would anyone know how to get the time info from bios without using interupts or how to make a timer?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: time
« Reply #1 on: October 17, 2004, 01:50:12 AM »
You can read "ticks" (18.2/sec) at 0040:006C, if that'll serve your purposes. Or read the Real Time Clock off cmos ports 70h/71h (be careful messing with cmos!). Maybe timer port 40h would interest you... Why don't you want to use interrupts, or just ask the OS?

Best,
Frank

nobody

  • Guest
Re: time
« Reply #2 on: October 17, 2004, 04:05:55 PM »
i'd just like to gain a better understanding of how the pc works... and as i learn more and more i want to apply that knowledge to making a simple protected mode os to further my understanding even more. how exactly would i read the ticks or real time from 0040:006c or cmos? thanks for you help. i appreciate it greatly :)

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: time
« Reply #3 on: October 18, 2004, 12:01:08 PM »
Ah!

You sure this is a beginner question? :)

Once you've switched to pmode, the value at 0040:006C will no longer be updated by the timer interrupt (you'll have turned off interrupts before the switch to pmode, or you'll reboot immediately - the existing 16-bit interrupt code won't work).

You'll probably want to look at Kris Heidenstrom's timing FAQ:

ftp://garbo.uwasa.fi/pc/programming/pctim003.zip

Probably more than you wanted to know...

There's good introductory information (and links to more) on entering pmode, and getting an OS working at:

http://www.execpc.com/~geezer

You might want to subscribe to news:alt.os.development - they'll tell you you've gotta read Tanenbaum and a whole lot more before you even start coding... Neccessary if you intend to write a "Windows-killer", but for an "educational OS", I don't see why you can't "wing it".

Ralf Brown's Interrupt List, besides the interrupt list, includes the "ports list", "cmos list", and "memory list" - you've probably already got that.

The only general hint I can give you is that to read/write multiple-register ports, you "out" the register number to one port (70h for cmos - I think the RTC registers are the first dozen or so), then "in" (or "out" to write) the next highest port - 71h - to get the data. About the only thing I've actually *done* with ports is "beep the speaker"...

You've got yourself a lifelong project there - you'll never be bored again! (frustrated, yes)... Let us know how it comes along!

Best,
Frank