This project is read-only.

VGA to Console

Topics: Using Cosmos (Developing your own OS, projects, etc)
Sep 4, 2012 at 9:46 AM

Can someone tell me how to go back to the console if your in vga mode.

I'm useing MS4 (yes i know its ancient)

This is the code I used to go back to the console from vga mode:

 

VGAScreen.SetMode320x200x8();
            VGAScreen.SetPaletteEntry(0, 0, 0, 0);
            VGAScreen.SetPaletteEntry(1, 63, 0, 0);
            VGAScreen.SetPaletteEntry(2, 63, 63, 63);
            VGAScreen.SetPaletteEntry(3, 63, 63, 0);
            VGAScreen.SetPaletteEntry(4, 63, 0, 63);
            VGAScreen.Clear(0);
            VGAScreen.SetTextMode(VGAScreen.TextSize.Size80x25);
            Console.Clear();

Sep 11, 2012 at 4:52 PM
Edited Sep 11, 2012 at 4:53 PM

Not sure how you're handling stuff, but what I do is just make an enum of all recognised system states (STARTING, RUNNING, WAITING, FORCESTOP, SHUTDOWN, ZOMBIE), then handle events accordingly.

Example:

 

while(running) {
    switch(state) {
        case(State.SPLASH): {
            // Handle splash-screen
            break;
        }
        case(State.TERMINAL): {
            // Handle command-line stuffs
            break;
        }
        case(State.SCREEN): {
            // Handle your different screens
            break;
        }
        default: {
            // Insert your preference here?
            // FYI, I typically just recognise an illegal state as a system error.
            break;
        }
    }
}

This kind of "event handling" could work for just about anything, really. It's probably not the main-stream way of doing things, but hey, main-stream is boring anyways. ;)

Sep 11, 2012 at 9:56 PM
stevenator wrote:

Can someone tell me how to go back to the console if your in vga mode.

I'm useing MS4 (yes i know its ancient)

This is the code I used to go back to the console from vga mode:

 

 

VGAScreen.SetMode320x200x8();
            VGAScreen.SetPaletteEntry(0, 0, 0, 0);
            VGAScreen.SetPaletteEntry(1, 63, 0, 0);
            VGAScreen.SetPaletteEntry(2, 63, 63, 63);
            VGAScreen.SetPaletteEntry(3, 63, 63, 0);
            VGAScreen.SetPaletteEntry(4, 63, 0, 63);
            VGAScreen.Clear(0);
            VGAScreen.SetTextMode(VGAScreen.TextSize.Size80x25);
            Console.Clear();

 

What exactly do you mean because that code will do just that.