From: "Bonifati" Newsgroups: comp.os.msdos.djgpp Subject: accessing the graphical video memory Date: Sun, 6 Jun 1999 15:01:44 +0200 Organization: Centro Servizi Interbusiness Lines: 69 Message-ID: <7jdrj2$i3g$1@fe1.cs.interbusiness.it> NNTP-Posting-Host: 212.210.156.12 X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com i'm trying to convert some graphical demo programs in 320x200-256 written for Watcom under DJGPP. Since i need to access video memory directly, i've read djgppfaq. I copied a snippet of code from 18.4 section to define a selector for text video memory: int TxtVRAMSetupSelector (void) { static char selectorData[8] = { 0xff, 0x7f, 0x00, 0x80, 0x0b, 0xf3, 0x40, 0x00 }; int screenSelector = __dpmi_allocate_ldt_descriptors (1); if (__dpmi_set_descriptor (screenSelector, selectorData) < 0) abort (); return screenSelector; } and i modified like this: #include short video; int VideoVRAMSetupSelector (void) { static char selectorData[8] = { 0xff, 0xf9, 0x00, 0x00, 0x0a, 0xf3, 0x40, 0x00 }; int screenSelector = __dpmi_allocate_ldt_descriptors (1); if (__dpmi_set_descriptor (screenSelector, selectorData) < 0) abort (); return screenSelector; } void Create_Selector (void) { video = VideoVRAMSetupSelector(); _farsetsel(video); } this code seems to work and i get useful GPFs if my program has bugs and tries to work out of the 64000 bytes of video memory (i.e. plotting a pixel with too big coordinates). My question (at last!) is: is this code completely correct? Another thing: djgppfaq has a link to a tutorial about accessing the linear frame buffer, but i can't reach it: http://www.rt66.com/~brennan/djgpp/vbe.zip this ones are broken, too http://brennan.home.ml.org/djgpp/ http://brennan.home.ml.org/djgpp/djgpp-asm.html where can i find some example,tutorial... especially about inline assembly optimizations i need to do? (GCC online docs are too difficult for me...) ps: i think this is one of the best newsgroup about programming in the world