Mail Archives: djgpp/1998/03/23/04:47:01
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 -