delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/21/11:21:50

Xref: news2.mv.net comp.os.msdos.djgpp:4092
From: Arash <ei39594 AT ios DOT chalmers DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: SVGA direct memory access: why so slow???
Date: 20 May 1996 14:56:44 GMT
Organization: Chalmers University of Technology
Lines: 80
Message-ID: <4nq17c$2a2@nyheter.chalmers.se>
NNTP-Posting-Host: sv31977.ios.chalmers.se
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi'

I'm trying to copy a linear bitamp to a 640x400x256 screen.
Everything works just fine, the only problem is the slow paging function 
which (i think) is the most time-consuming routine here since it uses an 
external interrupt (video, int 0x10). I just get the "SVGA programmers 
guide" 1600 pages :( but i don't think there are many PMODE-code in it...

I think i should use vga-resgister insted of an interrupt, or write to 
all pages without page switching (like mode X 320x240), but i don't know 
how to do it...


I'll send you some code just so you can see how slow everything goes...




-- cut here --
#include <stdio.h>
#include <dpmi.h>
#include <stdlib.h>
#include <sys/movedata.h>

char *Buffer;

void SetupX(void){
	__dpmi_regs R;
	R.x.ax = 0x4f02;
	R.x.bx = 0x100;
	__dpmi_int(0x10,&R);

	}

void Page(int page){
	__dpmi_regs R;
	R.x.ax = 0x4f05;
	R.x.bx = 0;
	R.x.dx = page;
	__dpmi_int(0x10,&R);

	}
	
void CopyBuffer(void){
	Page(0);	dosmemput(Buffer,1L << 16, 0xa0000);
	Page(1);	dosmemput(Buffer + (1L << 16),1L << 16, 0xa0000);
	Page(2);	dosmemput(Buffer + (1L << 17),1L << 16, 0xa0000);
	Page(3);	dosmemput(Buffer + (1L << 17) + (1L << 16), 
59392, 0xa0000);
	}
	
void main(void){
	Buffer = (char *)malloc(640 * 400);
	if(Buffer){
		SetupX();
		
		for(int a = 0; a < 10; a++){
			for(long i = 0; i < 640 * 400; i++)
			Buffer[i] = i + a;
		
			CopyBuffer();
			}
		
		free(Buffer);
		} else printf("malloc failed\n");
	}
-- cut here --

Thanx for any help
-- Arash
   _____                            |\/\/\/|     
  /     \      ____________         |      |      _______________
\/\/     |    | net sux... \        |      |     |  way too much |
 |  (c)(c)    | he he cool..|       | (o)(o)     |  MTV dad!     |
 C   .---_)   |  __________/        S      _)    \   ____________|
  | |.___|   /  /                   | ,___|    __/  /
  |  \__/   <__/                    |    /    <____/


- Raw text -


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