Mail Archives: djgpp/1997/03/20/10:29:07
On Wed, 19 Mar 1997, Alex wrote:
> byte *VGA=(byte *)0xA0000000L; /* this points to video memory. */
> word *my_clock=(word *)0x0000046C; /* this points to the 18.2hz system
> clock. */
[snip]
> mouse->under[bitmap_offset] = VGA[screen_offset+mx+x];
> /* check for screen boundries */
> if (mx+x < SCREEN_WIDTH && mx+x >= 0 &&
> my+y < SCREEN_HEIGHT && my+y >= 0)
> {
> data = mouse->bmp->data[bitmap_offset];
> if (data) VGA[screen_offset+mx+x] = data;
> }
> }
> screen_offset+=SCREEN_WIDTH;
> }
> }
>
[snip]
> do { /* check mouse status */
> get_mouse_motion(&dx,&dy);
> press = get_mouse_press(LEFT_BUTTON);
> release = get_mouse_release(LEFT_BUTTON);
> } while (dx==0 && dy==0 && press==0 && release==0 &&
> *my_clock==last_time);
>
> if (*my_clock!=last_time) /* check animation clock */
> {
> if (mouse.bmp!=mouse.bmp->next)
> {
> redraw=1;
> mouse.bmp = mouse.bmp->next;
> }
> else
> last_time = *my_clock;
> }
These two snippets exhibit the source of your grief. In DJGPP, you
can't put an arbitrary value (such as 0x46C) into a pointer, then
dereference it and hope to get to the BIOS clock tick counter or to
the VGA video RAM, because DJGPP is a protected-mode environment: it
doesn't let you reference random memory regions to which you don't
have access.
The DJGPP FAQ list (available as v2/faq210b.zip from the same place
you get DJGPP) explains in chapter 18 how to do such things. As
somebody already said here: please read the FAQ.
- Raw text -