Import backup from 2003-08-17_3

This commit is contained in:
Josh Holtrop 2003-08-17 22:02:00 -04:00
parent 9ee980bc94
commit 162e52b121
3 changed files with 90 additions and 10 deletions

View File

@ -16,6 +16,7 @@
%define BOOT_VESA_OEM 0x0004 ;258 - null-terminated OEM identification string %define BOOT_VESA_OEM 0x0004 ;258 - null-terminated OEM identification string
%define BOOT_VESA_VBE 0x0106 ;512 - copy of VESA VBEInfoBlock %define BOOT_VESA_VBE 0x0106 ;512 - copy of VESA VBEInfoBlock
%define BOOT_VESA_INFO 0x0306 ;256 - copy of VESA ModeInfoBlock for selected mode %define BOOT_VESA_INFO 0x0306 ;256 - copy of VESA ModeInfoBlock for selected mode
%define BOOT_MEGS 0x040A ;4 - dword - # of megabytes of RAM detected

View File

@ -10,6 +10,49 @@ void k_init();
#include "functions.c" #include "functions.c"
//9000:306
typedef struct{
USHORT ModeAttributes;
UCHAR WinAAttributes;
UCHAR WinBAttributes;
USHORT WinGranularity;
USHORT WinSize;
USHORT WinASegment;
USHORT WinBSegment;
UINT WinFuncPtr;
USHORT BytesPerScanLine;
USHORT XResolution;
USHORT YResolution;
UCHAR XCharSize;
UCHAR YCharSize;
UCHAR NumberOfPlanes;
UCHAR BitsPerPixel;
UCHAR NumberOfBanks;
UCHAR MemoryModel;
UCHAR BankSize;
UCHAR NumberOfImagePages;
UCHAR Reserved1;
UCHAR RedMaskSize;
UCHAR RedFieldPosition;
UCHAR GreenMaskSize;
UCHAR GreenFieldPosition;
UCHAR BlueMaskSize;
UCHAR BlueFieldPosition;
UCHAR RsvdMaskSize;
UCHAR RsvdFieldPosition;
UCHAR DirectColorModeInfo;
void *PhysBasePtr;
UINT OffScreenMemOffset;
USHORT OffScreenMemSize;
UCHAR Reserved[206];
} ModeInfoBlock;
void k_init() void k_init()
{ {
@ -19,6 +62,21 @@ void k_init()
outportb(0x40, 0x9c); //lsb outportb(0x40, 0x9c); //lsb
outportb(0x40, 0x2e); //msb outportb(0x40, 0x2e); //msb
enable_ints(); enable_ints();
ModeInfoBlock *mib = (ModeInfoBlock *) 0x90306;
UINT *vid = (UINT *) (mib->PhysBasePtr);
UINT a;
UINT tot = ((mib->XResolution) * (mib->YResolution));
for (a = 0; a < tot; a++)
{
if (a < (tot / 4))
vid[a] = 0x00FF0000;
else if (a < (tot / 2))
vid[a] = 0x0000FF00;
else if (a < ((tot * 3) / 4))
vid[a] = 0x000000FF;
else
vid[a] = 0x00FFFFFF;
}
} }
void isr(int num) void isr(int num)

View File

@ -198,11 +198,32 @@ copydisk_loop:
no_rd: no_rd:
xor ax, ax xor ax, ax
mov ds, ax mov ds, ax
mov dx, 4 ;we'll assume the system has 4 megabytes of RAM... mov edx, 4 ;we'll assume the system has 4 megabytes of RAM...
mov esi, 0x3FFFFC ;4 bytes under 4 MB mov esi, 0x3FFFFC ;4 bytes under 4 MB
ram_loop:
mov ebx, [ds:esi]
mov dword [ds:esi], "KRIS"
mov eax, [ds:esi]
mov [ds:esi], ebx
cmp eax, "KRIS"
jnz got_mem
inc edx
add esi, 0x100000
jmp ram_loop
got_mem:
mov ax, BOOT_DATA_SEG
mov ds, ax
mov [ds:BOOT_MEGS], edx
; mov ax, 0xb800
; mov es, ax
; xor di, di
; mov al, dh
; call puthex2
; mov al, dl
; call puthex2
; xor ax, ax
; int 0x16
;on to vesa info... ;on to vesa info...
xor ax, ax xor ax, ax
@ -421,13 +442,13 @@ vesa_copymodeinfo_loop:
mov [es:BOOT_VESA], dx ;store mode# for kernel mov [es:BOOT_VESA], dx ;store mode# for kernel
mov ax, 0xb800 ; mov ax, 0xb800
mov es, ax ; mov es, ax
xor di, di ; xor di, di
mov al, dh ; mov al, dh
call puthex2 ; call puthex2
mov al, dl ; mov al, dl
call puthex2 ; call puthex2
mov bx, dx mov bx, dx
or bx, 0x4000 ;set "use LFB" bit of mode# or bx, 0x4000 ;set "use LFB" bit of mode#