delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/26/14:37:25

Date: Sun, 26 Oct 1997 11:34:43 -0800 (PST)
Message-Id: <199710261934.LAA07523@adit.ap.net>
Mime-Version: 1.0
To: Darren Ford <darylmer AT flash DOT net>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Newbie ASM and Mode 13h Question

At 10:04  10/24/1997 -0500, Darren Ford wrote:
>I just downloaded DJGPP last night and am trying to learn how to use
>it.  I have tried several ways to get into Mode 13h but I just can't get
>the compiler to quit bitching at me.    I've never used a GNU compiler
>before or many period.  I obviously have syntax problems.  I don't know
>the DJGPP syntax .  I don't know a lick of ASM either.  Can anyone give
>me a complete compilable routine(s) to achieve Mode 13h.  It would be
>great to have it in two forms. One being with inline ASM and the other
>with DPMI functions.  Does this make sense?  My other problem is which
>headers to include.

Okay, here's an assembly version:

void set_vid_mode(int m)
{
  asm("movb %0,%%al; xorb %%ah,%%ah; int $0x10"
      :
      : "g" ((unsigned char)m)
      : "%ax");
}

And with DPMI functions:
#include <dpmi.h>
void set_vid_mode(int m)
{
   __dpmi_regs r;
   r.h.ah = 0;
   r.h.al = (unsigned char)m;
   __dpmi_int(0x10,&r);
}

Note that you can't write to video memory by just creating a pointer =
0xA0000. You will need to use farptr functions, or some similar method. See
FAQ section 18.4 for a summary.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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