Import backup from 2003-11-12
This commit is contained in:
parent
294b4b0e27
commit
70d6bb1eb3
86
asmfuncs.asm
86
asmfuncs.asm
@ -2,13 +2,10 @@
|
|||||||
; Josh Holtrop
|
; Josh Holtrop
|
||||||
; 10/23/03
|
; 10/23/03
|
||||||
|
|
||||||
[global _write_cr0]
|
|
||||||
[global _read_cr0]
|
|
||||||
[global _write_cr3]
|
|
||||||
[global _read_cr3]
|
|
||||||
|
|
||||||
;stores the parameter to the CR0 register
|
;stores the parameter to the CR0 register
|
||||||
;extern dword write_cr0(dword cr0);
|
;extern dword write_cr0(dword cr0);
|
||||||
|
[global _write_cr0]
|
||||||
_write_cr0:
|
_write_cr0:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
@ -19,12 +16,14 @@ _write_cr0:
|
|||||||
|
|
||||||
;returns the value in the CR0 register
|
;returns the value in the CR0 register
|
||||||
;extern dword read_cr0();
|
;extern dword read_cr0();
|
||||||
|
[global _read_cr0]
|
||||||
_read_cr0:
|
_read_cr0:
|
||||||
mov eax, cr0;
|
mov eax, cr0;
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;stores the parameter to the CR3 register
|
;stores the parameter to the CR3 register
|
||||||
;extern dword write_cr3(dword cr3);
|
;extern dword write_cr3(dword cr3);
|
||||||
|
[global _write_cr3]
|
||||||
_write_cr3:
|
_write_cr3:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
@ -35,11 +34,90 @@ _write_cr3:
|
|||||||
|
|
||||||
;returns the value in the CR3 register
|
;returns the value in the CR3 register
|
||||||
;extern dword read_cr3();
|
;extern dword read_cr3();
|
||||||
|
[global _read_cr3]
|
||||||
_read_cr3:
|
_read_cr3:
|
||||||
mov eax, cr3;
|
mov eax, cr3;
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;copies 32bpp video buffer memory to LFB
|
||||||
|
;extern dword video_copyBuffer32(dword src, dword dest, dword pixelcount);
|
||||||
|
[global _video_copyBuffer32]
|
||||||
|
_video_copyBuffer32:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ecx
|
||||||
|
mov esi, [ebp+8]
|
||||||
|
mov edi, [ebp+12]
|
||||||
|
mov ecx, [ebp+16]
|
||||||
|
rep movsd
|
||||||
|
pop ecx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;copies 24bpp video buffer memory to LFB
|
||||||
|
;extern dword video_copyBuffer24(dword src, dword dest, dword pixelcount);
|
||||||
|
[global _video_copyBuffer24]
|
||||||
|
_video_copyBuffer24:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ecx
|
||||||
|
mov esi, [ebp+8]
|
||||||
|
mov edi, [ebp+12]
|
||||||
|
mov ecx, [ebp+16]
|
||||||
|
_video_copyBuffer24_loop:
|
||||||
|
movsd
|
||||||
|
dec edi
|
||||||
|
loop _video_copyBuffer24_loop
|
||||||
|
pop ecx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;copies 16bpp video buffer memory to LFB
|
||||||
|
;extern dword video_copyBuffer16(dword src, dword dest, dword pixelcount);
|
||||||
|
[global _video_copyBuffer16]
|
||||||
|
_video_copyBuffer16:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ecx
|
||||||
|
push ebx
|
||||||
|
mov esi, [ebp+8]
|
||||||
|
mov edi, [ebp+12]
|
||||||
|
mov ecx, [ebp+16]
|
||||||
|
_video_copyBuffer16_loop:
|
||||||
|
lodsd ;eax = 32bpp color
|
||||||
|
shr eax, 3
|
||||||
|
mov ebx, eax
|
||||||
|
and ebx, 0x1F
|
||||||
|
shr eax, 2
|
||||||
|
and eax, 0xFFFFFFE0
|
||||||
|
or ebx, eax
|
||||||
|
and ebx, 0x7FF
|
||||||
|
shr eax, 3
|
||||||
|
and eax, 0xF800
|
||||||
|
or ebx, eax
|
||||||
|
mov eax, ebx
|
||||||
|
stosw ;store ax
|
||||||
|
loop _video_copyBuffer16_loop
|
||||||
|
pop ebx
|
||||||
|
pop ecx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
6
kernel.c
6
kernel.c
@ -1,8 +1,8 @@
|
|||||||
//kernel.c
|
//kernel.c
|
||||||
//08/13/03 Josh Holtrop
|
//08/13/03 Josh Holtrop
|
||||||
//Holtrop's Operating System
|
//Holtrop's Operating System
|
||||||
//Version: 0.1.2
|
//Version: 0.12
|
||||||
//Modified: 10/30/03
|
//Modified: 11/12/03
|
||||||
|
|
||||||
#include "k_defines.h" //#DEFINE's for kernel
|
#include "k_defines.h" //#DEFINE's for kernel
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ void k_init()
|
|||||||
enable_ints();
|
enable_ints();
|
||||||
kbd_resetLEDs(); //after enabling interrupts!!
|
kbd_resetLEDs(); //after enabling interrupts!!
|
||||||
|
|
||||||
printf("HOS 0.1.2 - Kernel Size: %d kb\n", kernel_size()/1024);
|
printf("HOS 0.12 - Kernel Size: %d kb\n", kernel_size()/1024);
|
||||||
printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem);
|
printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem);
|
||||||
printf("Freem memory: %d bytes\n", mm_freemem());
|
printf("Freem memory: %d bytes\n", mm_freemem());
|
||||||
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
nasmw -f aout -l io.lst io.asm -o io_a.o
|
nasmw -f aout -l io.lst io.asm -o io_a.o
|
||||||
|
nasmw -f aout -l misc.lst misc.asm -o misc.o
|
||||||
|
25
lib/misc.asm
Normal file
25
lib/misc.asm
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;void memcpy(dword src, dword dest, dword length)
|
||||||
|
[global _memcpy]
|
||||||
|
_memcpy:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ecx
|
||||||
|
mov esi, [ebp+8]
|
||||||
|
mov edi, [ebp+12]
|
||||||
|
mov ecx, [ebp+14]
|
||||||
|
|
||||||
|
rep movsb
|
||||||
|
|
||||||
|
pop ecx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
8
lib/misc.h
Normal file
8
lib/misc.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
#ifndef __HMISC_H__
|
||||||
|
#define __HMISC_H__ __HMISC_H__
|
||||||
|
|
||||||
|
void memcpy(dword src, dword dest, dword length);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -28,7 +28,7 @@ brDrive DB 0 ; 0024h - Physical drive no.
|
|||||||
DB 0 ; 0025h - Reserved (FAT32)
|
DB 0 ; 0025h - Reserved (FAT32)
|
||||||
DB 29H ; 0026h - Extended boot record sig (FAT32)
|
DB 29H ; 0026h - Extended boot record sig (FAT32)
|
||||||
brSerialNum DD 404418EAH ; 0027h - Volume serial number
|
brSerialNum DD 404418EAH ; 0027h - Volume serial number
|
||||||
brLabel DB 'HOS 0.1.1 ' ; 002Bh - Volume label
|
brLabel DB 'Holtrops OS' ; 002Bh - Volume label
|
||||||
brFSID DB 'FAT12 ' ; 0036h - File System ID
|
brFSID DB 'FAT12 ' ; 0036h - File System ID
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
|
|
||||||
|
18
video.c
18
video.c
@ -31,7 +31,7 @@ void video_init(ModeInfoBlock *mib)
|
|||||||
|
|
||||||
int VXR = video_mode.XResolution;
|
int VXR = video_mode.XResolution;
|
||||||
int VYR = video_mode.YResolution;
|
int VYR = video_mode.YResolution;
|
||||||
|
|
||||||
video_rectf(VXR*3/11, 0, VXR*4/11, VYR-1, 0x00000088); //test rectangles, draws "HOS"
|
video_rectf(VXR*3/11, 0, VXR*4/11, VYR-1, 0x00000088); //test rectangles, draws "HOS"
|
||||||
video_rectf(VXR*7/11, 0, VXR*8/11, VYR-1, 0x00000088);
|
video_rectf(VXR*7/11, 0, VXR*8/11, VYR-1, 0x00000088);
|
||||||
video_rectf(VXR/11, 0, VXR*2/11, VYR*2/5, 0x00000088);
|
video_rectf(VXR/11, 0, VXR*2/11, VYR*2/5, 0x00000088);
|
||||||
@ -141,7 +141,19 @@ inline void video_pset(int x, int y, dword color)
|
|||||||
//Copies double-buffer to VESA Linear Frame Buffer
|
//Copies double-buffer to VESA Linear Frame Buffer
|
||||||
void video_copyBuffer()
|
void video_copyBuffer()
|
||||||
{
|
{
|
||||||
int pixel;
|
switch (video_mode.BitsPerPixel)
|
||||||
|
{
|
||||||
|
case 32:
|
||||||
|
video_copyBuffer32((dword)vid_Buffer, video_mode.PhysBasePtr, video_mode.XResolution*video_mode.YResolution);
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
video_copyBuffer24((dword)vid_Buffer, video_mode.PhysBasePtr, video_mode.XResolution*video_mode.YResolution);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
video_copyBuffer16((dword)vid_Buffer, video_mode.PhysBasePtr, video_mode.XResolution*video_mode.YResolution);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*int pixel;
|
||||||
dword color;
|
dword color;
|
||||||
for (pixel = 0; pixel < video_mode.XResolution*video_mode.YResolution; pixel++)
|
for (pixel = 0; pixel < video_mode.XResolution*video_mode.YResolution; pixel++)
|
||||||
{
|
{
|
||||||
@ -162,7 +174,7 @@ void video_copyBuffer()
|
|||||||
color = vid_Buffer[pixel];
|
color = vid_Buffer[pixel];
|
||||||
((dword *)video_mode.PhysBasePtr)[pixel] = color;
|
((dword *)video_mode.PhysBasePtr)[pixel] = color;
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
3
video.h
3
video.h
@ -11,6 +11,9 @@ inline void video_pset(int x, int y, dword color);
|
|||||||
void video_psetp(int pixel, dword color);
|
void video_psetp(int pixel, dword color);
|
||||||
void video_copyBuffer();
|
void video_copyBuffer();
|
||||||
|
|
||||||
|
extern dword video_copyBuffer16(dword src, dword dest, dword pixelcount);
|
||||||
|
extern dword video_copyBuffer24(dword src, dword dest, dword pixelcount);
|
||||||
|
extern dword video_copyBuffer32(dword src, dword dest, dword pixelcount);
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
word ModeAttributes;
|
word ModeAttributes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user