delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/23/04:47:01

Date: Sun, 22 Mar 1998 21:54:58 -0800 (PST)
Message-Id: <199803230554.VAA24649@adit.ap.net>
Mime-Version: 1.0
To: Nicolas Blais <eletech AT netrover DOT com>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Resolve a bet : Simple hello world sample at 640x480?

At 06:36  3/22/1998 -0500, Nicolas Blais wrote:
>Can anyone write me a full, simple c++ code hello world program running
>at 640x480 without using allegro?  My friend here says that it's
>impossible and I bet with him 20$ that it's possible.  As a proof, I
>have to show him the code.  So, anyone know how?

There's nothing magic about Allegro. The Interrupt List can be a very useful
source for stuff like this.

#include <dpmi.h>
#include <pc.h>

void set_mode(int m)
{
  __dpmi_regs r;
  r.h.ah = 0;
  r.h.al = m;
  __dpmi_int(0x10, &r);
}

void put_char(int ch, int color)
{
  __dpmi_regs r;
  r.h.ah = 0x0e;
  r.h.al = ch;
  r.h.bh = 0;
  r.h.bl = color;
  __dpmi_int(0x10, &r);
}

int main(void)
{
  char *p;
  set_mode(0x12);
  for (p = "Hello, world!"; *p; p++)
    put_char(*p, 1);
  getkey();
  set_mode(0x3);
}

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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