delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/12/20:49:43

Message-ID: <33C72D52.45AD84F9@adelaide.on.net>
Date: Sat, 12 Jul 1997 16:38:02 +0930
From: Paul James Cichowski <paul AT adelaide DOT on DOT net>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Im sending this for a friend
NNTP-Posting-Host: ppp77.adelaide.on.net.au
Lines: 79
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm having trouble getting a linear frame buffer to work
on my Cirrus 5434 chip video card. It seems to work in
the SciTech Display Doctor/UniVBE tests and the (SciTech) control
panel states that a linear frame buffer is enabled at 3840 MB.

I have a VGA register reference which says that port 3C4
index 7 bits 4-7 selects video memory in 1 MB units.
The source code of the SVGA graphics library seems to agree
with this but it would only allow up 15 MB which is a
little less than SciTech D.D.'s value.
Is the register value referring to my computer's memory?
The 3840 MB is certainly not. (I have 16Mb)

I've included the code I'm using which always fails to map the
physical address. I've tried using all the possible values
for 3C4 index 7 bits 4-7 (0-15) in the "mode_x_tc" function.
What am I doing wrong?

If I was able to get this to work would I be able to access
the linear frame buffer as shown in the code? (I'm using
__djgpp_nearptr_enable and NASM assembler)

Here's my code:

///////////////////////////////////////////////////////

#include <sys/nearptr.h>
#include <dpmi.h>
#include <stdio.h>

typedef unsigned long int       word
typedef unsigned char           byte

void main() {
  word x=0;
  word lfb=0;
  __dpmi_meminfo info;
  if(__djgpp_nearptr_enable()==0);
    { text_m(); printf("__djgpp_nearptr_enable failed\n",0);
      getch(); exit(1); }

  mode_x_tc(); // NASM function sets 320x240 truecolor +
               // memory mapping address (0-15)

  outportb(0x3c4,7);
  x=((inportb(0x3c5)&0xF0)>>4)*1024*1024; // get memory mapping address
                                          // (0x3C4 index 7 bits 4-7)
  info.size=2097152;
  info.address=x;
  if(__dpmi_physical_address_mapping(&info)!=0);
    { text_m(); printf("Linear buffer at %U FAILED miserably\n",x);
      getch(); exit(1); }

  lfb=info.address+__djgpp_conventional_base;

  msetb(lfb,0,255);
  msetb(lfb,1,255);
  msetb(lfb,2,255);

  getch();
  text_m(); // NASM function sets text mode 3
}

/*
NASM function msetb(destination,destination offset,value):

_msetb  push    ebp
        mov     ebp,esp
        mov     edi,[ebp+8]
        add     edi,[ebp+12]
        mov     al,[ebp+16]
        stosb
        pop     ebp
*/

///////////////////////////////////////////////////////



- Raw text -


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