Import backup from 2004-02-13
This commit is contained in:
parent
2cd08dee70
commit
48f4046e79
21
asmfuncs.asm
21
asmfuncs.asm
@ -137,6 +137,27 @@ _memcpy:
|
|||||||
pop ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;copies memory of n dwords (n*4 bytes) from src to destination
|
||||||
|
;extern void memcpyd(dword dest, dword src, dword n);
|
||||||
|
[global _memcpyd]
|
||||||
|
_memcpyd:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ecx
|
||||||
|
mov edi, [ebp+8]
|
||||||
|
mov esi, [ebp+12]
|
||||||
|
mov ecx, [ebp+16]
|
||||||
|
|
||||||
|
rep movsd
|
||||||
|
|
||||||
|
pop ecx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebp
|
||||||
|
ret
|
||||||
|
|
||||||
;returns the number of characters in a string
|
;returns the number of characters in a string
|
||||||
;extern dword strlen(char *str);
|
;extern dword strlen(char *str);
|
||||||
[global _strlen]
|
[global _strlen]
|
||||||
|
@ -46,6 +46,10 @@ typedef struct {
|
|||||||
} __attribute__((packed)) qword;
|
} __attribute__((packed)) qword;
|
||||||
|
|
||||||
|
|
||||||
|
//these defines are the memory locations of values saved by the stage 2 bootloader
|
||||||
|
#define BOOT_MEMMAP_ENTRIES 0xC009040A
|
||||||
|
#define BOOT_FIRST_MEMMAP 0xC0092000
|
||||||
|
#define BOOT_VIDEO_MODE 0xC0090002
|
||||||
|
#define BOOT_VIDEO_MODE_INFO_BLOCK 0xC0090306
|
||||||
|
|
||||||
|
|
||||||
|
8
mm.c
8
mm.c
@ -3,19 +3,19 @@
|
|||||||
// Created: 09/01/03
|
// Created: 09/01/03
|
||||||
// Modified: 12/28/03
|
// Modified: 12/28/03
|
||||||
|
|
||||||
//The total amount of physical memory available (bytes)
|
//The total amount of physical memory available (bytes, 1 bit per page)
|
||||||
#define BITMAP_SIZE 0x20000
|
#define BITMAP_SIZE 0x20000
|
||||||
dword mm_totalmem = 0;
|
dword mm_totalmem = 0;
|
||||||
dword mm_megabytes;
|
dword mm_megabytes;
|
||||||
byte page_bitmap[BITMAP_SIZE]; //used to store a bit for each page that is used, 0 if available
|
byte page_bitmap[BITMAP_SIZE]; //used to store a bit for each page that is used, 0 if available
|
||||||
//0x20000*(8 bits/byte)=0x100000 pages in 4gb total
|
//0x20000*(8 bits/byte)=0x100000 pages in 4gb total
|
||||||
|
|
||||||
//This function initializes the memory manager's linked list, filling it with the
|
//This function initializes the memory manager's linked list, filling it with the
|
||||||
// memory areas returned by bios interrupt 0x8E20
|
// memory areas returned by bios interrupt 0x8E20
|
||||||
void mm_init()
|
void mm_init()
|
||||||
{
|
{
|
||||||
dword memmap_entries = *(dword *)0xC009040A;
|
dword memmap_entries = *(dword *)BOOT_MEMMAP_ENTRIES;
|
||||||
memmap_entry *maps = (memmap_entry *) 0xC0092000;
|
memmap_entry *maps = (memmap_entry *) BOOT_FIRST_MEMMAP;
|
||||||
dword a;
|
dword a;
|
||||||
for (a = 0; a < BITMAP_SIZE; a++)
|
for (a = 0; a < BITMAP_SIZE; a++)
|
||||||
{
|
{
|
||||||
|
4
video.c
4
video.c
@ -6,12 +6,12 @@
|
|||||||
//Initialized the video mode information block video_mode and allocated double-buffer memory for graphics display
|
//Initialized the video mode information block video_mode and allocated double-buffer memory for graphics display
|
||||||
void video_init()
|
void video_init()
|
||||||
{
|
{
|
||||||
videoMode = *(word *)0xC0090002;
|
videoMode = *(word *)BOOT_VIDEO_MODE;
|
||||||
|
|
||||||
if (!videoMode) //we are in console mode
|
if (!videoMode) //we are in console mode
|
||||||
return;
|
return;
|
||||||
|
|
||||||
video_mode = *(ModeInfoBlock *) 0xC0090306;
|
video_mode = *(ModeInfoBlock *) BOOT_VIDEO_MODE_INFO_BLOCK;
|
||||||
|
|
||||||
switch(video_mode.BitsPerPixel)
|
switch(video_mode.BitsPerPixel)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user