Import backup from 2003-08-19
This commit is contained in:
parent
82cf9a9de4
commit
8efede851c
5
kernel.c
5
kernel.c
@ -12,6 +12,7 @@ void k_init();
|
||||
#include "functions.c"
|
||||
#include "video.c"
|
||||
|
||||
dword timer = 0;
|
||||
|
||||
void k_init()
|
||||
{
|
||||
@ -28,12 +29,16 @@ void k_init()
|
||||
video_horiz(a, 2, 1021, 0);
|
||||
video_vert(a, 2, 765, 0x0000FFFF);
|
||||
}
|
||||
video_rect(10, 10, 100, 100, 0x00FFFFFF);
|
||||
video_rectf(11, 11, 99, 99, 0x00FFFF00);
|
||||
}
|
||||
|
||||
void isr(dword num)
|
||||
{
|
||||
if (num == 0x20)
|
||||
{
|
||||
timer++;
|
||||
video_rect(20,20,600,600,timer);
|
||||
(*(char*)0xB8000)++;
|
||||
*(char*)0xB8001 = 7;
|
||||
eoi();
|
||||
|
@ -619,8 +619,8 @@ vesa_modenogood:
|
||||
;------------------------------------------------------
|
||||
vesa_done:
|
||||
|
||||
xor ax, ax ;wait for keypress...
|
||||
int 0x16
|
||||
; xor ax, ax ;wait for keypress...
|
||||
; int 0x16
|
||||
|
||||
jmp go_pm
|
||||
|
||||
|
53
video.c
53
video.c
@ -77,6 +77,53 @@ void video_vert(int x, int y1, int y2, dword color)
|
||||
}
|
||||
}
|
||||
|
||||
void video_rect(int x1, int y1, int x2, int y2, dword color)
|
||||
{
|
||||
checkBoundsx(x1);
|
||||
checkBoundsx(x2);
|
||||
checkBoundsy(y1);
|
||||
checkBoundsy(y2);
|
||||
if (x2 < x1)
|
||||
{
|
||||
int tmp = x2;
|
||||
x2 = x1;
|
||||
x1 = tmp;
|
||||
}
|
||||
if (y2 < y1)
|
||||
{
|
||||
int tmp = y2;
|
||||
y2 = y1;
|
||||
y1 = tmp;
|
||||
}
|
||||
video_horiz(y1, x1, x2, color);
|
||||
video_horiz(y2, x1, x2, color);
|
||||
video_vert(x1, y1, y2, color);
|
||||
video_vert(x2, y1, y2, color);
|
||||
}
|
||||
|
||||
void video_rectf(int x1, int y1, int x2, int y2, dword color)
|
||||
{
|
||||
checkBoundsx(x1);
|
||||
checkBoundsx(x2);
|
||||
checkBoundsy(y1);
|
||||
checkBoundsy(y2);
|
||||
if (x2 < x1)
|
||||
{
|
||||
int tmp = x2;
|
||||
x2 = x1;
|
||||
x1 = tmp;
|
||||
}
|
||||
if (y2 < y1)
|
||||
{
|
||||
int tmp = y2;
|
||||
y2 = y1;
|
||||
y1 = tmp;
|
||||
}
|
||||
int a;
|
||||
for (a = 0; a <= (y2-y1); a++)
|
||||
video_horiz(y1+a, x1, x2, color);
|
||||
}
|
||||
|
||||
inline void video_pset(int x, int y, dword color)
|
||||
{
|
||||
video_psetp(y*video_mode.XResolution+x, color);
|
||||
@ -91,9 +138,9 @@ void video_psetp(int pixel, dword color)
|
||||
//vid_ptr16[pixel] = ((color&0xFF)>>3) | ((((color>>8)&0xFF)>>3)<<5) | ((((color>>16)&0xFF)>>3)<<10);
|
||||
break;
|
||||
case 24:
|
||||
vid_ptr24[pixel] = (color>>16) & 0xFF;
|
||||
vid_ptr24[pixel+1] = (color>>8) & 0xFF;
|
||||
vid_ptr24[pixel+2] = color & 0xFF;
|
||||
vid_ptr24[pixel*3] = color & 0xFF;
|
||||
vid_ptr24[pixel*3+1] = (color>>8) & 0xFF;
|
||||
vid_ptr24[pixel*3+2] = (color>>16) & 0xFF;
|
||||
break;
|
||||
case 32:
|
||||
vid_ptr32[pixel] = color;
|
||||
|
3
video.h
3
video.h
@ -4,9 +4,12 @@
|
||||
void video_init();
|
||||
void video_horiz(int y, int x1, int x2, dword color);
|
||||
void video_vert(int x, int y1, int y2, dword color);
|
||||
void video_rect(int x1, int y1, int x2, int y2, dword color);
|
||||
void video_rectf(int x1, int y1, int x2, int y2, dword color);
|
||||
inline void video_pset(int x, int y, dword color);
|
||||
void video_psetp(int pixel, dword color);
|
||||
|
||||
|
||||
#define checkBoundsx(x) (x<0 ? x=0 : (x>=video_mode.XResolution ? x=video_mode.XResolution-1 : 0))
|
||||
#define checkBoundsy(x) (x<0 ? x=0 : (x>=video_mode.YResolution ? x=video_mode.YResolution-1 : 0))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user