delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/27/11:17:17

From: horus AT prima DOT ruhr DOT de
Newsgroups: comp.os.msdos.djgpp
Subject: Please help: VESA and linear frame buffer
Date: Tue, 27 Jan 1998 15:30:20 GMT
Organization: Prima e.V.
Lines: 96
Message-ID: <34cdfd3a.2510437@news.prima.ruhr.de>
NNTP-Posting-Host: horus.prima.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

hi 

can anyone help me with this program ?
I want to put a pixel in 600x640x256 mode.

it compiles fine without warnings 
but I get no pixel on the screen 

"def.h"  =  some typedefs and include stuff 
"vesa.h" is the same like in allegro  (/src/djgpp/vesa.c ) 


#include "def.h"
#include "vesa.h"

int main(void)
{
    unsigned long linear_address;
    unsigned char *screen;
    FILE *log;
    MODE_INFO mode_info;
    __dpmi_regs regs;
    __dpmi_regs regs2;
    __dpmi_meminfo mem;
    
     log=freopen ("LOG.DAT", "wr", stderr);
  
/* get VESA_INFO */
/* --- cut --- */

/* get MODE_INFO */
  
   assert(sizeof(MODE_INFO) <
_go32_info_block.size_of_transfer_buffer);
    
    regs.x.ax=0x4F01;
    regs.x.cx=0x101;
    regs.x.di=__tb & 0x0F;          /* offset */
    regs.x.es=(__tb>>4) & 0xFFFF;   /* segment */
    __dpmi_int(0x10, &regs);
    dosmemget (__tb, sizeof(MODE_INFO), &mode_info);

    /* fprintf the structure to LOG.DAT */ 
    /* --- cut --- */

   /* check for linear address support */
   /* --- cut --- */

   /* get linear address */
    mem.size=(unsigned long)    \
(mode_info.XResolution*mode_info.YResolution);
    mem.address=mode_info.PhysBasePtr;

    if (0!=__dpmi_physical_address_mapping(&mem)){
        fprintf (stderr, "physical_address_mapping failed !\n");
    }

    linear_address=mem.address;
    fprintf (stderr, "\nsize =%d \n",mem.size);

/* set mode 600x480x256 */
    regs2.x.ax=0x4F02;
    regs2.x.bx=0x101;
    __dpmi_int (0x10, &regs2);
    if (regs2.x.ax!=0x4F){
        return 1;
        fprintf (stderr, "no \n");
    }
    fprintf (stderr, "yes \n");
    
    screen=(unsigned char *)linear_address;

    __djgpp_nearptr_enable();
    
/* put_pixel direct */
    screen[2+__djgpp_conventional_base]=10;
    
    while (!kbhit()); 

/* set text mode */
    regs.x.ax=0x03;
    __dpmi_int(0x10, &regs);
    __djgpp_nearptr_disable();
    
    fclose (log);
    return 0;
}

my video card supports VESA 2.0
and linear frame buffer.

Could anyone tell me what I am making wrong ?

thanks for your time 

- Raw text -


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