Eclipse OS and dang clear() function

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.
Post Reply
EclipseOS

Eclipse OS and dang clear() function

Post by EclipseOS »

Hi again everyone. Eclipse OS is on its way and can now accept input from the keyboard. And I wanted the user to be able to type "clear" to make the screen clear and then start another function like shell() again after it. So here's my problem: The clear function clears the screen, but it doesn't move the cursor back to (x,y) 0, 0. It just prints the next function a y value below the one you were at before you ran the clear function. my clear function is as follows:

void Video::clear()      
{
unsigned int i;
for(i = 0; i < (scrWidth * scrHeight); i++)
{
videomem = (unsigned char) ' ' | (colour << 8);
}
setcursor(0,0); //sets the xy values, but it isnt working.
}

Please help!
DennisCGc

Re:Eclipse OS and dang clear() function

Post by DennisCGc »

Why isn't it working ?
Make sure that:
- setcursor() works properly, when otherwise called
- make sure the 2 bytes are (the bytes that you use to "erase" the screen) 0x0700 is, else you won't see the cursor

HTH, Dennis
ASHLEY4

Re:Eclipse OS and dang clear() function

Post by ASHLEY4 »

There was a good OS made in about 97 called "Eclipse OS"
are you the same one ?
And as i do not use C, I can not help you on your clear screen problem.

ASHLEY4.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Eclipse OS and dang clear() function

Post by Pype.Clicker »

Ashley: are you referring to EOS, the game&demo 32 bits dosextender ?
ASHLEY4

Re:Eclipse OS and dang clear() function

Post by ASHLEY4 »

@Clicker,That's the one, Nice bit of programming that was :) .

ASHLEY4.
EclipseOS

Re:Eclipse OS and dang clear() function

Post by EclipseOS »

Nope
I didn't know that there was an OS called Eclipse OS. This is one that I've started recently. Still can't figure the clear() out. It's almost as if when I clear the screen the x y position doesn't get saved before I write some text to the screen at a new line down.
Some help would be appreciated. Thanx. I've also posted my setcursor() function.

void Video::setcursor(unsigned x, unsigned y)   
{
unsigned short offset;
offset = x + y * scrWidth;
outportb(crtc_mem + 0, 14);
outportb(crtc_mem + 1, offset >> 8);
outportb(crtc_mem + 0, 15);
outportb(crtc_mem + 1, offset);
}
whyme_t

Re:Eclipse OS and dang clear() function

Post by whyme_t »

I think your set cursor function doesn't actually set your physical X, Y cursor position. (The ones you use in your printf and friends functions). Your set cursor function only appears to change the hardware cursor...which will not effect where you write to on the screen next...
EclipseOS

Re:Eclipse OS and dang clear() function

Post by EclipseOS »

Okay
Thats what I thought, but how to I change the physical x and y pos. I call the clear function when the word clear is typed. So how do I keep the x y coordinates from one function (clear) to the next? Here's my video write function.

Thanx

void Video::put(char c)
{
int t;
switch(c)
{
case '\r':
xpos = 0;
break;
case '\n':
xpos = 0;
ypos++;
break;
case 8:
t = xpos + ypos * scrWidth;
if(t > 0)
{
t--;
}
if(xpos > 0)
{
xpos--;
}
else if(ypos > 0)
{
ypos--;
xpos = scrWidth - 1;
}
*(videomem + t) = ' ' | (colour << 8);
break;
default:                  
if(c < ' ') break;            
*(videomem + xpos + ypos * scrWidth) = c | (colour << 8);
xpos++;                     
if(xpos == scrWidth)         
{
xpos = 0;
ypos++;
}
break;
}
if(ypos == scrHeight)         
{
scrollup();               
ypos--;                  
}
setcursor(xpos, ypos);
}
whyme_t

Re:Eclipse OS and dang clear() function

Post by whyme_t »

Well it would appear your using C++, and I'll assume xpos and ypos are members of your Video class.

So you can set xpos and ypos to zero from within your clear function.

Check out http://www.invalidsoftware.net/, lots of C++ Kernel problem solving in the forum, and sections.
EclipseOS

Re:Eclipse OS and dang clear() function

Post by EclipseOS »

okay, I figured it out. Thanx alot for the help. Now what I need to figure out is how to shutdown an ATX computer. I have a reboot function that sends outportb (0x64, 0xfe); to the bios. Could someone tell me what command to send for an ATX shutdown?
I'm using C++ if you were wondering. Thanx
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Eclipse OS and dang clear() function

Post by Candy »

EclipseOS wrote: okay, I figured it out. Thanx alot for the help. Now what I need to figure out is how to shutdown an ATX computer. I have a reboot function that sends outportb (0x64, 0xfe); to the bios. Could someone tell me what command to send for an ATX shutdown?
I'm using C++ if you were wondering. Thanx
The BIOS doesn't listen on ports. Port 0x64 is the keyboard controller, and yes, it has a processor reset function. Try loading some different value in the cmos or use a bios function.
EclipseOS

Re:Eclipse OS and dang clear() function

Post by EclipseOS »

Like...
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Eclipse OS and dang clear() function

Post by Candy »

EclipseOS wrote: Like...
try ralf brown's list?

http://www.ctyme.com/intr/cat-031.htm

entire category on power management. Try the first set (APM).
Post Reply