delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/21/03:01:32

From: Genady Beryozkin <c0467082 AT techst02 DOT technion DOT ac DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: wirting to a virtual screen - HELP!
Date: Mon, 20 Oct 1997 22:35:01 +0200
Organization: The Technion
Lines: 87
Message-ID: <344BC075.ED59ED93@t2.technion.ac.il>
References: <199710182000 DOT NAA16477 AT adit DOT ap DOT net>
NNTP-Posting-Host: 192.115.49.13
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a multi-part message in MIME format.
--------------6CEE3248E7803E349BCC0DA3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I think I saw allegro doing such things - people told me it's quite
useful.

Genady


Nate Eldredge wrote:
> 
> At 12:16  10/17/1997 GMT, waage wrote:
> >I am having problems copying info from a virtual screen allocated with
> >malloc and copying it to the VGA 0xa000.  The code looks like this,
> >when compiled it says no errors but when I try to write to the virtual
> >screen with my put_pixel it crashes.
> >
> >This is the function that allocates the virtual screen and (I hope)
> >returns the address in memory where its located.
> >
> >unsigned long set_virtual(int w, int h) {
> >    unsigned long v_size = w * h;
> >    unsigned long vir_scr;
> >    (void *)vir_scr = malloc(v_size);
> >
> >    if(vir_scr != NULL) {
> >      printf("Allocated memory for virtual screen.\n");
> >      return vir_scr;
> >      }
> >    else {
> >      printf("Unable to allocate %U bytes for virtual screen.\n",
> >v_size);
> >      return 0;
> >      }
> >}
> >
> >This is my put_pixel function, where is the address in memory that it
> >wants to write to.
> >
> >void put_pixel(int where, int x, int y, unsigned char *col) {
> >    _farpokeb(_dos_ds, where*16+(x+(y*320)), col);
> >    }
> >
> >This does not work with the virtual screen.  Can anyone tell me if it
> >is because the virtual screen has a different selector than the a000
> >(the info said that _dos_de has a limit of 1MB)?  Does malloc(...) use
> >memory above 1mb and do I need to use a different selector?  I thought
> >of this and came up with this:
> That's it exactly. All your program's code and data is addressed relative to
> the _my_ds() selector. You don't need to use farptr functions to access it.
> >
> >short get_virtual_discriptor(unsigned long vir_scr) {
> >    return(__dpmi_segment_to_descriptor(vir_scr));
> >       }
> >
> >void put_vir_pixel(short sel, unsigned long where, int x, int y,
> >unsigned char col) {
> >    _farpokeb(sel, where*16+(x+(y*320)), col);
> >    }
> Do this to put_pixel your vir_scr:
> *(unsigned char *)vir_scr+x+(y*32) = col;
> 
> Nate Eldredge
> eldredge AT ap DOT net
--------------6CEE3248E7803E349BCC0DA3
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Genady Beryozkin
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Genady Beryozkin
n:              Beryozkin;Genady
org:            The Technion
adr:            ;;;Natzrat Illit / Haifa;;;Israel
email;internet: c0467082 AT t2 DOT technion DOT ac DOT il
note:           Homepage : http://t2.technion.ac.il/~c0467082/
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------6CEE3248E7803E349BCC0DA3--

- Raw text -


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