Page 1 of 1
Eclipse OS and dang clear() function
Posted: Thu Apr 29, 2004 2:03 pm
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 << ;
}
setcursor(0,0); //sets the xy values, but it isnt working.
}
Please help!
Re:Eclipse OS and dang clear() function
Posted: Thu Apr 29, 2004 2:36 pm
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
Re:Eclipse OS and dang clear() function
Posted: Thu Apr 29, 2004 8:56 pm
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.
Re:Eclipse OS and dang clear() function
Posted: Fri Apr 30, 2004 1:58 am
by Pype.Clicker
Ashley: are you referring to EOS, the game&demo 32 bits dosextender ?
Re:Eclipse OS and dang clear() function
Posted: Fri Apr 30, 2004 10:53 am
by ASHLEY4
@Clicker,That's the one, Nice bit of programming that was
.
ASHLEY4.
Re:Eclipse OS and dang clear() function
Posted: Sat May 01, 2004 2:20 am
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 >>
;
outportb(crtc_mem + 0, 15);
outportb(crtc_mem + 1, offset);
}
Re:Eclipse OS and dang clear() function
Posted: Sat May 01, 2004 7:44 am
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...
Re:Eclipse OS and dang clear() function
Posted: Sat May 01, 2004 3:05 pm
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 <<
;
break;
default:
if(c < ' ') break;
*(videomem + xpos + ypos * scrWidth) = c | (colour <<
;
xpos++;
if(xpos == scrWidth)
{
xpos = 0;
ypos++;
}
break;
}
if(ypos == scrHeight)
{
scrollup();
ypos--;
}
setcursor(xpos, ypos);
}
Re:Eclipse OS and dang clear() function
Posted: Sat May 01, 2004 3:47 pm
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.
Re:Eclipse OS and dang clear() function
Posted: Sun May 02, 2004 8:57 pm
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
Re:Eclipse OS and dang clear() function
Posted: Sun May 02, 2004 11:00 pm
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.
Re:Eclipse OS and dang clear() function
Posted: Mon May 03, 2004 12:48 am
by EclipseOS
Like...
Re:Eclipse OS and dang clear() function
Posted: Mon May 03, 2004 1:02 am
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).