VESA Help

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.
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: VESA Help

Post by iansjack »

Don't worry. People will stop answering long before you get to 1000.
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

iansjack wrote:Don't worry. People will stop answering long before you get to 1000.
LoL. :mrgreen: Will you answer my first few questions then?
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: VESA Help

Post by iansjack »

I'm sure that somebody will. But the answer may just be a link to the Wiki or even a "look in the Wiki". You are well advised to make efforts to find the answer to your questions yourself first.
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

My first two are about printing text to screen:

In Barebones tutorial, where is the pointer to 0xB8000? I'm assuming it's terminal buffer.
Secondly, is the pointer included within this code from the Printing to Screen article:

Code: Select all

// note this example will always write to the top
// line of the screen
void write_string( int colour, const char *string )
{
    volatile char *video = (volatile char*)0xB8000; //I think this is where the pointer is intialized, correct me if I is wrong
    while( *string != 0 )
    {
        *video++ = *string++;
        *video++ = colour;
    }
}
Because the two referenced articles handle printing very differently, as the Barebones code references

Code: Select all

const size_t index = y * VGA_WIDTH + x;
terminal_buffer[index] = make_vgaentry(' ', terminal_color);
This is a bit confuzing.
Thanks

Edit: I figured it out myself! it did address the pointer in the code.
Compiles nicley :) Will be changing a lot of it (at least two lines)
Last edited by cheapskate01 on Thu Dec 10, 2015 6:02 pm, edited 2 times in total.
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

iansjack wrote: You are well advised to make efforts to find the answer to your questions yourself first.
Oh yeah, I've made myself a rule to only go to the forums if I can just completely not figure it out myself.
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: OS Help

Post by cheapskate01 »

Okay, so I've merged my existing code with a minimal libc and a meaty skeleton style directory system. Now I'm on to paging, and it's been a tad confusing. I've been using Setting_Up_Paging and studying the code a bit. I'm just a bit confused as to what code goes where. for example:

Does this:

Code: Select all

//set each entry to not present
int i;
for(i = 0; i < 1024; i++)
{
    // This sets the following flags to the pages:
    //   Supervisor: Only kernel-mode can access them
    //   Write Enabled: It can be both read from and written to
    //   Not Present: The page table is not present
    page_directory[i] = 0x00000002;
}
Belong in the same document with

Code: Select all

uint32_t page_directory[1024] __attribute__((aligned(4096)));
? Do I have to edit my linker script? can somebody take the time to walk me through setting up paging with a more in depth description of each step?

Thanks
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
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:

Re: VESA Help

Post by Combuster »

So, rather than make 1000 forum threads for questions, can I just turn this one into a place to ask all my questions that probably dont deserve their own topic? Is that within the forum rules?
Asking us 1000 questions in total can't possibly be right (smart questions forum rule). Reusing the same thread for everything can't possibly be right either (off topic forum rule).

This particular fresh question can be replied to with the comment "what happened when you tried it" and "have you read all the instructions" (smart questions forum rule), is not at all covered by the thread title (off-topic forum rule), and explicitly asks for hand-holding (smart questions forum rule) for which the rest of the question seems to be an unguided distraction. Currently, my primary concern is about the real problem actually being "one does not simply understand paging", or is it rather the more fundamental "one does not simply understand programming".

Key thing to be wary of is that you only ever stick to tutorials, you'll never learn to move beyond them. Learning works better when you make your own mistakes, so make those mistakes first. :wink:
"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 ]
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

Combuster wrote:
So, rather than make 1000 forum threads for questions, can I just turn this one into a place to ask all my questions that probably dont deserve their own topic? Is that within the forum rules?
Asking us 1000 questions in total can't possibly be right (smart questions forum rule). Reusing the same thread for everything can't possibly be right either (off topic forum rule).

This particular fresh question can be replied to with the comment "what happened when you tried it" and "have you read all the instructions" (smart questions forum rule), is not at all covered by the thread title (off-topic forum rule), and explicitly asks for hand-holding (smart questions forum rule) for which the rest of the question seems to be an unguided distraction. Currently, my primary concern is about the real problem actually being "one does not simply understand paging", or is it rather the more fundamental "one does not simply understand programming".

Key thing to be wary of is that you only ever stick to tutorials, you'll never learn to move beyond them. Learning works better when you make your own mistakes, so make those mistakes first. :wink:
Wow. I heard you had a slick tongue but wow! The way you reply to this stuff just bafflez me! (Compliment)

Anyways, I figured that last part out myself, so I've been trying to stay away from those.
About the second thing you said, How will I know if I made a mistake? Will the compiler just throw an error? How can I tell if I got it right?

Thanks; I like your OS
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

azblue wrote:
One thing I like to recommend is mode 13h.

From Real Mode:

Code: Select all

mov ax, 13h
int 10h
Cool! I remade my kernel in real mode and added a vga command and it totally worked! Thanks. But how do I plot a pixel with just NASM?
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: VESA Help

Post by alexfru »

cheapskate01 wrote: Cool! I remade my kernel in real mode and added a vga command and it totally worked! Thanks. But how do I plot a pixel with just NASM?

Code: Select all

mov ax, 0x13
int 0x10
mov ax, 0xa000
mov es, ax
mov byte [es:320*100 + 160], 15
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

alexfru wrote:
cheapskate01 wrote: Cool! I remade my kernel in real mode and added a vga command and it totally worked! Thanks. But how do I plot a pixel with just NASM?

Code: Select all

mov ax, 0x13
int 0x10
mov ax, 0xa000
mov es, ax
mov byte [es:320*100 + 160], 15
Thank you! One more little thing, how to draw a line with this pixel stuff without coding each pixel individually?
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: VESA Help

Post by neon »

Implement a line scanning algorithm (such as midpoint or Bresenham's) and optimize it. Why do you want to limit yourself to assembly language solutions?
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

neon wrote:Implement a line scanning algorithm (such as midpoint or Bresenham's) and optimize it. Why do you want to limit yourself to assembly language solutions?
For now, Its just a bootsector. It'll be fixed later, but I'm just using asm for now, to learn real mode schtuff
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: VESA Help

Post by neon »

Line scanning algorithms tend to be quite long since it needs to compensate for 8 separate cases during rendering (+/- slope in 4 quadrants); I would not even attempt to put it in the boot sector given the lack of space available. Don't worry about graphics until after the boot sector.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
cheapskate01
Member
Member
Posts: 58
Joined: Sat Aug 01, 2015 9:05 pm

Re: VESA Help

Post by cheapskate01 »

neon wrote:Line scanning algorithms tend to be quite long since it needs to compensate for 8 separate cases during rendering (+/- slope in 4 quadrants); I would not even attempt to put it in the boot sector given the lack of space available. Don't worry about VBE until after the boot sector.
Yep. just figured that out ofter adding a 80x50 text mode as another command. I went some 15oo bytes over lol :wink:
"That I'm in forum signatures is just a sign the invasion of sortie is nearing completion. Soon you'll all have to become me to defeat me." ~ Sortie
Post Reply