int 86

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
eddyb

Post 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
eddyb

Post 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 :)
eddyb

Post by eddyb »

but how i can execute blt comands?
is confusing
eddyb

Post 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?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
eddyb

Post 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
Attachments
ssm.JPG
ssm.JPG (23.91 KiB) Viewed 2419 times
eddyb

Post 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
eddyb

Post 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?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Oh dear God please stop posting!
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

I was about to write the same thing!

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

Post 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?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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??
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

If you're completing step 1, is step 2 really necessary? :twisted:
eddyb

Post 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:
eddyb

Post by eddyb »

and VBE manual is also in japaneese :evil:
Locked