🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.msdos.programmer
Article #3

Direct SVGA memory access

#3
From: Gregory Humphreys
Date: Thu, 20 Aug 1992 14:13
74 lines
2360 bytes
Okay.  I want to write to SVGA memory without using BIOS calls on my 486.  I can do it great with int 10, but it's slow as all hell.  What is happening is after I calculate the address for the VRAM, everything is getting modded into the top 64k of VRAM (one display pages worth, I guess).  Imagine the 1024x768x256 screen sectioned into 12 horizontal bars, and anything that you write is put into the TOP one.  ANyhow, I think this is because I'm not changing display pages.  So I tried Three things:

1)

void Plot(x,y,Color)
int x,y,Color
{

	int Page
	long offset;
	char far *address;

	Page = y/64;
	outport(0x3CD,Page);

	offset = 1024*y + x;
	address = (0xA0000000L + offset);
	*address = Color;
}


2) 


void Plot(x,y,Color)
int x,y,Color
{

	int Page
	long offset;
	char far *address;
	char far *PageAddress;

	Page = y/64;
	PageAddress = MK_FP(0000,0x462); /* The Low Memory address of the current
						Page Number */

	*PageAddress = Page;	

	offset = 1024*y + x;
	address = (0xA0000000L + offset);
	*address = Color;
}

3)

void Plot(x,y,Color)
int x,y,Color
{

	int Page
	long offset;
	char far *address;
	
	Page = y/64;
	
	_AH = 5;
	_AL = Page;

	geninterrupt(0x10);

	offset = 1024*y + x;
	address = (0xA0000000L + offset);
	*address = Color;
}
	
The Third one at least gave me some results - everything I had drawn got moved to the bottom half of the screen and above it was about 300 horizontal blue bars that flickered a lot.  Any ideas?  This is a Trident 8900 card w/ 1 meg VRAM on a 486/33 using Borland C++ 3.0.  HELP ME DAMMIT!  Can you tell I'm frustrated? YES!!!!


-- 
Greg Humphreys    |  "Playing not to win is like sleeping with your 
gregh@alw.nih.gov |  sister - sure, she's a great piece of tail, 
                  |  and she's got a bag full of goodies, but it's 
(301) 402-1817    |  just plain illegal."  -Charlie Sheen, "Hotshots"
Technical Details
Message-ID: <1992Aug20.141357.20611@alw.nih.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!seismo!darwin.sura.net!nih-csl!alw.nih.gov!gregh

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!seismo!darwin.sura.net!nih-csl!alw.nih.gov!gregh
From: gregh@alw.nih.gov (Gregory Humphreys)
Newsgroups: comp.msdos.programmer,comp.graphics,comp.sys.ibm.pc.programmer
Subject: Direct SVGA memory access
Message-ID: <1992Aug20.141357.20611@alw.nih.gov>
Date: 20 Aug 92 14:13:57 GMT
Sender: postman@alw.nih.gov (AMDS Postmaster)
Organization: National Inst. of Health, DCRT, CSL
Lines: 74