Why we use 18.2hz system clock for video memory?

Status
Not open for further replies.

a_tek7

Banned
Joined
Feb 9, 2006
Messages
161
Helped
11
Reputation
22
Reaction score
2
Trophy points
1,298
Location
Bandar Abbas
Activity points
0
18.2hz

/**************************************************************************
* pixel.c *
* written by David Brackeen *
* http://www.brackeen.com/home/vga/ *
* *
* This is a 16-bit program. *
* Tab stops are set to 2. *
* Remember to compile in the LARGE memory model! *
* To compile in Borland C: bcc -ml pixel.c *
* *
* This program will only work on DOS- or Windows-based systems with a *
* VGA, SuperVGA or compatible video adapter. *
* *
* Please feel free to copy this source code. *
* *
* DESCRIPTION: This program demostrates how much faster writing directly *
* to video memory is. *
**************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <dos.h>

#define VIDEO_INT 0x10 /* the BIOS video interrupt. */
#define WRITE_DOT 0x0C /* BIOS func to plot a pixel. */
#define SET_MODE 0x00 /* BIOS func to set the video mode. */
#define VGA_256_COLOR_MODE 0x13 /* use to set 256-color mode. */
#define TEXT_MODE 0x03 /* use to set 80x25 text mode. */

#define SCREEN_WIDTH 320 /* width in pixels of mode 0x13 */
#define SCREEN_HEIGHT 200 /* height in pixels of mode 0x13 */
#define NUM_COLORS 256 /* number of colors in mode 0x13 */

typedef unsigned char byte;
typedef unsigned short word;


byte *VGA=(byte *)0xA0000000L; /* this points to video memory. */
word *my_clock=(word *)0x0000046C; /* this points to the 18.2hz system
clock. */
why we use 18.2hz?
(I'm new to c programming)
 

18.2hz

I'm not sure I understand your question, but . . .

Since the early days of DOS PCs, the real-time-clock chip and BIOS work together to increment the 32-bit value at memory address 0x0000046C at approximately 18.2 Hz. That rate is generated by dividing down a crystal oscillator that runs at some multiple of the NTSC television color subcarrier frequency. Basically:
3579545 Hz / 3 / 65536 ≈ 18.2 Hz
 

    a_tek7

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…