delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/11/22:33:41

From: Matt Kris <jdkris AT alpha DOT delta DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Mode13h help...
Date: Wed, 10 Dec 1997 23:42:13 -0500
Organization: Delta College
Lines: 60
Message-ID: <348F6F25.564D@alpha.delta.edu>
NNTP-Posting-Host: pm090-05.dialip.mich.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Howdy...

This code is suppose to just plot a pixel. It will compile with DJGPP
but will not run.  Please look through it and see what you's can come up
with. Thanks

/** *******************************************************************
* fast.c                                                              *
* written by Matt Kris                                                *
**********************************************************************/

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

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

char *video_buffer=(char *)0xA0000000L;
char color;
int x, y;

/*- set mode-------------------------------------------------------*/

void set_mode(unsigned char mode)
{
  union REGS regs;

  regs.h.ah = SET_MODE;
  regs.h.al = mode;
  int86(VIDEO, &regs, &regs);
}

/*- Plot_Pixel_Fast ------------*/

void Plot_Pixel_Fast(int x, int y, char color)
{
  video_buffer[((y<<8) + (y<<6)) + x] = color;
}

/*- Main -----------------------*/

int main(void)
{
  color = 8;
  x = 50;
  y = 50;

  set_mode(VGA_256_COLOR_MODE);       /* set the video mode. */

  Plot_Pixel_Fast(x,y,color);

  while(!kbhit()){}         /* Waits for a key to be hit */

  set_mode(TEXT_MODE);      /* Cuts back to text mode */

  return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019