Hi,
i try to write a small os. Now i write functions for the console. The Problem is the scroll-function. The os is protected mode. i have found a scroll function, but when i execute this function, my pc reboots, why ?
Thanks
Matze
Here is the function:
unsigned short crtc_adr = 0x3D4;
unsigned short offset = 80;
outportb(crtc_adr + 0, 12);
outportb(crtc_adr + 1, offset >> ;
outportb(crtc_adr + 0, 13);
outportb(crtc_adr + 1, offset & 0xFF);
Screen + Scrollen
Re:Screen + Scrollen
Hi,
where can i find source code in c, to scroll the screen, or a full printf function for my os ?
Thanks, bye
Matze
where can i find source code in c, to scroll the screen, or a full printf function for my os ?
Thanks, bye
Matze
Re:Screen + Scrollen
I've written a printf function (And a scroll function, I think)
see http://www.anemaet.nl/nitix/
see http://www.anemaet.nl/nitix/
Re:Screen + Scrollen
Hey,
i have found a scroll function. But this function works only 5 times (It scrolls 3-5 lines down) than the pc reboot. Why ?
Here is the function
i have found a scroll function. But this function works only 5 times (It scrolls 3-5 lines down) than the pc reboot. Why ?
Here is the function
Code: Select all
#define SYS_SCREEN_SEL 24
#define SYS_LINEAR_SEL 40
typedef struct {
char x, y, resx, resy, color;
}SCREEN;
SCREEN screen = {0, 0, 80, 25, 7};
void movedata(unsigned ssel, unsigned s, unsigned dsel, unsigned d, unsigned len)
{
asm(
"pushw %%ds\n"
"pushw %%ax\n"
"popw %%ds\n"
"pushw %%es\n"
"pushw %%bx\n"
"popw %%es\n"
"moveloop: \n"
"lodsb \n"
"stosb \n"
"loop moveloop\n"
"popw %%es\n"
"popw %%ds"
::"a" (ssel), "b" (dsel), "D" (d), "S" (s), "c" (len))
}
void scrollscreen()
{
BYTE i;
movedata(SYS_SCREEN_SEL, (unsigned
screen.resx*4, SYS_SCREEN_SEL, screen.resx*2, (screen.resy-2) * screen.resx * 2);
for(i = 0; i < screen.resx; i++)
{
putchar(i, screen.resy, ' ');
}
screen.y--;
setCursor(screen.x, screen.y);
}