Google Answers Logo
View Question
 
Q: 8086 Analog Clock Assembly Subroutine ( No Answer,   5 Comments )
Question  
Subject: 8086 Analog Clock Assembly Subroutine
Category: Computers > Programming
Asked by: diversify-ga
List Price: $80.00
Posted: 20 May 2006 17:02 PDT
Expires: 25 May 2006 09:55 PDT
Question ID: 730819
Hi.
I need to know how code should be like written in the 8086/8088
assembly for this purpose. I need to take the current time from the
computer (a normal WindowsXP-based computer) and start using it for
the clock. The clock will display hours and minutes based on updated
calculations using delay loops. The interface of the clock should be
that of an analog clock.
Well, my problem here is with taking the initial time. Also, with the
display of  the clock as slant lines. How do I take the initial time,
and how can I display these lines that show the time in the clock? For
the time display, I would like it to be made using BIOS interrupts, if
possible, as my personal knowledge of programming in assembly is not
that quite advanced!
I need help ASAP here.
Thank you.
Answer  
There is no answer at this time.

Comments  
Subject: Re: 8086 Analog Clock Assembly Subroutine
From: redfoxjumps-ga on 20 May 2006 23:13 PDT
 
Smells like something done many times before.

Perhaps there are canned routines out there.

Isn't this the processor they built the first IBM pc on?

Is the clock speed relevant? Is the clock part od the 8086?

Will the clock drift with temperature changes?

Do you have a prototyping kit?
Subject: Re: 8086 Analog Clock Assembly Subroutine
From: frde-ga on 21 May 2006 02:31 PDT
 
Int 21h
AH = 2C

on return:
CH = hour (0-23)
CL = minutes (0-59)
DH = seconds (0-59)
DL = hundredths (0-99)

- retrieves DOS maintained clock time

This is not exactly the BIOS time

However Int 8h is definately part of the BIOS:

System timer  Int 8h
no input data
Related Memory:

   0:46C = Daily timer counter (4 bytes)
   0:470 = 24 hr overflow flag (1 byte)
   0:467 = Day counter on all products after AT
   0:440 = Motor shutoff counter - decremented until 0 then
           shuts off diskette motor

- INT 1C is invoked as a user interrupt
- the byte at 0:470 is a flag that certain DOS functions use
  and adjust the date if necessary.  Since this is a flag and
  not a counter it results in DOS (not the RTC) losing days
  when several midnights pass before a DOS call

It looks like 0:46C = Daily timer counter (4 bytes)
holds the time from midnight

Personally I think that you are going about things in a peculiar
manner, most languages offer you the current time and date there are
also Windows APIs that do the same.

If you are working on Windows XP then you could have problems getting
at the BIOS or even rudimentary Interrupts directly.

I find it hard to believe that the Graphical display that you describe
will be written in ASM

Which language are you really going to use ?
Subject: Re: 8086 Analog Clock Assembly Subroutine
From: mfripp-ga on 24 May 2006 11:06 PDT
 
If you are running under Windows XP, you should be using the Win32 API
(i.e., linking to functions built in to the operating system) to get
the time and draw the display. You can do this in assembly language if
you can figure out how to find and call the API functions properly,
but you will have a much easier time doing this in C. However, this
would not work well with delay loops as you describe: Windows will
switch back and forth between your program and other tasks, and the
loops will not necessarily take the amount of time you expect.

If you are running in DOS/real mode, then assembly language with delay
loops would be fine. You can use the BIOS or DOS interrupts given by
the other commenters to get the starting time. Then you can use your
delay loops to count forward (you will need to adjust your loop count
depending on how quickly each machine runs). But I don't think BIOS or
DOS offers an easy way to draw graphics on the screen at level of
individual pixels. You may be able to do this using calls to the VGA
BIOS. Or you could take the easy way out and "draw" your clock face
using text characters. e.g., you could keep the screen in text mode,
and put X's in the appropriate places for the hour hand, o's for the
minute hand and .'s for the second hand. Then write spaces over them
and put them in a new place at the end of each second.
Subject: Re: 8086 Analog Clock Assembly Subroutine
From: mfripp-ga on 24 May 2006 11:21 PDT
 
If you are running in real mode and want to write graphics directly to
the screen, this web page may help:
http://courses.ece.uiuc.edu/ece390/books/labmanual/graphics-mode13h.html

Basically, you call interrupt 13h to switch the display into standard
VGA graphics mode, then you can write directly to a particular area of
memory to draw pixels on the screen. It's up to you to decide what you
want to draw.
Subject: Re: 8086 Analog Clock Assembly Subroutine
From: frde-ga on 25 May 2006 05:05 PDT
 
Int 13h  - that will be messing with the disk drives

Int 10h is the video control interrupt

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy