delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/17/18:16:49

From: Gautier de Montmollin <gdm AT pops DOT mydiax DOT ch>
Newsgroups: comp.os.msdos.djgpp
Subject: VESA (LFB) puzzle - long!
Date: Sun, 18 Mar 2001 00:06:31 +0100
Organization: diAx dplanet (postings do not reflect the views of diAx)
Lines: 89
Message-ID: <3AB3EDF7.6B32F69C@pops.mydiax.ch>
NNTP-Posting-Host: dialup-58-7.dplanet.ch
Mime-Version: 1.0
X-Trace: duba04h09-0.dplanet.ch 984870341 12643 212.35.58.7 (17 Mar 2001 23:05:41 GMT)
X-Complaints-To: usenet AT dplanet DOT ch
NNTP-Posting-Date: 17 Mar 2001 23:05:41 GMT
X-Mailer: Mozilla 4.75 [fr]C-CCK-MCD diax30 (Win98; U)
X-Accept-Language: fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi.
As user of a VESA library, I've come across
a strange problem: contrary to a lot of graphics
cards, one displays images like interlaced with
that library, but well with other VESA progs.
(the card is of a recent IBM Thinkpad. vlist says:
VESA version 2.0: Silicon Motion SM712 VGA BIOS detected)

Since I didn't write the library and have no clue
about selectors and all that, maybe someone will
recognize the issue with the elements I copy below.

I must abreviate, but if you are curious, the
library is there (SVGA02) http://home.trouwweb.nl/Jerry/other_os.html

Don't be shocked because it is not in C but Ada, the underlying context is DJGPP.
My guess is that something wrong happens either in
switching into the mode, or in poking data to video memory.

* setting the graphics mode

      Prog_Selector  := My_Ds;
      Video_Selector := Unsigned_32 (DOS_Ds);
      Set_Selector (DOS_Ds);                   -- Set_Selector = "_farsetsel"

  [ VESA info block is fetched via 16#4F01# VESA function. This works ]
         X_Size    := Natural (Current_Mode.XResolution);
         Y_Size    := Natural (Current_Mode.YResolution);
         Line_Size := Natural (Current_Mode.BytesPerScanLine);

         DPMI_Info.Size    := Unsigned_32 (X_Size * Y_Size);
         DPMI_Info.Address := Current_Mode.PhysBasePtr;
         if Dpmi_Physical_Address_Mapping (DPMI_Info) = -1 then
            raise Cannot_Map_Physical_Memory;
         end if;
         Video_Selector := Dpmi_Allocate_Ldt_Descriptors (1);
         if Video_Selector = -1 then
            raise Cannot_Alloc_Local_Desc;
         end if;
         if Dpmi_Set_Segment_Base_Address (Video_Selector,
                                           DPMI_Info.Address) = -1 then
            raise Cannot_Set_Base_Address;
         end if;
         if Dpmi_Set_Segment_Limit (Video_Selector,
                                    DPMI_Info.Size or 16#fff#) = -1 then
            raise Cannot_Set_Segment_Limit;
         end if;
         Set_Selector (Unsigned_16 (Video_Selector));

         SetVBEMode (The_Mode or 16#4000#); -- call to 4F02, with linear mode flag

* poking a pixel

         Poke_Byte (X + Y * Line_Size, Unsigned_8 (Color));

   procedure Poke_Byte (Offset : in Integer; Value : in Unsigned_8) is
   begin
      ASM (".byte 0x64; movb %b0, (%k1)",
        No_Output_Operands,
        (Unsigned_8'Asm_Input  ("qi", Value),
         Integer'Asm_Input ("r", Offset)),
        Volatile => True);
   end Poke_Byte;
   pragma Inline (Poke_Byte);


* an approach in another source which works for that graphics
  card (is it more correct with "__djgpp_conventional_base" ?) :

  // DPMI alloc
  info.size = ModeInfo.BytesPerScanLine * ModeInfo.YResolution;
  info.address = ModeInfo.PhysBasePtr;
  if (__dpmi_physical_address_mapping (&info) == -1) return 0;

  Screen = (unsigned char *)(info.address + __djgpp_conventional_base);
  Regs.x.ax = 0x4F02;
  Regs.x.bx = (0x4000 | Mode);
  __dpmi_int (0x10, &Regs);

...

  OffSet = (BytesPerScanLine * Y) + X;
  Screen [OffSet] = Color;

A free DOS 3D game to whom has a little decisive idea ;-)
Anyway, TIA, I'm curious about the thuth on all that...

__________________________________________
Gautier  --  http://www.diax.ch/users/gdm/

- Raw text -


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