Page 3 of 4

Posted: Tue Feb 26, 2008 2:55 am
by eddyb
something like this?

Code: Select all

boutb( int n, int iport, int dport, char *v ) {
    int i;
    if (iport == (dport-1)) {
        for ( i = 0 ; i<n; i++) {
            outw( iport, i | ((*v++)<<8) );
        }
    } else {
        for ( i = 0 ; i<n; i++) {
            outb( iport, i );
            outb( dport, *v++ );
        }
    }
}

char VGA12Gen[] = { 0xE3, 0x04 };
char VGA12Seq[] = { 0x1, 0x1, 0xf, 0x00, 0x06 }; // 5
char VGA12Crtc[] = { 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E,
                     0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59,
                     0xEA, 0x8C, 0xDF, 0x28, 0x00, 0xE7, 0x04, 0xE3, 0xFF }; // 25
char VGA12GC[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0F, 0xFF }; // 9
char VGA12Attr[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
                     0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
                     0x01, 0x00, 0x0F, 0x00, 0x00 };     // 21

int main() {
    int q;
    q = inb( 0x3da );    
    q = q;                                  // force compiler to perform the inb
    outb(0x3C0, 0);                         // disable palette
    outb(0x3C2, VGA12Gen[0]);
    outb(0x3D4, 0x11);  outb(0x3D5, 0);     // unprotect crtc regs 0-7

// Reset and set sequencer regs

    boutb(5, 0x3C4, 0x3C5, VGA12Seq );          

// set misc out reg

    outb(0x3C2, VGA12Gen[0]);

    outb( 0x3c4, 0 );
    outb( 0x3c5, 3 );                       // seq enable

// set all crtc regs

    boutb(25, 0x3D4, 0x3D5, VGA12Crtc);

// set all graphics controller regs

    outb( 0x3CC, 0);    outb( 0x3CA, 1);
    boutb(9, 0x3CE, 0x3CF, VGA12GC);

// set all attribute regs

    q = inb(0x3DA); 
    q = q;                                  // reset flip/flop
    boutb( 21, 0x3C0, 0x3C0, VGA12Attr);

    outb( 0x3C0, 0x20 );                    // enable palette
    return 0;
}
It's nice

Posted: Tue Feb 26, 2008 4:21 am
by eddyb
It;s really funny to read intel documentation :D :D
I've tried with processor manual and i was bored
now let's see if i can read graphic documentation :)

Posted: Tue Feb 26, 2008 4:41 am
by eddyb
but how i can execute blt comands?
is confusing

Posted: Tue Feb 26, 2008 6:22 am
by eddyb
youpiiii
i entered video mode :D :D :D :

Code: Select all

#include <system.h>  

unsigned char inb (unsigned short r_port)
{
   return inportb(r_port);
}

void outb (unsigned short r_port, unsigned char r_data)
{
    return outportb(r_port, r_data);
}



void boutb( int n, int iport, int dport, char *v ) {
    int i;

        for ( i = 0 ; i<n; i++) 
		{
            outb( iport, i );
            outb( dport, *v++ );
        }
    
}

char VGA12Gen[] = { 0xE3, 0x04 };
char VGA12Seq[] = { 0x1, 0x1, 0xf, 0x00, 0x06 }; // 5
char VGA12Crtc[] = { 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E,
                     0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59,
                     0xEA, 0x8C, 0xDF, 0x28, 0x00, 0xE7, 0x04, 0xE3, 0xFF }; // 25
char VGA12GC[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0F, 0xFF }; // 9
char VGA12Attr[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
                     0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
                     0x01, 0x00, 0x0F, 0x00, 0x00 };     // 21





int vga_init() {
    int q;
    q = inb( 0x3da );   
    q = q;                                  // force compiler to perform the inb
    outb(0x3C0, 0);                         // disable palette
    outb(0x3C2, VGA12Gen[0]);
    outb(0x3D4, 0x11);  outb(0x3D5, 0);     // unprotect crtc regs 0-7

// Reset and set sequencer regs

    boutb(5, 0x3C4, 0x3C5, VGA12Seq );         

// set misc out reg

    outb(0x3C2, VGA12Gen[0]);

    outb( 0x3c4, 0 );
    outb( 0x3c5, 3 );                       // seq enable

// set all crtc regs

    boutb(25, 0x3D4, 0x3D5, VGA12Crtc);

// set all graphics controller regs

    outb( 0x3CC, 0);    outb( 0x3CA, 1);
    boutb(9, 0x3CE, 0x3CF, VGA12GC);

// set all attribute regs

    q = inb(0x3DA);
    q = q;                                  // reset flip/flop
    boutb( 21, 0x3C0, 0x3C0, VGA12Attr);

    outb( 0x3C0, 0x20 );                    // enable palette
    return 0;
} 
works very well(the screen get bigger, and it is filled with black) :)
that enter vga mode?

Posted: Tue Feb 26, 2008 6:29 am
by Combuster
that enter vga mode?
what do YOU think? We're not to review every single piece of code you wrote.

Its that simple: start drawing and either it works or it doesn't.

Posted: Tue Feb 26, 2008 6:38 am
by eddyb
i've done

Code: Select all

void plot_pixel(int x,int y,byte color)
{
  VGA[y*320+x]=color;
}

void gen_sv()
{
	int i;

  for(i=0;i<20L;i++)               /* randomly plot 50000 pixels. */
  {
       plot_pixel(i,i,15);
  }
}
i simply execute vga_init and gen_sv
and that i get

Posted: Tue Feb 26, 2008 8:19 am
by eddyb
ploting is decalated
If i want to plot all the screen, i have barcodes :D :cry:
but depends on the color
when the color value is bigger, is more compact
when color value is small(ex: 10), it have spaces betwen pexels
and i have no color, all is white

Posted: Tue Feb 26, 2008 9:02 am
by eddyb
the code is for 640x480 mode :D
can anyone explain me wtf are theese out and in?
or a list of ports
and how i can change the mode to 320x200?

Posted: Tue Feb 26, 2008 9:24 am
by JamesM
Oh dear God please stop posting!

Posted: Tue Feb 26, 2008 9:30 am
by AJ
I was about to write the same thing!

@OP Please see the last post on page 2 of this thread.

Posted: Tue Feb 26, 2008 9:38 am
by eddyb
AJ wrote:
eddyb wrote:give me a solution
That attitude really isn't helping. You need to learn how to use search engines - on this site and google.
1)how to enter by default v8086 with my kernel
Add multitasking support to your current kernel. Then come back and ask more specific questions, because you will be more ready to use v86.
OR
2) give me an example of video driver using only in and out
http://intellinuxgraphics.org/index.html. Have fun :roll:
And WTF is www.vesa.org? there ins't any documentation!
Have a look here, specifically the first two hits. Wasn't that difficult now, was it?
I dont understand intel video chipset manual.. :(
how i can execute a chipset function?

Posted: Tue Feb 26, 2008 9:47 am
by JamesM
wikipedia wrote:Steps to send a command to an Intel (tm) chipset:
1. Open up your firewall. Set a block on outgoing connections to *.osdev.org, port 80.
2. Unplug your keyboard. Throw it in the bin.
See what an easy google search can get you??

Posted: Tue Feb 26, 2008 9:51 am
by AJ
If you're completing step 1, is step 2 really necessary? :twisted:

Posted: Tue Feb 26, 2008 9:54 am
by eddyb
:evil: :evil: :evil: :evil: u ar very rude
what's the problem with me?
and i'll never block osdev from firewall :P :twisted:

Posted: Tue Feb 26, 2008 9:56 am
by eddyb
and VBE manual is also in japaneese :evil: