Import backup from 2004-03-02
This commit is contained in:
1 parent
48f4046e79
commit
0b9d7fde22
67 files changed
+3199
-3080
No files matched your search
@@ -0,0 +1,470 @@
|
||||
; asmfuncs.asm
|
||||
; Josh Holtrop
|
||||
; Created: 10/23/03
|
||||
; Modified: 02/26/04
|
||||
|
||||
[extern _putc]
|
||||
[extern _console_memory]
|
||||
[extern _cursorPosition]
|
||||
[extern _video_drawConsole]
|
||||
[extern _videoMode]
|
||||
|
||||
%macro jzfar 1
|
||||
jnz %%skip
|
||||
jmp %1
|
||||
%%skip:
|
||||
|
||||
%endmacro
|
||||
|
||||
;stores the parameter to the CR0 register
|
||||
;extern dword write_cr0(dword cr0);
|
||||
[global _write_cr0]
|
||||
_write_cr0:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, [ebp+8]
|
||||
mov cr0, eax
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
;returns the value in the CR0 register
|
||||
;extern dword read_cr0();
|
||||
[global _read_cr0]
|
||||
_read_cr0:
|
||||
mov eax, cr0;
|
||||
ret
|
||||
|
||||
;stores the parameter to the CR3 register
|
||||
;extern dword write_cr3(dword cr3);
|
||||
[global _write_cr3]
|
||||
_write_cr3:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, [ebp+8]
|
||||
mov cr3, eax
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
|
||||
;returns the value in the CR2 register
|
||||
;extern dword read_cr2();
|
||||
[global _read_cr2]
|
||||
_read_cr2:
|
||||
mov eax, cr2;
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;returns the value in the CR3 register
|
||||
;extern dword read_cr3();
|
||||
[global _read_cr3]
|
||||
_read_cr3:
|
||||
mov eax, cr3;
|
||||
ret
|
||||
|
||||
|
||||
;compares one string to another
|
||||
;returns 0 if the strings are different
|
||||
;extern dword strcmp(char *str1, char *str2);
|
||||
[global _strcmp]
|
||||
_strcmp:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov esi, [ebp+8]
|
||||
mov edi, [ebp+12]
|
||||
strcmp_loop1:
|
||||
lodsb
|
||||
mov ah, [edi]
|
||||
inc edi
|
||||
cmp ah, al
|
||||
jnz strcmp_ne
|
||||
or al, al
|
||||
jz strcmp_e
|
||||
jmp strcmp_loop1
|
||||
strcmp_e:
|
||||
mov eax, 1
|
||||
jmp short strcmp_done
|
||||
strcmp_ne:
|
||||
xor eax, eax
|
||||
strcmp_done:
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
;copies a string from the source to the destination parameter
|
||||
;extern void strcpy(char *dest, char *src);
|
||||
[global _strcpy]
|
||||
_strcpy:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push esi
|
||||
push edi
|
||||
mov edi, [ebp+8]
|
||||
mov esi, [ebp+12]
|
||||
strcpyloop:
|
||||
lodsb
|
||||
stosb
|
||||
or al, al
|
||||
jnz strcpyloop
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
;copies memory of n bytes from src to destination
|
||||
;extern void memcpy(dword dest, dword src, dword n);
|
||||
[global _memcpy]
|
||||
_memcpy:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push esi
|
||||
push edi
|
||||
push ecx
|
||||
mov edi, [ebp+8]
|
||||
mov esi, [ebp+12]
|
||||
mov ecx, [ebp+16]
|
||||
|
||||
rep movsb
|
||||
|
||||
pop ecx
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
;returns the number of characters in a string
|
||||
;extern dword strlen(char *str);
|
||||
[global _strlen]
|
||||
_strlen:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push esi
|
||||
push ebx
|
||||
mov esi, [ebp+8]
|
||||
xor ebx, ebx
|
||||
strlenloop:
|
||||
lodsb
|
||||
or al, al
|
||||
jz strlendone
|
||||
inc ebx
|
||||
jmp strlenloop
|
||||
strlendone:
|
||||
mov eax, ebx
|
||||
pop ebx
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
;this function invalidates the page directory/table entry that
|
||||
; would be used to access the memory address given in the parameter
|
||||
;extern void invlpg(dword addr);
|
||||
[global _invlpg]
|
||||
_invlpg:
|
||||
mov eax, [esp+4]
|
||||
invlpg [eax]
|
||||
ret
|
||||
|
||||
|
||||
;
|
||||
;void writeCursorPosition(word pos)
|
||||
;
|
||||
[global _writeCursorPosition]
|
||||
_writeCursorPosition:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push edx
|
||||
|
||||
mov eax, [ebp+8] ;cursor position in ax
|
||||
|
||||
mov bl, al
|
||||
mov dx, 0x03D4
|
||||
mov al, 0x0E
|
||||
out dx, al
|
||||
|
||||
inc dx
|
||||
mov al, ah
|
||||
out dx, al
|
||||
|
||||
dec dx
|
||||
mov al, 0x0F
|
||||
out dx, al
|
||||
|
||||
inc dx
|
||||
mov al, bl
|
||||
out dx, al
|
||||
|
||||
pop edx
|
||||
pop ebx
|
||||
pop eax
|
||||
pop ebp
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;
|
||||
;word getCursorPosition()
|
||||
;
|
||||
[global _getCursorPosition]
|
||||
_getCursorPosition:
|
||||
push ebx
|
||||
push edx
|
||||
|
||||
xor eax, eax
|
||||
mov dx, 0x03D4
|
||||
mov al, 0x0E
|
||||
out dx, al
|
||||
|
||||
inc dx
|
||||
in al, dx
|
||||
mov bl, al
|
||||
|
||||
dec dx
|
||||
mov al, 0x0F
|
||||
out dx, al
|
||||
|
||||
inc dx
|
||||
in al, dx
|
||||
mov ah, bl
|
||||
|
||||
pop edx
|
||||
pop ebx
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;
|
||||
;void console_scroll()
|
||||
;
|
||||
[global _console_scroll]
|
||||
_console_scroll:
|
||||
pusha
|
||||
mov esi, _console_memory+160
|
||||
mov edi, _console_memory
|
||||
mov ecx, 960 ;(2000-80)/2
|
||||
rep movsd
|
||||
mov ax, 0x0720
|
||||
mov ecx, 80
|
||||
rep stosw
|
||||
mov esi, _console_memory
|
||||
mov edi, 0xC00B8000
|
||||
mov ecx, 1000
|
||||
rep movsd
|
||||
mov eax, [_videoMode]
|
||||
cmp eax, 0
|
||||
jz _console_scroll_end
|
||||
call _video_drawConsole
|
||||
_console_scroll_end:
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;
|
||||
;void console_cls()
|
||||
;
|
||||
[global _console_cls]
|
||||
_console_cls:
|
||||
pusha
|
||||
mov edi, _console_memory
|
||||
mov ax, 0x0720
|
||||
mov ecx, 2000
|
||||
rep stosw
|
||||
push dword 0
|
||||
call _writeCursorPosition
|
||||
add esp, 4
|
||||
mov [_cursorPosition], dword 0
|
||||
mov esi, _console_memory
|
||||
mov edi, 0xC00B8000
|
||||
mov ecx, 1000
|
||||
rep movsd
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
;int puts(char *str)
|
||||
;
|
||||
[global _puts]
|
||||
_puts:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push esi
|
||||
push eax
|
||||
mov esi, [ebp+8] ;esi = to string
|
||||
puts_loop:
|
||||
lodsb
|
||||
cmp al, 0
|
||||
jz puts_done
|
||||
push eax
|
||||
call _putc
|
||||
add esp, 4
|
||||
jmp puts_loop
|
||||
|
||||
puts_done:
|
||||
pop eax
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
[global _putDecu]
|
||||
_putDecu:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
sub esp, 24
|
||||
mov DWORD [ebp-4], 1
|
||||
mov BYTE [ebp-5], 0
|
||||
L2:
|
||||
mov edx, DWORD [ebp+8]
|
||||
mov eax, -858993459
|
||||
mul edx
|
||||
mov eax, edx
|
||||
shr eax, 3
|
||||
cmp eax, DWORD [ebp-4]
|
||||
jae L4
|
||||
jmp L3
|
||||
L4:
|
||||
mov eax, DWORD [ebp-4]
|
||||
mov edx, eax
|
||||
sal edx, 2
|
||||
add edx, eax
|
||||
lea eax, [edx+edx]
|
||||
mov DWORD [ebp-4], eax
|
||||
jmp L2
|
||||
L3:
|
||||
nop
|
||||
L5:
|
||||
cmp DWORD [ebp-4], 1
|
||||
ja L7
|
||||
jmp L6
|
||||
L7:
|
||||
mov edx, DWORD [ebp+8]
|
||||
mov eax, edx
|
||||
mov edx, 0
|
||||
div DWORD [ebp-4]
|
||||
mov DWORD [ebp-12], eax
|
||||
mov al, BYTE [ebp-12]
|
||||
mov BYTE [ebp-5], al
|
||||
mov eax, 0
|
||||
mov al, BYTE [ebp-5]
|
||||
imul eax, DWORD [ebp-4]
|
||||
sub DWORD [ebp+8], eax
|
||||
mov edx, DWORD [ebp-4]
|
||||
mov eax, -858993459
|
||||
mul edx
|
||||
mov eax, edx
|
||||
shr eax, 3
|
||||
mov DWORD [ebp-4], eax
|
||||
lea eax, [ebp-5]
|
||||
add BYTE [eax], 48
|
||||
sub esp, 12
|
||||
mov eax, 0
|
||||
mov al, BYTE [ebp-5]
|
||||
push eax
|
||||
call _putc
|
||||
add esp, 16
|
||||
jmp L5
|
||||
L6:
|
||||
sub esp, 12
|
||||
mov al, BYTE [ebp+8]
|
||||
add eax, 48
|
||||
and eax, 255
|
||||
push eax
|
||||
call _putc
|
||||
add esp, 16
|
||||
leave
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
[global _putDec]
|
||||
_putDec:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
sub esp, 24
|
||||
cmp DWORD [ebp+8], 0
|
||||
jns L9
|
||||
sub esp, 12
|
||||
push 45
|
||||
call _putc
|
||||
add esp, 16
|
||||
neg DWORD [ebp+8]
|
||||
L9:
|
||||
mov DWORD [ebp-4], 1
|
||||
mov BYTE [ebp-5], 0
|
||||
L10:
|
||||
mov eax, DWORD [ebp+8]
|
||||
cmp eax, DWORD [ebp-4]
|
||||
jae L12
|
||||
jmp L11
|
||||
L12:
|
||||
mov eax, DWORD [ebp-4]
|
||||
mov edx, eax
|
||||
sal edx, 2
|
||||
add edx, eax
|
||||
lea eax, [edx+edx]
|
||||
mov DWORD [ebp-4], eax
|
||||
jmp L10
|
||||
L11:
|
||||
mov edx, DWORD [ebp-4]
|
||||
mov eax, -858993459
|
||||
mul edx
|
||||
mov eax, edx
|
||||
shr eax, 3
|
||||
mov DWORD [ebp-4], eax
|
||||
L13:
|
||||
cmp DWORD [ebp-4], 1
|
||||
ja L15
|
||||
jmp L14
|
||||
L15:
|
||||
mov edx, DWORD [ebp+8]
|
||||
mov eax, edx
|
||||
mov edx, 0
|
||||
div DWORD [ebp-4]
|
||||
mov DWORD [ebp-12], eax
|
||||
mov al, BYTE [ebp-12]
|
||||
mov BYTE [ebp-5], al
|
||||
mov eax, 0
|
||||
mov al, BYTE [ebp-5]
|
||||
imul eax, DWORD [ebp-4]
|
||||
sub DWORD [ebp+8], eax
|
||||
mov edx, DWORD [ebp-4]
|
||||
mov eax, -858993459
|
||||
mul edx
|
||||
mov eax, edx
|
||||
shr eax, 3
|
||||
mov DWORD [ebp-4], eax
|
||||
lea eax, [ebp-5]
|
||||
add BYTE [eax], 48
|
||||
sub esp, 12
|
||||
mov eax, 0
|
||||
mov al, BYTE [ebp-5]
|
||||
push eax
|
||||
call _putc
|
||||
add esp, 16
|
||||
jmp L13
|
||||
L14:
|
||||
sub esp, 12
|
||||
mov al, BYTE [ebp+8]
|
||||
add eax, 48
|
||||
and eax, 255
|
||||
push eax
|
||||
call _putc
|
||||
add esp, 16
|
||||
leave
|
||||
ret
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// asmfuncs.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
|
||||
#ifndef __HOS_ASMFUNCS__
|
||||
#define __HOS_ASMFUNCS__ __HOS_ASMFUNCS__
|
||||
|
||||
dword write_cr0(dword cr0);
|
||||
dword read_cr0();
|
||||
dword write_cr3(dword cr3);
|
||||
dword read_cr2();
|
||||
dword read_cr3();
|
||||
void writeCursorPosition(dword pos);
|
||||
dword getCursorPosition();
|
||||
void console_scroll();
|
||||
void console_cls();
|
||||
int puts(char *str);
|
||||
int putDec(int number);
|
||||
int putDecu(dword number);
|
||||
void strcpy(char *dest, char *src);
|
||||
void memcpy(void *dest, void *src, dword n);
|
||||
dword strlen(char *str);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
//fdc.c
|
||||
//Author: Josh Holtrop
|
||||
//Created: 10/30/03
|
||||
//Modified: 02/26/04
|
||||
|
||||
#include "fdc.h"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//fdc.h
|
||||
//Author: Josh Holtrop
|
||||
//Date: 10/30/03
|
||||
//Modified: 02/26/04
|
||||
|
||||
#ifndef __HOS_FDC__
|
||||
#define __HOS_FDC__ __HOS_FDC__
|
||||
|
||||
#define FDC_DOR 0x3f2
|
||||
#define FDC_MSR 0x3f4
|
||||
|
||||
inline void fdc_sendDOR(byte dor);
|
||||
|
||||
inline void fdc_sendDOR(byte dor)
|
||||
{
|
||||
outportb(FDC_DOR, dor);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
// keyboard.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 04/17/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#define KBD_BUFFER_LENGTH 64
|
||||
|
||||
byte kbdFlags = 0; //holds current keyboard flags - caps/num/scroll/shift/ctrl/alt
|
||||
byte kbdAscii = 0; //holds ASCII value of a key pressed
|
||||
byte kbdScan = 0; //holds the keyboard scan code of a key pressed
|
||||
|
||||
dword kbdBuffer[KBD_BUFFER_LENGTH]; //a buffer for all keypresses
|
||||
int kbdBufferStart = 0; //position of next key in buffer
|
||||
int kbdBufferLen = 0; //number of keys left in the buffer
|
||||
byte kbdExt = 0; //# of extended key codes left to input
|
||||
byte kbdExt2 = 0; //# of 2nd-set-extended key codes left to input
|
||||
byte ackReason = 0; //used to record the reason why we would get an acknowledge byte (0xFA)
|
||||
|
||||
|
||||
//these arrays convert a keyboard scan code to an ASCII character value
|
||||
//nul esc bksp tab lctl lsft rsft lalt caps F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 numScrlNumPad------- unknown---- F11 F12 unknown....
|
||||
const byte SCAN2ASCII[128] = "\000\0331234567890-=\010\011qwertyuiop[]\n\001asdfghjkl;'`\001\\zxcvbnm,./\001*\001 \001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001-\001\001\001+\001\001\001\001\001\002\002\002\001\001\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002";
|
||||
const byte SCAN2ASCIISHIFT[128] = "\000\033!@#$%^&*()_+\010\011QWERTYUIOP{}\n\001ASDFGHJKL:\"~\001|ZXCVBNM<>?\001*\001 \001\001\001\001\001\001\001\001\001\001\001\001\001789-456+1230.\002\002\002\001\001\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002";
|
||||
|
||||
//====FUNCTIONS:
|
||||
// The Keyboard Interrupt Service Routine
|
||||
void isr_keyboard()
|
||||
{
|
||||
kbdScan = inportb(0x60);
|
||||
//printf("\nKEYBOARD INTERRUPT: 0x%x", kbdScan);
|
||||
byte inState = inportb(0x61);
|
||||
outportb(0x61, inState|0x80);
|
||||
outportb(0x61, inState);
|
||||
|
||||
//printf("IRQ 1: %x\n", kbdScan);
|
||||
|
||||
if (kbdScan == 0xFA) //250 //ACKnowledge
|
||||
{
|
||||
//printf("KBD_ACK 0x%x!\n", ackReason);
|
||||
if (ackReason == 0xED) //reset LEDs
|
||||
{
|
||||
outportb(0x60, (kbdFlags & 0x07));
|
||||
}
|
||||
ackReason = 0;
|
||||
}
|
||||
if (kbdScan == 224) //extended key
|
||||
{
|
||||
kbdExt = 1;
|
||||
eoi();
|
||||
return;
|
||||
}
|
||||
if (kbdScan == 225) //2nd-set-extended key
|
||||
{
|
||||
kbdExt2 = 2;
|
||||
eoi();
|
||||
return;
|
||||
}
|
||||
|
||||
//====handle control keys::
|
||||
kbdAscii = 2;
|
||||
switch (kbdScan) //control keys
|
||||
{
|
||||
case KBD_SCAN_LSHIFT:
|
||||
kbdFlags |= KBD_SHIFT;
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
case KBD_SCAN_RSHIFT:
|
||||
kbdFlags |= KBD_SHIFT;
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
case KBD_SCAN_LCTRL:
|
||||
kbdFlags |= KBD_CTRL;
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
case KBD_SCAN_LALT:
|
||||
kbdFlags |= KBD_ALT;
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
|
||||
case KBD_SCAN_LSHIFT + KBD_SCAN_RELEASED:
|
||||
kbdFlags &= (KBD_SHIFT ^ 0xFF);
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
case KBD_SCAN_RSHIFT + KBD_SCAN_RELEASED:
|
||||
kbdFlags &= (KBD_SHIFT ^ 0xFF);
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
case KBD_SCAN_LCTRL + KBD_SCAN_RELEASED:
|
||||
kbdFlags &= (KBD_CTRL ^ 0xFF);
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
case KBD_SCAN_LALT + KBD_SCAN_RELEASED:
|
||||
kbdFlags &= (KBD_ALT ^ 0xFF);
|
||||
kbdAscii = 1;
|
||||
break;
|
||||
|
||||
case KBD_SCAN_CAPS+KBD_SCAN_RELEASED:
|
||||
kbdFlags ^= KBD_CAPS;
|
||||
kbdAscii = 1;
|
||||
kbd_resetLEDs(); //update LEDs
|
||||
break;
|
||||
case KBD_SCAN_SCROLL+KBD_SCAN_RELEASED:
|
||||
kbdFlags ^= KBD_SCROLL;
|
||||
kbdAscii = 1;
|
||||
kbd_resetLEDs(); //update LEDs
|
||||
break;
|
||||
case KBD_SCAN_NUM+KBD_SCAN_RELEASED:
|
||||
kbdFlags ^= KBD_NUM;
|
||||
kbdAscii = 1;
|
||||
kbd_resetLEDs(); //update LEDs
|
||||
break;
|
||||
}
|
||||
if (kbdAscii == 1)
|
||||
{
|
||||
if (kbdExt > 0)
|
||||
kbdExt--;
|
||||
eoi();
|
||||
return;
|
||||
}
|
||||
//====determine ASCII value of key::
|
||||
if (kbdExt > 0) //extended key, kbdScan holds extended key
|
||||
{
|
||||
kbdExt--;
|
||||
kbdAscii = 1;
|
||||
switch (kbdScan)
|
||||
{
|
||||
case KBD_SCANE_ENTER:
|
||||
kbdAscii = '\n'; break;
|
||||
case 53: // '/' character (divide on numpad)
|
||||
kbdAscii = '/'; break;
|
||||
}
|
||||
}
|
||||
else if (kbdExt2 > 0) //extended key 2
|
||||
{
|
||||
kbdExt2--;
|
||||
// if (kbdScan == 69) // (pause|break)
|
||||
// kbdAscii = 2; //flag ascii value of 1 means control character (pausebreak)
|
||||
// else
|
||||
kbdAscii = 2; //flag ascii value of 2 means ignore key (or unknown value)
|
||||
}
|
||||
else //not an extended key
|
||||
{
|
||||
// if letter key
|
||||
if (((kbdScan >= 16) && (kbdScan <= 25)) || ((kbdScan >= 30) && (kbdScan <= 38)) || ((kbdScan >= 44) && (kbdScan <= 50)))
|
||||
{
|
||||
// if caps and shift are different (either one pressed, not both)
|
||||
if (((kbdFlags & KBD_SHIFT) != 0) & ((kbdFlags & KBD_CAPS) != 0))
|
||||
kbdAscii = SCAN2ASCII[kbdScan & 0x7F];
|
||||
else if (((kbdFlags & KBD_SHIFT) == 0) & ((kbdFlags & KBD_CAPS) == 0))
|
||||
kbdAscii = SCAN2ASCII[kbdScan & 0x7F];
|
||||
else
|
||||
kbdAscii = SCAN2ASCIISHIFT[kbdScan & 0x7F];
|
||||
}
|
||||
// if numpad key
|
||||
else if ((kbdScan >= 71) && (kbdScan <= 83))
|
||||
{
|
||||
// if numlock on
|
||||
if (kbdFlags & KBD_NUM)
|
||||
kbdAscii = SCAN2ASCIISHIFT[kbdScan & 0x7F];
|
||||
else
|
||||
kbdAscii = SCAN2ASCII[kbdScan & 0x7F];
|
||||
}
|
||||
// other key
|
||||
else
|
||||
{
|
||||
if ((kbdFlags & KBD_SHIFT) != 0)
|
||||
kbdAscii = SCAN2ASCIISHIFT[kbdScan & 0x7F];
|
||||
else
|
||||
kbdAscii = SCAN2ASCII[kbdScan & 0x7F];
|
||||
}
|
||||
}
|
||||
|
||||
//====do something with key::
|
||||
// printf("kbdScan == %d\nkbdAscii == %d\nkbdFlags == %d\n", kbdScan, kbdAscii, kbdFlags);
|
||||
if ((kbdScan == 83) && (kbdFlags & KBD_CTRL) && (kbdFlags & KBD_ALT))
|
||||
{
|
||||
printf("Initiating reboot.");
|
||||
restart();
|
||||
}
|
||||
if (kbdAscii == 2) //unknown key / ignore key
|
||||
{
|
||||
eoi();
|
||||
return;
|
||||
}
|
||||
if (kbdScan < KBD_SCAN_RELEASED) //a key was pressed, save it
|
||||
{
|
||||
if (kbdBufferLen >= KBD_BUFFER_LENGTH) //no key slots available
|
||||
{
|
||||
eoi();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
kbdBuffer[(kbdBufferStart+kbdBufferLen++)%KBD_BUFFER_LENGTH] = (dword) ((kbdFlags << 16) | (kbdScan << 8) | kbdAscii);
|
||||
// printf("S:%d\tL:%d\tR:%x\n", kbdBufferStart, kbdBufferLen, kbdBuffer[kbdBufferStart]);
|
||||
}
|
||||
}
|
||||
|
||||
eoi();
|
||||
|
||||
}
|
||||
|
||||
//Gets a key from the buffer, returns 0 if no keys available, returns immediately
|
||||
dword kbdGetKey()
|
||||
{
|
||||
if (kbdBufferLen == 0) //buffer empty
|
||||
return 0;
|
||||
dword retVal = kbdBuffer[kbdBufferStart];
|
||||
kbdBufferStart++;
|
||||
kbdBufferLen--;
|
||||
if (kbdBufferStart >= KBD_BUFFER_LENGTH)
|
||||
kbdBufferStart = 0;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//Gets a key from the buffer, if no keys available, waits for one to be entered
|
||||
dword kbdWaitKey()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (kbdBufferLen != 0) //buffer empty
|
||||
break;
|
||||
}
|
||||
dword retVal = kbdBuffer[kbdBufferStart];
|
||||
kbdBufferStart++;
|
||||
kbdBufferLen--;
|
||||
if (kbdBufferStart >= KBD_BUFFER_LENGTH)
|
||||
kbdBufferStart = 0;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//Resets the keyboard LEDs to reflect the current state of the num lock, caps lock, and scroll lock bits
|
||||
void kbd_resetLEDs()
|
||||
{
|
||||
outportb(0x60, 0xED);
|
||||
ackReason = 0xED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// keyboard.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 04/17/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_KEYBOARD__
|
||||
#define __HOS_KEYBOARD__ __HOS_KEYBOARD__
|
||||
|
||||
#define KBD_SCROLL 0x01
|
||||
#define KBD_NUM 0x02
|
||||
#define KBD_CAPS 0x04
|
||||
#define KBD_SHIFT 0x10
|
||||
#define KBD_CTRL 0x20
|
||||
#define KBD_ALT 0x40
|
||||
|
||||
#define KBD_SCAN_RELEASED 128
|
||||
|
||||
#define KBD_SCAN_LCTRL 29
|
||||
#define KBD_SCAN_LSHIFT 42
|
||||
#define KBD_SCAN_RSHIFT 54
|
||||
#define KBD_SCAN_LALT 56
|
||||
#define KBD_SCAN_SCROLL 70
|
||||
#define KBD_SCAN_CAPS 58
|
||||
#define KBD_SCAN_NUM 69
|
||||
|
||||
#define KBD_SCANE_PRINTSCREEN 55
|
||||
#define KBD_SCANE_INS 82
|
||||
#define KBD_SCANE_HOME 71
|
||||
#define KBD_SCANE_PGUP 73
|
||||
#define KBD_SCANE_DEL 83
|
||||
#define KBD_SCANE_END 79
|
||||
#define KBD_SCANE_PGDN 81
|
||||
#define KBD_SCANE_ENTER 28
|
||||
|
||||
#define KBD_SCANE_NULL 42
|
||||
|
||||
|
||||
|
||||
//====PROTOTYPES:
|
||||
|
||||
void isr_keyboard();
|
||||
void kbd_resetLEDs();
|
||||
dword kbdGetKey();
|
||||
dword kbdWaitKey();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// mouse.c
|
||||
// 10/03/03
|
||||
// Author: Josh Holtrop
|
||||
|
||||
#include "mouse.h"
|
||||
#include "hos_defines.h"
|
||||
|
||||
#define MOUSE_BUFFER_LENGTH 16
|
||||
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
int mouse_bytesRead = 0;
|
||||
byte mouse_inbuffer[MOUSE_BUFFER_LENGTH];
|
||||
|
||||
//This method initializes the ps/2 mouse
|
||||
void mouse_init()
|
||||
{
|
||||
outportb(0x64, 0x20); //tell keyboard controller we are going to read keyboard controller command byte
|
||||
byte temp = inportb(0x60); //read keyboard controller command byte
|
||||
outportb(0x64, 0x60); //tell keyboard controller we are going to write keyboard controller command byte
|
||||
outportb(0x60, 0x03 | (temp&0x40)); //write keyboard controller command byte: enable mouse/keyboard ints, include original XLATE bit from temp (bit6)
|
||||
|
||||
outportb(0x64, 0xA8); //enable mouse port
|
||||
|
||||
outportb(0x64, 0xD4); //send command to mouse, not kbd
|
||||
outportb(0x60, 0xF4); //enable data reporting
|
||||
|
||||
mouse_x = video_mode.XResolution >> 1;
|
||||
mouse_y = video_mode.YResolution >> 1;
|
||||
|
||||
//outportb(0x64, 0xD4);
|
||||
//outportb(0x60, 0xE7); //scaling 2:1
|
||||
}
|
||||
|
||||
|
||||
//This method is called when a mouse interrupt occurs
|
||||
void isr_mouse()
|
||||
{
|
||||
byte inb = inportb(0x60); //read mouse byte
|
||||
if ((inb == 0xFA) && (mouse_bytesRead < 1)) //ACK
|
||||
return;
|
||||
mouse_inbuffer[mouse_bytesRead] = inb;
|
||||
mouse_bytesRead++;
|
||||
if (mouse_bytesRead == 3) //complete packet received
|
||||
{
|
||||
mouse_bytesRead = 0;
|
||||
int adjx = (char) mouse_inbuffer[1];
|
||||
int adjy = (char) mouse_inbuffer[2];
|
||||
mouse_x += adjx;
|
||||
mouse_y -= adjy; //-= because screen y coordinates are opposite mouse y coordinates
|
||||
if (mouse_x < 0)
|
||||
mouse_x = 0;
|
||||
if (mouse_x >= video_mode.XResolution)
|
||||
mouse_x = video_mode.XResolution - 1;
|
||||
if (mouse_y < 0)
|
||||
mouse_y = 0;
|
||||
if (mouse_y >= video_mode.YResolution)
|
||||
mouse_y = video_mode.YResolution - 1;
|
||||
if (mouse_inbuffer[0] & 0x01) //left button
|
||||
video_pset(mouse_x, mouse_y, 0x00FF8800);
|
||||
else
|
||||
video_pset(mouse_x, mouse_y, 0x00FFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// mouse.h
|
||||
// Author: Josh Holtrop
|
||||
// Date: 10/03/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#ifndef __HOS_MOUSE__
|
||||
#define __HOS_MOUSE__ __HOS_MOUSE__
|
||||
|
||||
|
||||
void mouse_init();
|
||||
void isr_mouse();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//Functions.c
|
||||
//05/07/03 Josh Holtrop
|
||||
//for HOS
|
||||
//Modified: 02/26/04
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
//functions.h
|
||||
//05/07/03 Josh Holtrop
|
||||
//for HOS
|
||||
//Modified: 02/26/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_FUNCTIONS__
|
||||
#define __HOS_FUNCTIONS__ __HOS_FUNCTIONS__
|
||||
|
||||
extern dword _code;
|
||||
extern dword _bss;
|
||||
extern dword _end;
|
||||
|
||||
inline void enable_ints();
|
||||
inline void disable_ints();
|
||||
inline void restart();
|
||||
inline void halt();
|
||||
inline dword kernel_size();
|
||||
inline void timer_init();
|
||||
inline byte bcd2byte(byte bcd);
|
||||
inline byte byte2bcd(byte bite);
|
||||
|
||||
//Enables (SeTs) Interrupt Flag on the processor
|
||||
inline void enable_ints()
|
||||
{
|
||||
asm("sti");
|
||||
}
|
||||
|
||||
//Disables (CLears) Interrupt Flag on the processor
|
||||
inline void disable_ints()
|
||||
{
|
||||
asm("cli");
|
||||
}
|
||||
|
||||
//Restarts the computer
|
||||
inline void restart()
|
||||
{
|
||||
enable_ints();
|
||||
byte temp;
|
||||
do
|
||||
{
|
||||
temp = inportb(0x64);
|
||||
if (temp & 1)
|
||||
inportb(0x60);
|
||||
} while(temp & 2);
|
||||
|
||||
|
||||
outportb (0x64, 0xfe);
|
||||
for (;;)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//Halts (freezes) the computer
|
||||
inline void halt()
|
||||
{
|
||||
asm("cli");
|
||||
asm("hlt");
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
//Initializes 8253 Programmable Interrupt Timer
|
||||
inline void timer_init()
|
||||
{
|
||||
//set timer : 2e9c = 100hz
|
||||
outportb(0x43, 0x34);
|
||||
outportb(0x40, 0x9c); //lsb
|
||||
outportb(0x40, 0x2e); //msb
|
||||
}
|
||||
|
||||
//Returns the size of the kernel (code & data)
|
||||
// - this does not include the bss section
|
||||
// - this should be 4kb aligned per the linker script
|
||||
// - this should be the size of kernel.bin
|
||||
inline dword kernel_size()
|
||||
{
|
||||
return (dword)(&_bss)-(dword)(&_code);
|
||||
}
|
||||
|
||||
//converts a binary-coded-decimal byte to its decimal equivalent
|
||||
inline byte bcd2byte(byte bcd)
|
||||
{
|
||||
return (10* ((bcd & 0xF0) >> 4)) + (bcd & 0x0F);
|
||||
}
|
||||
|
||||
//converts a binary-coded-decimal byte to its decimal equivalent
|
||||
inline byte byte2bcd(byte bite)
|
||||
{
|
||||
return ((bite / 10) << 4) | (bite % 10);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
;gdt.inc
|
||||
;Author: Josh Holtrop
|
||||
;Date: 10/30/03
|
||||
;Modified: 03/02/04
|
||||
|
||||
gdtr:
|
||||
dw gdt_end-gdt-1
|
||||
dd GDT_V
|
||||
gdt:
|
||||
dd 0
|
||||
dd 0
|
||||
KERNEL_CODE equ $-gdt
|
||||
dw 0xffff ;limit 15:0
|
||||
dw 0x0000 ;base 15:0
|
||||
db 0x00 ;base 23:16
|
||||
db 0x9A ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
KERNEL_DATA equ $-gdt
|
||||
dw 0xffff ;limit 15:0
|
||||
dw 0x0000 ;base 15:0
|
||||
db 0x00 ;base 23:16
|
||||
db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
USER_CODE equ $-gdt
|
||||
dw 0xffff ;limit 15:0
|
||||
dw 0x0000 ;base 15:0
|
||||
db 0x00 ;base 23:16
|
||||
db 0xFA ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
USER_DATA equ $-gdt
|
||||
dw 0xffff ;limit 15:0
|
||||
dw 0x0000 ;base 15:0
|
||||
db 0x00 ;base 23:16
|
||||
db 0xF2 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
gVESA_CODE equ $-gdt
|
||||
dw 0xffff ;limit 15:0
|
||||
dw 0x0000 ;base 15:0
|
||||
db 0x00 ;base 23:16
|
||||
db 0x9A ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
VESA_DATA equ $-gdt
|
||||
dw 0xffff ;limit 15:0
|
||||
dw 0x0000 ;base 15:0
|
||||
db 0x00 ;base 23:16
|
||||
db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
VIDEO_TEXT equ $-gdt
|
||||
dw 0x7FFF ;limit 15:0
|
||||
dw 0x8000 ;base 15:0
|
||||
db 0x0B ;base 23:16
|
||||
db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
VIDEO_GRAPHICS equ $-gdt
|
||||
dw 0xFFFF ;limit 15:0
|
||||
dw 0x0000 ;base 15:0
|
||||
db 0x0A ;base 23:16
|
||||
db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||
db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||
db 0x00 ;base 31:24
|
||||
dt_end:
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//hos_defines.h
|
||||
//03/17/03 Josh Holtrop
|
||||
//Modified: 03/02/04
|
||||
|
||||
#ifndef __HOS_HOS_DEFINES__
|
||||
#define __HOS_HOS_DEFINES__ __HOS_HOS_DEFINES__
|
||||
|
||||
#define FREERAM_START 0x368000 // 0x368000 is first available byte (this is right after the initrd @ 2mb, 1440kb.
|
||||
#define MAX_RAM 0x40000000 //1gb maximum RAM supported
|
||||
|
||||
#define PID_KERNEL 0x02 //kernel's PID
|
||||
#define PID_VMM 0x03
|
||||
#define PID_USER 0x10000 //user processes' start PID
|
||||
|
||||
|
||||
//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
|
||||
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int dword;
|
||||
|
||||
typedef struct {
|
||||
dword lowdword;
|
||||
dword highdword;
|
||||
} __attribute__((packed)) qword;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
;idt.inc
|
||||
;Author: Josh Holtrop
|
||||
;Date: 10/30/03
|
||||
;Modified: 03/02/04
|
||||
|
||||
idtr:
|
||||
dw 50*8-1 ;size of idt
|
||||
dd IDT_V ;address of idt
|
||||
|
||||
|
||||
%macro isr_label 1
|
||||
isr_%1:
|
||||
push eax
|
||||
mov eax, %1
|
||||
jmp isr_main
|
||||
%endmacro
|
||||
|
||||
isr_label 0
|
||||
isr_label 1
|
||||
isr_label 2
|
||||
isr_label 3
|
||||
isr_label 4
|
||||
isr_label 5
|
||||
isr_label 6
|
||||
isr_label 7
|
||||
isr_label 8
|
||||
isr_label 9
|
||||
isr_label 10
|
||||
isr_label 11
|
||||
isr_label 12
|
||||
isr_label 13
|
||||
isr_label 14
|
||||
isr_label 15
|
||||
isr_label 16
|
||||
isr_label 17
|
||||
isr_label 18
|
||||
isr_label 19
|
||||
isr_label 20
|
||||
isr_label 21
|
||||
isr_label 22
|
||||
isr_label 23
|
||||
isr_label 24
|
||||
isr_label 25
|
||||
isr_label 26
|
||||
isr_label 27
|
||||
isr_label 28
|
||||
isr_label 29
|
||||
isr_label 30
|
||||
isr_label 31
|
||||
isr_label 32
|
||||
isr_label 33
|
||||
isr_label 34
|
||||
isr_label 35
|
||||
isr_label 36
|
||||
isr_label 37
|
||||
isr_label 38
|
||||
isr_label 39
|
||||
isr_label 40
|
||||
isr_label 41
|
||||
isr_label 42
|
||||
isr_label 43
|
||||
isr_label 44
|
||||
isr_label 45
|
||||
isr_label 46
|
||||
isr_label 47
|
||||
isr_label 48
|
||||
isr_label 49
|
||||
|
||||
isr_main:
|
||||
cmp eax, 0x30
|
||||
jz isr_syscall
|
||||
|
||||
pusha
|
||||
push ds
|
||||
push es
|
||||
|
||||
push eax
|
||||
|
||||
call _isr
|
||||
|
||||
add esp, 4
|
||||
|
||||
pop es
|
||||
pop ds
|
||||
popa
|
||||
pop eax
|
||||
|
||||
iret
|
||||
|
||||
|
||||
isr_syscall:
|
||||
pop eax ;syscall function number
|
||||
pusha
|
||||
push ds
|
||||
push es
|
||||
|
||||
sc1:
|
||||
cmp eax, 1 ;syscall 1 - putc
|
||||
jnz sc2
|
||||
push ebx
|
||||
call _putc
|
||||
add esp, 4
|
||||
jmp scdone
|
||||
sc2:
|
||||
|
||||
scdone:
|
||||
pop es
|
||||
pop ds
|
||||
popa
|
||||
iret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
;kernel.asm
|
||||
;Author: Josh Holtrop
|
||||
;Date: 10/30/03
|
||||
;Modified: 10/30/03
|
||||
|
||||
%define GDT_P 0x100000; ;1mb physical - Global Descriptor Table space
|
||||
%define GDT_V GDT_P+0xC0000000
|
||||
%define IDT_P 0x102000 ;1mb+8kb - Interrupt Descriptor Table space
|
||||
%define IDT_V IDT_P+0xC0000000
|
||||
%define PDBR_P 0x104000 ;1mb+16kb - Page Directory Base Register (first PD)
|
||||
%define PDBR_V PDBR_P+0xC0000000
|
||||
%define LOPT_P 0x105000 ;1mb+20kb - LOw Page Table for mapping first 4mb
|
||||
%define LOPT_V LOPT_P+0xC0000000
|
||||
%define KERNEL_P 0x106000 ;1mb+24kb - the kernel's physical address
|
||||
%define KERNEL_V KERNEL_P+0xC0000000 ;3gb+1mb+24kb, the virtual address of the kernel
|
||||
|
||||
[global start]
|
||||
[extern _isr]
|
||||
[extern _k_init]
|
||||
[extern _putc]
|
||||
|
||||
bits 32
|
||||
|
||||
;This is where the kernel begins execution
|
||||
;At this point, the temporary gdt is set up to "map" 0xC000_0000 to 0x0.
|
||||
;We must enable paging with the first 4mb mapped 1:1 virtual:physical
|
||||
; and with the 4mb starting at 0xC000_0000 mapped to the first 4mb physical.
|
||||
;Then we can start using our "real" gdt, then unmap the lower 4mb.
|
||||
start:
|
||||
cli ;if they weren't already off
|
||||
|
||||
xor eax, eax
|
||||
mov edi, PDBR_V
|
||||
mov ecx, 1024 ;clear the PDBR
|
||||
rep stosd
|
||||
mov [PDBR_V], dword LOPT_P|0x03 ;store the physical address of the LOw Page Table (read/write, present)
|
||||
mov [PDBR_V+0xC00], dword LOPT_P|0x03 ;store the physical address of the LOw Page Table (read/write, present)
|
||||
|
||||
mov edi, LOPT_V
|
||||
mov ecx, 1024
|
||||
mov eax, 0x03 ;starting physical address = 0x0 (read/write, present flags)
|
||||
fill_lopt_loop: ;fill the page table
|
||||
stosd
|
||||
add eax, 4096 ;increment next phsyical address by 4kb
|
||||
loop fill_lopt_loop
|
||||
|
||||
mov eax, PDBR_P
|
||||
mov cr3, eax ;store the Page Directory Base Address
|
||||
mov eax, cr0
|
||||
or eax, 0x80000000 ;set page enable bit
|
||||
mov cr0, eax ;now paging is active!
|
||||
|
||||
|
||||
mov edi, GDT_V
|
||||
mov esi, gdt
|
||||
mov ecx, gdt_end-gdt
|
||||
copy_gdt:
|
||||
lodsb
|
||||
stosb
|
||||
loop copy_gdt
|
||||
|
||||
mov edi, IDT_V ;destination
|
||||
mov esi, isr_0 ;address of isr0
|
||||
mov edx, isr_1-isr_0 ;distance between isr labels
|
||||
mov ecx, 50 ;number of isrlabels
|
||||
fill_idt:
|
||||
mov ebx, esi
|
||||
mov ax, si
|
||||
stosw ;0 offset 15:0
|
||||
mov ax, KERNEL_CODE
|
||||
stosw ;2 selector 15:0
|
||||
mov ax, 0x8E00
|
||||
stosw ;4 [P][DPL][0][TYPE][0][0][0][0][0][0][0][0]
|
||||
shr esi, 16
|
||||
mov ax, si
|
||||
stosw ;6 offset 31:16
|
||||
mov esi, ebx
|
||||
add esi, edx
|
||||
loop fill_idt
|
||||
mov word [IDT_V+0x30*8+4], 0xEE00 ;interrupt 0x30 has user priviledges
|
||||
|
||||
lgdt [gdtr] ;load gdt
|
||||
jmp KERNEL_CODE:newgdtcontinue
|
||||
newgdtcontinue:
|
||||
mov ax, KERNEL_DATA
|
||||
mov es, ax
|
||||
mov ds, ax
|
||||
mov gs, ax
|
||||
mov fs, ax
|
||||
mov ss, ax
|
||||
mov esp, 0xc0200000 ;stack just under 3gb+2mb, moves downward
|
||||
lidt [idtr] ;load idt
|
||||
|
||||
call _k_init
|
||||
haltit:
|
||||
hlt ;halt processor when k_init is done
|
||||
jmp haltit ;shouldn't get here...
|
||||
|
||||
%include "gdt.inc"
|
||||
%include "idt.inc"
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
// kernel.c
|
||||
// Author: Josh Holtrop
|
||||
// Date: 08/13/03
|
||||
// Holtrop's Operating System - Version 0.13
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h" //#DEFINE's for kernel
|
||||
|
||||
#include "functions.h" //general functions
|
||||
#include "asmfuncs.h" //assembly functions
|
||||
#include "kio.h" //kernel input/output functions
|
||||
#include "mm/mm.h" //physical memory management functions
|
||||
#include "mm/vmm.h" //virtual memory management & paging functions
|
||||
#include "char/keyboard.h" //generic keyboard driver & functions
|
||||
#include "char/mouse.h" //generic ps/2 mouse driver & functions
|
||||
#include "block/fdc.h" //Floppy Disk Controller functions
|
||||
#include "string/string.h" //string functions
|
||||
#include "sys/cmos.h" //CMOS interface functions
|
||||
#include "sys/io.h" //port i/o functions
|
||||
#include "sys/pic.h" //Programmable Interrupt Controller functions
|
||||
#include "sys/rtc.h" //Real Time Clock functions
|
||||
#include "video/stdfont.h" //Standard font bitmask array
|
||||
#include "video/video.h" //video functions
|
||||
|
||||
void isr(dword num);
|
||||
void k_init();
|
||||
|
||||
dword timer = 0;
|
||||
|
||||
//Main kernel initialization method
|
||||
void k_init()
|
||||
{
|
||||
// ===== Initialization
|
||||
fdc_sendDOR(0x0C); //turn off floppy motor!!
|
||||
console_cls();
|
||||
video_init();
|
||||
mm_init();
|
||||
vmm_init();
|
||||
remap_pics(0x20, 0x28);
|
||||
init_timer();
|
||||
mouse_init();
|
||||
pic1_mask(0); //unmask IRQ's 0-7
|
||||
pic2_mask(0); //unmask IRQ's 8-15
|
||||
vfs_init();
|
||||
enable_ints();
|
||||
kbd_resetLEDs(); //after enabling interrupts!!
|
||||
if (videoMode)
|
||||
{
|
||||
int p = video_mode.XResolution*video_mode.YResolution-1;
|
||||
for (; p >= 0; p--)
|
||||
video_psetp(p, 0x00000077);
|
||||
video_drawConsole();
|
||||
}
|
||||
|
||||
printf("HOS 0.13 - Kernel File Size: %u kb\tData Size: %u bytes\n", kernel_size()>>10, (dword)(&_end)-(dword)(&_code));
|
||||
printf("Memory available to OS: %u MB (%u bytes)\n", mm_megabytes, mm_totalmem);
|
||||
printf("Free memory: %u bytes (%u pages)\n", mm_freemem(), mm_freemem()>>12);
|
||||
printf("%d/%d/%d\t%d:%d:%d\n", rtc_readMonth(), rtc_readDay(), rtc_readYear(), rtc_readHour(), rtc_readMinute(), rtc_readSecond());
|
||||
printf("Root Directory: %s/\n", rootDevice->id);
|
||||
|
||||
dword key = 0;
|
||||
for (;;)
|
||||
{
|
||||
key = kbdWaitKey();
|
||||
if ((key & 0xFF) > 2) //key is not a control key
|
||||
putc(key);
|
||||
}
|
||||
}
|
||||
|
||||
// main Interrupt Service Routine - handles all interrupts unless caught by kernel.asm
|
||||
void isr(dword num)
|
||||
{
|
||||
switch(num)
|
||||
{
|
||||
case 14:
|
||||
printf("Page fault, CR2 = 0x%x\n", read_cr2());
|
||||
halt();
|
||||
break;
|
||||
case 0x20: // IRQ0 - timer interrupt
|
||||
timer++;
|
||||
(*(byte *)(0xc00b8000))++;
|
||||
eoi();
|
||||
break;
|
||||
case 0x21: // IRQ1 - keyboard interrupt
|
||||
isr_keyboard(); //isr_keybard() takes care of calling eoi()
|
||||
break;
|
||||
case 0x2C: // IRQ12 - PS/2 mouse
|
||||
isr_mouse();
|
||||
eoi2();
|
||||
break;
|
||||
default:
|
||||
printf("Interrupt %d (0x%x) Unhandled!!\n", num, num);
|
||||
halt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
// kio.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 12/25/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "kio.h"
|
||||
|
||||
dword cursorPosition = 0; //Caches the current cursor position
|
||||
|
||||
// This is the main output routine, it uses a format string and a variable
|
||||
// number of arguments to print formatted text
|
||||
void printf(char *fmt, ...)
|
||||
{
|
||||
dword *params = ((dword *)(&fmt)) + 1; //points to the first paramater
|
||||
int i;
|
||||
int special = 0;
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
if (special)
|
||||
{
|
||||
special = 0;
|
||||
switch (fmt[i])
|
||||
{
|
||||
case 0:
|
||||
return;
|
||||
case '%':
|
||||
putc('%');
|
||||
break;
|
||||
case 's': case 'S':
|
||||
puts((char *)*params);
|
||||
params++;
|
||||
break;
|
||||
case 'c': case 'C':
|
||||
putc(*params);
|
||||
params++;
|
||||
break;
|
||||
case 'd': case 'D':
|
||||
putDec(*params);
|
||||
params++;
|
||||
break;
|
||||
case 'u': case 'U':
|
||||
putDecu(*params);
|
||||
params++;
|
||||
break;
|
||||
case 'x': case 'X':
|
||||
putHex(*params);
|
||||
params++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (fmt[i])
|
||||
{
|
||||
case '%':
|
||||
special = 1;
|
||||
break;
|
||||
case 0:
|
||||
return;
|
||||
default:
|
||||
putc(fmt[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function draws a single character
|
||||
void putc(dword chr)
|
||||
{
|
||||
char charac = (char)chr;
|
||||
word *vidmem = (word *)0xC00B8000;
|
||||
if (charac == '\n')
|
||||
{
|
||||
if (cursorPosition % 80)
|
||||
cursorPosition = cursorPosition + 80 - (cursorPosition % 80);
|
||||
else
|
||||
cursorPosition += 80;
|
||||
}
|
||||
else if (charac == '\t')
|
||||
{
|
||||
if (cursorPosition % 8)
|
||||
cursorPosition = cursorPosition + 8 - (cursorPosition % 8);
|
||||
else
|
||||
cursorPosition += 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (videoMode)
|
||||
{
|
||||
console_memory[cursorPosition] = charac | 0x0700;
|
||||
video_drawConsoleChar(cursorPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
console_memory[cursorPosition] = charac | 0x0700;
|
||||
vidmem[cursorPosition] = charac | 0x0700;
|
||||
}
|
||||
cursorPosition++;
|
||||
}
|
||||
if (cursorPosition >= 2000)
|
||||
{
|
||||
console_scroll();
|
||||
cursorPosition = 2000-80;
|
||||
if (videoMode)
|
||||
video_drawConsole();
|
||||
}
|
||||
if (!videoMode)
|
||||
writeCursorPosition(cursorPosition);
|
||||
}
|
||||
|
||||
|
||||
// This function displays a number in hexadecimal
|
||||
int putHex(dword number)
|
||||
{
|
||||
int hitNum = 0;
|
||||
int i;
|
||||
for (i = 7; i >= 0; i--)
|
||||
{
|
||||
dword val = (number >> (i*4)) & 0xF;
|
||||
if ((val != 0) || (i == 0))
|
||||
hitNum = 1;
|
||||
if (hitNum)
|
||||
{
|
||||
val = val + '0';
|
||||
if (val > '9')
|
||||
val = val + ('A' - '9' - 1);
|
||||
putc(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//kio.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 12/25/03
|
||||
// Modified: 12/25/03
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_KIO__
|
||||
#define __HOS_KIO__ __HOS_KIO__
|
||||
|
||||
void printf(char *fmt, ...);
|
||||
void putc(dword chr);
|
||||
int putHex(dword number);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
OUTPUT_FORMAT("binary")
|
||||
ENTRY(start)
|
||||
SECTIONS
|
||||
{
|
||||
.text 0xC0106000 : {
|
||||
code = .; _code = .; __code = .;
|
||||
*(.text)
|
||||
. = ALIGN(4096);
|
||||
}
|
||||
.data : {
|
||||
data = .; _data = .; __data = .;
|
||||
*(.data)
|
||||
. = ALIGN(4096);
|
||||
}
|
||||
.bss :
|
||||
{
|
||||
bss = .; _bss = .; __bss = .;
|
||||
*(.bss)
|
||||
. = ALIGN(4096);
|
||||
}
|
||||
end = .; _end = .; __end = .;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// mm.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 09/01/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "mm.h"
|
||||
|
||||
//The total amount of physical memory available (bytes, 1 bit per page)
|
||||
#define BITMAP_SIZE 0x20000
|
||||
dword mm_totalmem = 0;
|
||||
dword mm_megabytes;
|
||||
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
|
||||
|
||||
//This function initializes the memory manager's linked list, filling it with the
|
||||
// memory areas returned by bios interrupt 0x8E20
|
||||
void mm_init()
|
||||
{
|
||||
dword memmap_entries = *(dword *)BOOT_MEMMAP_ENTRIES;
|
||||
memmap_entry *maps = (memmap_entry *) BOOT_FIRST_MEMMAP;
|
||||
dword a;
|
||||
for (a = 0; a < BITMAP_SIZE; a++)
|
||||
{
|
||||
page_bitmap[a] = 0xFF; //all pages used
|
||||
}
|
||||
for (a = 0; a < memmap_entries; a++)
|
||||
{
|
||||
if (maps[a].attributes == 1) // (1) mem free to OS
|
||||
{
|
||||
mm_totalmem += maps[a].limit.lowdword;
|
||||
if ((maps[a].base.lowdword + maps[a].limit.lowdword) >= (FREERAM_START+4096)) //goes past where we start freeram
|
||||
{
|
||||
if (maps[a].base.lowdword < FREERAM_START)
|
||||
{
|
||||
mm_pfreen(FREERAM_START, (maps[a].limit.lowdword - (FREERAM_START - maps[a].base.lowdword)) >> 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
mm_pfreen(maps[a].base.lowdword, maps[a].limit.lowdword >> 12); //set the appropriate bits as "free" in the page bitmap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mm_totalmem % 0x100000)
|
||||
mm_megabytes = (mm_totalmem >> 20) + 1;
|
||||
else
|
||||
mm_megabytes = mm_totalmem >> 20;
|
||||
}
|
||||
|
||||
|
||||
// This function frees a certain number of pages starting at the address
|
||||
// specified in base for a length of pages pages
|
||||
void mm_pfreen(dword base, dword pages)
|
||||
{
|
||||
dword a;
|
||||
dword max = base + (pages << 12);
|
||||
for (a = base; a < max; a += 4096)
|
||||
{
|
||||
mm_pfree(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function frees a single page
|
||||
void mm_pfree(dword base)
|
||||
{
|
||||
// dword pageNumber = base >> 12; // >>12 == /4096
|
||||
dword byteNumber = base >> 15; //pageNumber >> 3; //pageNumber/8
|
||||
dword bitNumber = (base >> 12) % 8; //pageNumber % 8;
|
||||
page_bitmap[byteNumber] = page_bitmap[byteNumber] & ((0x01 << bitNumber) ^ 0xFF);
|
||||
}
|
||||
|
||||
|
||||
// This function allocates a single page, returning its physical address
|
||||
void *mm_palloc()
|
||||
{
|
||||
dword bite;
|
||||
for (bite = 0; bite < BITMAP_SIZE; bite++)
|
||||
{
|
||||
if (page_bitmap[bite] != 0xFF) //there is an available page within this 8-page region
|
||||
{
|
||||
int bit;
|
||||
for (bit = 0; bit < 8; bit++)
|
||||
{
|
||||
if (!(page_bitmap[bite] & (1 << bit))) //this bite/bit combination is available
|
||||
{
|
||||
page_bitmap[bite] = page_bitmap[bite] | (1 << bit); //set page as used
|
||||
return (void *)((bite << 15) | (bit << 12));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0; //no free page
|
||||
}
|
||||
|
||||
|
||||
// This function reports the number of bytes of free physical memory
|
||||
dword mm_freemem()
|
||||
{
|
||||
dword a;
|
||||
dword pages = 0;
|
||||
for (a = 0; a < BITMAP_SIZE; a++)
|
||||
{
|
||||
int bit;
|
||||
for (bit = 0; bit < 8; bit++)
|
||||
{
|
||||
if (!(page_bitmap[a] & (1 << bit)))
|
||||
pages++;
|
||||
}
|
||||
}
|
||||
return pages << 12;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// mm.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 09/01/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_MM__
|
||||
#define __HOS_MM__ __HOS_MM__
|
||||
|
||||
|
||||
typedef struct {
|
||||
qword base;
|
||||
qword limit;
|
||||
dword attributes;
|
||||
} __attribute__((packed)) memmap_entry;
|
||||
|
||||
|
||||
void mm_init();
|
||||
void mm_pfreen(dword base, dword pages);
|
||||
void mm_pfree(dword base);
|
||||
void *mm_palloc();
|
||||
dword mm_freemem();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
// vmm.c
|
||||
// Author: Josh Holtrop
|
||||
// Date: 09/30/03
|
||||
// Rewritten from scratch: 12/23/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "vmm.h"
|
||||
|
||||
HeapEntry *firstHeapEntry = (HeapEntry *)0xD0000000; //this is where heap memory starts
|
||||
|
||||
// This is the initialization procedure for the Virtual Memory Manager
|
||||
// It sets up the final page directory/page table setup and maps video memory, if present
|
||||
void vmm_init()
|
||||
{
|
||||
unsigned int *pageTables = (unsigned int *)0xC0104000; //this is the location of the page directory
|
||||
pageTables[0x3FF] = 0x104000|0x03; //the last page directory entry points to the page directory itself
|
||||
pageTables[0] = 0;
|
||||
invlpg(0);
|
||||
if (videoMode) //we are in a graphical mode
|
||||
{
|
||||
unsigned int vidPages = video_mode.XResolution * video_mode.YResolution * (video_mode.BitsPerPixel >> 3);
|
||||
if (vidPages % 4096)
|
||||
vidPages = (vidPages >> 12) + 1;
|
||||
else
|
||||
vidPages = (vidPages >> 12);
|
||||
vmm_mapn(0xF0000000, video_mode.PhysBasePtr, vidPages);
|
||||
}
|
||||
unsigned int firstHeapEntryBlock = (unsigned int)mm_palloc();
|
||||
vmm_map1((unsigned int)firstHeapEntry, firstHeapEntryBlock);
|
||||
HeapEntryBlock *heb = (HeapEntryBlock *)firstHeapEntry;
|
||||
vmm_heb_init(heb);
|
||||
heb->entry[0].base = (unsigned int)firstHeapEntry; //start of kernel's heap memory
|
||||
heb->entry[0].size = 4096; //the first HeapEntryBlock is 1 page long
|
||||
heb->entry[0].attributes = VMM_HE_HEB; //this is a HeapEntryBlock
|
||||
heb->entry[1].base = (unsigned int)firstHeapEntry+4096; //this is the start of the rest of the kernel's heap memory
|
||||
heb->entry[1].size = 0x10000000-4096; //the rest of the kernel's heap memory: 256mb - 4kb
|
||||
heb->entry[1].attributes = VMM_HE_HOLE; //this is a hold - an unmapped section of heap memory
|
||||
}
|
||||
|
||||
|
||||
// This function initialzes a Heap Entry Block to unused entries linked together
|
||||
void vmm_heb_init(HeapEntryBlock *heb)
|
||||
{
|
||||
int a;
|
||||
for (a = 0; a < 256; a++)
|
||||
{
|
||||
heb->entry[a].base = 0;
|
||||
heb->entry[a].size = 0;
|
||||
heb->entry[a].attributes = VMM_HE_UNUSED;
|
||||
heb->entry[a].link = (unsigned int)&(heb->entry[a+1]);
|
||||
}
|
||||
heb->entry[255].link = 0;
|
||||
}
|
||||
|
||||
|
||||
// This function maps a virtual address to a physical address using the page directory / page table
|
||||
void vmm_map1(unsigned int virt, unsigned int physical)
|
||||
{
|
||||
unsigned int pde = virt >> 22;
|
||||
unsigned int pte = (virt & 0x003FF000) >> 12;
|
||||
unsigned int *pageTables = (unsigned int *)0xC0104000; //this is the location of the page directory
|
||||
if (!(pageTables[pde] & 0x01)) //the page directory entry does not exist, we must allocate a page for it
|
||||
{
|
||||
unsigned int *newpagetable = mm_palloc();
|
||||
pageTables[pde] = ((unsigned int)newpagetable) | 0x03;
|
||||
invlpg(virt);
|
||||
unsigned int *newpteptr = (unsigned int *)(0xFFC00000 | (pde << 12)); //points to first unsigned int of newly allocated page table
|
||||
int a;
|
||||
for (a = 0; a < 1024; a++)
|
||||
{
|
||||
newpteptr[a] = 0;
|
||||
}
|
||||
}
|
||||
unsigned int *pteptr = (unsigned int *)(0xFFC00000 | (pde << 12) | (pte << 2));
|
||||
*pteptr = physical | 0x03;
|
||||
invlpg(virt);
|
||||
}
|
||||
|
||||
|
||||
// This function maps a variable number of pages in a row
|
||||
void vmm_mapn(unsigned int virt, unsigned int physical, unsigned int n)
|
||||
{
|
||||
for (; n > 0; n--)
|
||||
{
|
||||
vmm_map1(virt, physical);
|
||||
virt += 4096;
|
||||
physical += 4096;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function removes the virtual address's entry in the page directory / page table
|
||||
void vmm_unmap1(unsigned int virt)
|
||||
{
|
||||
unsigned int *pteptr = (unsigned int *)(0xFFC00000 | ((virt & 0xFFC00000) >> 10) | ((virt & 0x003FF000) >> 10));
|
||||
*pteptr = 0;
|
||||
invlpg(virt);
|
||||
}
|
||||
|
||||
|
||||
// This function removes multiple pages' entries
|
||||
void vmm_unmapn(unsigned int virt, unsigned int n)
|
||||
{
|
||||
for (; n > 0; n--)
|
||||
{
|
||||
vmm_unmap1(virt);
|
||||
virt += 4096;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Virtual Memory allocator function
|
||||
void *malloc(unsigned int bytes)
|
||||
{
|
||||
if (bytes % VMM_MALLOC_GRANULARITY)
|
||||
bytes = bytes + VMM_MALLOC_GRANULARITY - (bytes % VMM_MALLOC_GRANULARITY);
|
||||
void *attempt = vmm_getFreeChunk(bytes);
|
||||
if (attempt)
|
||||
return attempt;
|
||||
if(vmm_moreCore(bytes))
|
||||
return 0; //we could not get any more heap memory
|
||||
return vmm_getFreeChunk(bytes);
|
||||
}
|
||||
|
||||
|
||||
// This function returns a pointer if a free chunk of memory exists
|
||||
void *vmm_getFreeChunk(unsigned int bytes)
|
||||
{
|
||||
HeapEntry *he = firstHeapEntry;
|
||||
for (;;)
|
||||
{
|
||||
if (he->attributes == VMM_HE_FREE)
|
||||
{
|
||||
if (he->size > bytes)
|
||||
{
|
||||
HeapEntry *nhe = vmm_nextHeapEntry();
|
||||
nhe->base = he->base;
|
||||
nhe->size = bytes;
|
||||
nhe->attributes = VMM_HE_USED;
|
||||
he->base += bytes;
|
||||
he->size -= bytes;
|
||||
return (void *)(nhe->base);
|
||||
}
|
||||
if (he->size == bytes)
|
||||
{
|
||||
he->attributes = VMM_HE_USED;
|
||||
return (void *)(he->base);
|
||||
}
|
||||
}
|
||||
he = (HeapEntry *)he->link;
|
||||
if (!he)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// This function coalesces any two adjacent heap entries into one entry
|
||||
void vmm_coalesceHeapEntry(HeapEntry *he)
|
||||
{
|
||||
if (!(he->attributes == VMM_HE_FREE || he->attributes == VMM_HE_HOLE))
|
||||
return;
|
||||
if (he->size == 0)
|
||||
{
|
||||
he->attributes = VMM_HE_UNUSED;
|
||||
return;
|
||||
}
|
||||
HeapEntry *hec = firstHeapEntry;
|
||||
for (;;)
|
||||
{
|
||||
if (hec->attributes == he->attributes)
|
||||
{
|
||||
if ((hec->base + hec->size) == he->base) //hec ends where he begins
|
||||
{
|
||||
he->base = hec->base;
|
||||
he->size += hec->size;
|
||||
hec->attributes = VMM_HE_UNUSED;
|
||||
}
|
||||
if ((he->base + he->size) == hec->base) //he ends where hec begins
|
||||
{
|
||||
he->size += hec->size;
|
||||
hec->attributes = VMM_HE_UNUSED;
|
||||
}
|
||||
}
|
||||
hec = (HeapEntry *)hec->link;
|
||||
if (!hec)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function retrieves more physical memory for the heap
|
||||
int vmm_moreCore(unsigned int bytes)
|
||||
{
|
||||
unsigned int pages = (bytes >> 12) + 1;
|
||||
bytes = pages << 12;
|
||||
HeapEntry *he = vmm_getFirstHoleHeapEntry(bytes);
|
||||
unsigned int virt = he->base;
|
||||
for (; pages > 0; pages--)
|
||||
{
|
||||
unsigned int phys = (unsigned int)mm_palloc();
|
||||
if (!phys)
|
||||
return 1;
|
||||
vmm_map1(virt, phys);
|
||||
virt += 4096;
|
||||
}
|
||||
if (he->size == bytes)
|
||||
{
|
||||
he->attributes = VMM_HE_FREE;
|
||||
vmm_coalesceHeapEntry(he);
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapEntry *nhe = vmm_nextHeapEntry();
|
||||
nhe->base = he->base;
|
||||
nhe->size = bytes;
|
||||
nhe->attributes = VMM_HE_FREE;
|
||||
he->base += bytes;
|
||||
he->size -= bytes;
|
||||
vmm_coalesceHeapEntry(nhe);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// This function returns the next available heap entry, creates more entries if we are running low
|
||||
HeapEntry *vmm_nextHeapEntry()
|
||||
{
|
||||
if (vmm_heapEntriesLeft() < 10)
|
||||
vmm_addHeapEntryBlock();
|
||||
return vmm_getFirstUnusedHeapEntry();
|
||||
}
|
||||
|
||||
|
||||
// This function creates a new block (page) of heap entries (256)
|
||||
void vmm_addHeapEntryBlock()
|
||||
{
|
||||
HeapEntry *he = vmm_getFirstHoleHeapEntry(4096);
|
||||
HeapEntry *newBlock = vmm_getFirstUnusedHeapEntry();
|
||||
unsigned int heb = (unsigned int)mm_palloc();
|
||||
vmm_map1(he->base, heb);
|
||||
vmm_heb_init((HeapEntryBlock *)he->base);
|
||||
HeapEntry *lhe = vmm_getLastHeapEntry();
|
||||
if (he->size == 4096)
|
||||
{
|
||||
he->attributes = VMM_HE_HEB;
|
||||
lhe->link = (unsigned int)he->base;
|
||||
}
|
||||
else
|
||||
{
|
||||
newBlock->base = he->base;
|
||||
newBlock->size = 4096;
|
||||
newBlock->attributes = VMM_HE_HEB;
|
||||
he->base += 4096;
|
||||
he->size -= 4096;
|
||||
lhe->link = (unsigned int)newBlock->base;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// This function returns the last heap entry in the linked list, useful for setting
|
||||
// its link field to point to the first entry of a newly allocated list
|
||||
HeapEntry *vmm_getLastHeapEntry()
|
||||
{
|
||||
HeapEntry *he = firstHeapEntry;
|
||||
for (;;)
|
||||
{
|
||||
if (he->link == 0)
|
||||
return he;
|
||||
he = (HeapEntry *)he->link;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function returns the first heap entry corresponding to a memory "hole"
|
||||
HeapEntry *vmm_getFirstHoleHeapEntry(unsigned int minBytes)
|
||||
{
|
||||
HeapEntry *he = firstHeapEntry;
|
||||
for (;;)
|
||||
{
|
||||
if ((he->attributes == VMM_HE_HOLE) && (he->size >= minBytes))
|
||||
return he;
|
||||
he = (HeapEntry *)he->link;
|
||||
if (!he)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// This function returns the first heap entry that is not being used
|
||||
HeapEntry *vmm_getFirstUnusedHeapEntry()
|
||||
{
|
||||
HeapEntry *he = firstHeapEntry;
|
||||
for (;;)
|
||||
{
|
||||
if (he->attributes == VMM_HE_UNUSED)
|
||||
return he;
|
||||
he = (HeapEntry *)he->link;
|
||||
if (!he)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// This function returns the number of heap entries available for use
|
||||
unsigned int vmm_heapEntriesLeft()
|
||||
{
|
||||
HeapEntry *he = firstHeapEntry;
|
||||
unsigned int entries = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (he->attributes == VMM_HE_UNUSED)
|
||||
entries++;
|
||||
he = (HeapEntry *)he->link;
|
||||
if (!he)
|
||||
break;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
// This function "frees" an area of memory previously allocated with malloc()
|
||||
int free(void *ptr)
|
||||
{
|
||||
HeapEntry *he = vmm_getHeapEntryByBase((unsigned int)ptr);
|
||||
if (!he)
|
||||
return 1; //a heap entry starting at the given address was not found
|
||||
he->attributes = VMM_HE_FREE;
|
||||
vmm_coalesceHeapEntry(he);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// This function scans the heap entry linked list for an entry that begins at the given address
|
||||
HeapEntry *vmm_getHeapEntryByBase(unsigned int base)
|
||||
{
|
||||
HeapEntry *he = firstHeapEntry;
|
||||
for (;;)
|
||||
{
|
||||
if (he->base == base)
|
||||
return he;
|
||||
he = (HeapEntry *)he->link;
|
||||
if (!he)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// vmm.h
|
||||
// Author: Josh Holtrop
|
||||
// Date: 09/30/03
|
||||
// Rewritten from scratch: 12/23/03
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_VMM__
|
||||
#define __HOS_VMM__ __HOS_VMM__
|
||||
|
||||
#define VMM_HE_UNUSED 0 //available entry
|
||||
#define VMM_HE_FREE 1 //free section of memory
|
||||
#define VMM_HE_USED 2 //used section of memory
|
||||
#define VMM_HE_HOLE 3 //a "hole" (unmapped) section of virtual memory
|
||||
#define VMM_HE_HEB 4 //HeapEntryBlock
|
||||
|
||||
#define VMM_MALLOC_GRANULARITY 4 //granularity for all memory requests
|
||||
|
||||
typedef struct {
|
||||
unsigned int base; //virtual base address
|
||||
unsigned int size; //size in bytes
|
||||
unsigned int attributes; //free/used/hole
|
||||
unsigned int link; //link to next HeapEntry
|
||||
} __attribute__((packed)) HeapEntry;
|
||||
|
||||
|
||||
typedef struct {
|
||||
HeapEntry entry[256]; //256 HeapEntry objects = 4kb (1 page)
|
||||
} __attribute__((packed)) HeapEntryBlock;
|
||||
|
||||
|
||||
void vmm_init();
|
||||
void *malloc(unsigned int bytes);
|
||||
int free(void *ptr);
|
||||
void vmm_map1(unsigned int virt, unsigned int physical);
|
||||
void vmm_mapn(unsigned int virt, unsigned int physical, unsigned int n);
|
||||
void vmm_unmap1(unsigned int virt);
|
||||
void vmm_unmapn(unsigned int virt, unsigned int n);
|
||||
void vmm_heb_init(HeapEntryBlock *heb);
|
||||
void *vmm_getFreeChunk(unsigned int bytes);
|
||||
HeapEntry *vmm_nextHeapEntry();
|
||||
unsigned int vmm_heapEntriesLeft();
|
||||
HeapEntry *vmm_getLastHeapEntry();
|
||||
HeapEntry *vmm_getFirstUnusedHeapEntry();
|
||||
HeapEntry *vmm_getFirstHoleHeapEntry(unsigned int minBytes);
|
||||
void vmm_addHeapEntryBlock();
|
||||
int vmm_moreCore(unsigned int bytes);
|
||||
void vmm_coalesceHeapEntry(HeapEntry *he);
|
||||
HeapEntry *vmm_getHeapEntryByBase(unsigned int base);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
// string.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements string functions
|
||||
|
||||
#include "string.h"
|
||||
|
||||
char *strcat(char *dest, char *src)
|
||||
{
|
||||
strcpy(dest+strlen(dest), src);
|
||||
}
|
||||
|
||||
|
||||
//Splits a string into multiple strings by turning all characters
|
||||
// equal to delim into null values (string termination character)
|
||||
//Returns the number of strings after the split, 1 if no delim chars
|
||||
int string_split(char *str, char delim)
|
||||
{
|
||||
if (strlen(str) < 1)
|
||||
return 0; //empty string
|
||||
int count = 1;
|
||||
for (; *str; str++)
|
||||
{
|
||||
if (*str == delim)
|
||||
{
|
||||
count++;
|
||||
*str = 0;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
//Advances a char pointer to the byte after the current string's
|
||||
// null-terminating character
|
||||
//Useful after calling string_split()
|
||||
//Returns a pointer to the following string
|
||||
char *string_advance(char *str)
|
||||
{
|
||||
for (; *str; str++);
|
||||
return str+1;
|
||||
}
|
||||
|
||||
|
||||
void rtrim(char *str)
|
||||
{
|
||||
str += strlen(str); //now points to the null character at the end of the string
|
||||
str--;
|
||||
for (;;)
|
||||
{
|
||||
if ((*str == ' ') || (*str == '\t') || (*str == '\n'))
|
||||
*str-- = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *ucase(char *str)
|
||||
{
|
||||
char *ret = str;
|
||||
for (;;)
|
||||
{
|
||||
if (*str == 0)
|
||||
break;
|
||||
if ((*str >= 'a') && (*str <= 'z'))
|
||||
*str = (*str) - 32;
|
||||
str++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
char *lcase(char *str)
|
||||
{
|
||||
char *ret = str;
|
||||
for (;;)
|
||||
{
|
||||
if (*str == 0)
|
||||
break;
|
||||
if ((*str >= 'A') && (*str <= 'Z'))
|
||||
*str = (*str) + 32;
|
||||
str++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// strings.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements string functions
|
||||
|
||||
#ifndef __HOS_STRING__
|
||||
#define __HOS_STRING__ __HOS_STRING__
|
||||
|
||||
char *strcat(char *dest, char *src);
|
||||
int string_split(char *str, char delim);
|
||||
char *string_advance(char *str);
|
||||
void rtrim(char *str);
|
||||
char *ucase(char *str);
|
||||
char *lcase(char *str);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// cmos.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements various CMOS function calls
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "cmos.h"
|
||||
|
||||
//Returns the cmos type of floppy disk drive 0 (0 = not present)
|
||||
unsigned char cmos_getfd0()
|
||||
{
|
||||
outportb(0x70, 0x10);
|
||||
return (inportb(0x71) >> 4);
|
||||
}
|
||||
|
||||
|
||||
//Returns the cmos type of floppy disk drive 1 (0 = not present)
|
||||
unsigned char cmos_getfd1()
|
||||
{
|
||||
outportb(0x70, 0x10);
|
||||
return (inportb(0x71) & 0x0F);
|
||||
}
|
||||
|
||||
|
||||
//Returns the cmos type of hard disk drive 0 (0 = not present)
|
||||
unsigned char cmos_gethd0()
|
||||
{
|
||||
outportb(0x70, 0x12);
|
||||
return (inportb(0x71) >> 4);
|
||||
}
|
||||
|
||||
|
||||
//Returns the cmos type of hard disk drive 1 (0 = not present)
|
||||
unsigned char cmos_gethd1()
|
||||
{
|
||||
outportb(0x70, 0x12);
|
||||
return (inportb(0x71) & 0x0F);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// cmos.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements various CMOS function calls
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_CMOS__
|
||||
#define __HOS_CMOS__ __HOS_CMOS__
|
||||
|
||||
unsigned char cmos_getfd0();
|
||||
unsigned char cmos_getfd1();
|
||||
unsigned char cmos_gethd0();
|
||||
unsigned char cmos_gethd1();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// io.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements basic port input/output functions
|
||||
|
||||
#include "io.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// io.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements basic port input/output functions
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_IO__
|
||||
#define __HOS_IO__ __HOS_IO__
|
||||
|
||||
inline void outportb(unsigned int port, unsigned char value);
|
||||
inline void outportw(unsigned int port, unsigned int value);
|
||||
inline unsigned char inportb(unsigned short port);
|
||||
|
||||
//Writes a byte out to a port
|
||||
inline void outportb(unsigned int port, unsigned char value) // Output a byte to a port
|
||||
{
|
||||
asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
|
||||
}
|
||||
|
||||
//Writes a word out to a port
|
||||
inline void outportw(unsigned int port, unsigned int value) // Output a word to a port
|
||||
{
|
||||
asm volatile ("outw %%ax,%%dx"::"d" (port), "a" (value));
|
||||
}
|
||||
|
||||
//Reads a byte from a port
|
||||
inline unsigned char inportb(unsigned short port)
|
||||
{
|
||||
unsigned char ret_val;
|
||||
|
||||
asm volatile("inb %w1,%b0"
|
||||
: "=a"(ret_val)
|
||||
: "d"(port));
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// pic.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "pic.h"
|
||||
|
||||
//Re-maps the Programmable Interrupr Controllers so IRQ0->pic1 base address, IRG8->pic2 base address
|
||||
void pic_remap(int pic1, int pic2)
|
||||
{
|
||||
byte a1, a2;
|
||||
|
||||
a1 = inportb(PIC1_DATA); //0x21
|
||||
a2 = inportb(PIC2_DATA); //0xA1
|
||||
|
||||
outportb(PIC1_COMMAND, ICW1_INIT+ICW1_ICW4); //0x20, 0x10+0x01 00010001b
|
||||
outportb(PIC2_COMMAND, ICW1_INIT+ICW1_ICW4); //0xA0, 0x10+0x01 00010001b
|
||||
outportb(PIC1_DATA, pic1); //0x21, pic1
|
||||
outportb(PIC2_DATA, pic2); //0xA1, pic2
|
||||
outportb(PIC1_DATA, 4); //0x21, 0x04 00000100b
|
||||
outportb(PIC2_DATA, 2); //0xA1, 0x02 00000010b
|
||||
outportb(PIC1_DATA, ICW4_8086); //0x21, 0x01 00000001b
|
||||
outportb(PIC2_DATA, ICW4_8086); //0xA1, 0x01 00000001b
|
||||
|
||||
outportb(PIC1_DATA, a1); //0x21
|
||||
outportb(PIC2_DATA, a2); //0xA1
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// pic.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_PIC__
|
||||
#define __HOS_PIC__ __HOS_PIC__
|
||||
|
||||
#define PIC1 0x20
|
||||
#define PIC2 0xA0
|
||||
#define PIC1_COMMAND PIC1
|
||||
#define PIC1_DATA (PIC1+1)
|
||||
#define PIC2_COMMAND PIC2
|
||||
#define PIC2_DATA (PIC2+1)
|
||||
#define PIC_EOI 0x20
|
||||
|
||||
#define ICW1_ICW4 0x01 /* ICW4 (not) needed */
|
||||
#define ICW1_SINGLE 0x02 /* Single (cascade) mode */
|
||||
#define ICW1_INTERVAL4 0x04 /* Call address interval 4 (8) */
|
||||
#define ICW1_LEVEL 0x08 /* Level triggered (edge) mode */
|
||||
#define ICW1_INIT 0x10 /* Initialization - required! */
|
||||
|
||||
#define ICW4_8086 0x01 /* 8086/88 (MCS-80/85) mode */
|
||||
#define ICW4_AUTO 0x02 /* Auto (normal) EOI */
|
||||
#define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
|
||||
#define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
|
||||
#define ICW4_SFNM 0x10 /* Special fully nested (not) */
|
||||
|
||||
void pic_remap(int pic1, int pic2);
|
||||
inline void pic_mask1(byte mask);
|
||||
inline void pic_mask2(byte mask);
|
||||
inline void pic_eoi();
|
||||
inline void pic_eoi2();
|
||||
|
||||
//Masks interrupts on first Programmable Interrupt Controller
|
||||
inline void pic_mask1(byte mask)
|
||||
{
|
||||
outportb(PIC1_DATA, mask); //0x21, maskfield *OCW1*
|
||||
}
|
||||
|
||||
//Masks interrupts on second Programmable Interrupt Controller
|
||||
inline void pic_mask2(byte mask)
|
||||
{
|
||||
outportb(PIC2_DATA, mask); //0xA1, maskfield *OCW1*
|
||||
}
|
||||
|
||||
|
||||
//Signals an End Of Interrupt signal to the first PIC
|
||||
inline void pic_eoi()
|
||||
{
|
||||
outportb(0x20, 0x20);
|
||||
}
|
||||
|
||||
//Signals an End Of Interrupt signal to both the second and first PIC unit
|
||||
inline void pic_eoi2()
|
||||
{
|
||||
outportb(0xA0, 0x20);
|
||||
outportb(0x20, 0x20);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
// rtc.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements Real-Time Clock function calls
|
||||
// These functions are for reading and writing various values stored on the CMOS Real Time Clock
|
||||
// Parameters / return values are in BCD format
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "rtc.h"
|
||||
|
||||
unsigned char rtc_readDay()
|
||||
{
|
||||
outportb(0x70, 7);
|
||||
return inportb(0x71);
|
||||
}
|
||||
|
||||
unsigned char rtc_readMonth()
|
||||
{
|
||||
outportb(0x70, 8);
|
||||
return inportb(0x71);
|
||||
}
|
||||
|
||||
unsigned char rtc_readYear()
|
||||
{
|
||||
outportb(0x70, 9);
|
||||
return inportb(0x71);
|
||||
}
|
||||
|
||||
unsigned char rtc_readSecond()
|
||||
{
|
||||
outportb(0x70, 0);
|
||||
return inportb(0x71);
|
||||
}
|
||||
|
||||
unsigned char rtc_readMinute()
|
||||
{
|
||||
outportb(0x70, 2);
|
||||
return inportb(0x71);
|
||||
}
|
||||
|
||||
unsigned char rtc_readHour()
|
||||
{
|
||||
outportb(0x70, 4);
|
||||
return inportb(0x71);
|
||||
}
|
||||
|
||||
void rtc_setDay(unsigned char day)
|
||||
{
|
||||
outportb(0x70, 7);
|
||||
outportb(0x71, day);
|
||||
}
|
||||
|
||||
void rtc_setMonth(unsigned char month)
|
||||
{
|
||||
outportb(0x70, 8);
|
||||
outportb(0x71, month);
|
||||
}
|
||||
|
||||
void rtc_setYear(unsigned char year)
|
||||
{
|
||||
outportb(0x70, 9);
|
||||
outportb(0x71, year);
|
||||
}
|
||||
|
||||
void rtc_setSecond(unsigned char second)
|
||||
{
|
||||
outportb(0x70, 0);
|
||||
outportb(0x71, second);
|
||||
}
|
||||
|
||||
void rtc_setMinute(unsigned char minute)
|
||||
{
|
||||
outportb(0x70, 2);
|
||||
outportb(0x71, minute);
|
||||
}
|
||||
|
||||
void rtc_setHour(unsigned char hour)
|
||||
{
|
||||
outportb(0x70, 4);
|
||||
outportb(0x71, hour);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// rtc.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Implements Real-Time Clock function calls
|
||||
// These functions are for reading and writing various values stored on the CMOS Real Time Clock
|
||||
// Parameters / return values are in BCD format
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_RTC__
|
||||
#define __HOS_RTC__ __HOS_RTC__
|
||||
|
||||
unsigned char rtc_readDay();
|
||||
unsigned char rtc_readMonth();
|
||||
unsigned char rtc_readYear();
|
||||
unsigned char rtc_readSecond();
|
||||
unsigned char rtc_readMinute();
|
||||
unsigned char rtc_readHour();
|
||||
void rtc_setDay(unsigned char dat);
|
||||
void rtc_setMonth(unsigned char month);
|
||||
void rtc_setYear(unsigned char year);
|
||||
void rtc_setSecond(unsigned char second);
|
||||
void rtc_setMinute(unsigned char minute);
|
||||
void rtc_setHour(unsigned char hour);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,545 @@
|
||||
// stdfont.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
|
||||
#include "stdfont.h"
|
||||
|
||||
const unsigned char stdfont8x5[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xE0, 0xC0, 0x80,
|
||||
0x00, 0x08, 0x18, 0x38, 0x78, 0x38, 0x18, 0x08,
|
||||
0x00, 0x20, 0x70, 0xA8, 0x20, 0xA8, 0x70, 0x20,
|
||||
0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0x00, 0xA0, 0xA0,
|
||||
0x00, 0x78, 0xA8, 0xA8, 0x78, 0x28, 0x28, 0x68,
|
||||
0x00, 0x78, 0x80, 0x70, 0x88, 0x70, 0x08, 0xF0,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8,
|
||||
0x00, 0x20, 0x70, 0xA8, 0x20, 0xA8, 0x70, 0xF8,
|
||||
0x00, 0x20, 0x70, 0xA8, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x20, 0x20, 0x20, 0x20, 0xA8, 0x70, 0x20,
|
||||
0x00, 0x00, 0x20, 0x10, 0xF8, 0x10, 0x20, 0x00,
|
||||
0x00, 0x00, 0x20, 0x40, 0xF8, 0x40, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x20, 0x70, 0xF8, 0xF8, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF8, 0xF8, 0x70, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20,
|
||||
0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x50, 0xF8, 0x50, 0x50, 0x50, 0xF8, 0x50,
|
||||
0x00, 0x20, 0x78, 0xA0, 0x70, 0x28, 0xF0, 0x20,
|
||||
0x00, 0x00, 0x08, 0x90, 0x20, 0x48, 0x80, 0x00,
|
||||
0x00, 0x20, 0x50, 0x50, 0x20, 0x58, 0x90, 0x68,
|
||||
0x00, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20,
|
||||
0x00, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40,
|
||||
0x00, 0x00, 0xA8, 0x70, 0xF8, 0x70, 0xA8, 0x00,
|
||||
0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
|
||||
0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
|
||||
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0x20, 0x60, 0xA0, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x40, 0xF8,
|
||||
0x00, 0x70, 0x88, 0x08, 0x10, 0x08, 0x88, 0x70,
|
||||
0x00, 0x30, 0x50, 0x90, 0x90, 0xF8, 0x10, 0x10,
|
||||
0x00, 0xF8, 0x80, 0x80, 0xF8, 0x08, 0x88, 0x70,
|
||||
0x00, 0x38, 0x40, 0x80, 0xF0, 0x88, 0x88, 0x70,
|
||||
0x00, 0xF8, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40,
|
||||
0x00, 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70,
|
||||
0x00, 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60,
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x40,
|
||||
0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10,
|
||||
0x00, 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00,
|
||||
0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80,
|
||||
0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x00, 0x20,
|
||||
0x00, 0x70, 0x88, 0x88, 0xB8, 0xB0, 0x80, 0x78,
|
||||
0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
|
||||
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x88, 0x88, 0xF0,
|
||||
0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70,
|
||||
0x00, 0xF0, 0x88, 0x88, 0x88, 0x88, 0x88, 0xF0,
|
||||
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8,
|
||||
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80,
|
||||
0x00, 0x70, 0x88, 0x80, 0xB8, 0x88, 0x88, 0x70,
|
||||
0x00, 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
|
||||
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60,
|
||||
0x00, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88,
|
||||
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF8,
|
||||
0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88, 0x88,
|
||||
0x00, 0x88, 0xC8, 0xE8, 0xB8, 0x98, 0x88, 0x88,
|
||||
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80,
|
||||
0x00, 0x70, 0x88, 0x88, 0x88, 0xA8, 0x98, 0x70,
|
||||
0x00, 0xF0, 0x88, 0x88, 0xF0, 0xA0, 0x90, 0x88,
|
||||
0x00, 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70,
|
||||
0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20,
|
||||
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0xA8, 0x50,
|
||||
0x00, 0x88, 0x50, 0x20, 0x20, 0x50, 0x88, 0x88,
|
||||
0x00, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0xF8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xF8,
|
||||
0x00, 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70,
|
||||
0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, 0x00,
|
||||
0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0xE0,
|
||||
0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
|
||||
0x00, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78,
|
||||
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0xF0,
|
||||
0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70,
|
||||
0x00, 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78,
|
||||
0x00, 0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x78,
|
||||
0x00, 0x30, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40,
|
||||
0x00, 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x70,
|
||||
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0x88,
|
||||
0x00, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x90, 0x60,
|
||||
0x00, 0x80, 0x80, 0x90, 0xA0, 0xC0, 0xA0, 0x90,
|
||||
0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0xE0,
|
||||
0x00, 0x00, 0x00, 0xD0, 0xA8, 0xA8, 0xA8, 0xA8,
|
||||
0x00, 0x00, 0x00, 0xF0, 0x88, 0x88, 0x88, 0x88,
|
||||
0x00, 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0x00, 0x00, 0xF0, 0x88, 0xF0, 0x80, 0x80,
|
||||
0x00, 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x38,
|
||||
0x00, 0x00, 0x00, 0x70, 0x48, 0x40, 0x40, 0x40,
|
||||
0x00, 0x00, 0x00, 0x78, 0x80, 0x70, 0x08, 0xF0,
|
||||
0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x20,
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20,
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xA8, 0x50,
|
||||
0x00, 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88,
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0x78, 0x08, 0xF0,
|
||||
0x00, 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8,
|
||||
0x00, 0x30, 0x40, 0x40, 0x80, 0x40, 0x40, 0x30,
|
||||
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0xC0, 0x20, 0x20, 0x10, 0x20, 0x20, 0xC0,
|
||||
0x00, 0x00, 0x68, 0x90, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
|
||||
0x00, 0xF8, 0x88, 0x80, 0xF0, 0x88, 0x88, 0xF0,
|
||||
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x88, 0x88, 0xF0,
|
||||
0x00, 0xF8, 0x48, 0x40, 0x40, 0x40, 0x40, 0xE0,
|
||||
0x00, 0xF0, 0x50, 0x50, 0x50, 0x50, 0x78, 0x88,
|
||||
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8,
|
||||
0x00, 0xA8, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0xA8,
|
||||
0x00, 0x70, 0x88, 0x08, 0x30, 0x08, 0x88, 0x70,
|
||||
0x00, 0x88, 0x98, 0xA8, 0xA8, 0xA8, 0xC8, 0x88,
|
||||
0x00, 0xA8, 0xC8, 0x98, 0xA8, 0xA8, 0xC8, 0x88,
|
||||
0x00, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88,
|
||||
0x00, 0xF8, 0x50, 0x50, 0x50, 0x50, 0x50, 0x90,
|
||||
0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88, 0x88,
|
||||
0x00, 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
|
||||
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
|
||||
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80,
|
||||
0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70,
|
||||
0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x40, 0x80,
|
||||
0x00, 0x70, 0x20, 0xF8, 0xA8, 0xF8, 0x20, 0x70,
|
||||
0x00, 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88,
|
||||
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0xF8, 0x08,
|
||||
0x00, 0x88, 0x88, 0x88, 0xF8, 0x08, 0x08, 0x38,
|
||||
0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8,
|
||||
0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8, 0x08,
|
||||
0x00, 0xC0, 0x40, 0x40, 0x78, 0x48, 0x48, 0x78,
|
||||
0x00, 0x88, 0x88, 0xC8, 0xA8, 0xA8, 0xA8, 0xE8,
|
||||
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0xF0,
|
||||
0x00, 0xF0, 0x88, 0x08, 0x78, 0x08, 0x88, 0xF0,
|
||||
0x00, 0x90, 0xA8, 0xA8, 0xE8, 0xA8, 0xA8, 0x90,
|
||||
0x00, 0x78, 0x88, 0x88, 0x78, 0x28, 0x48, 0x88,
|
||||
0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x88, 0x78,
|
||||
0x00, 0x00, 0xF8, 0x80, 0xF0, 0x88, 0x88, 0xF0,
|
||||
0x00, 0x00, 0xF0, 0x88, 0xF0, 0x88, 0x88, 0xF0,
|
||||
0x00, 0x00, 0xF8, 0x48, 0x48, 0x40, 0x40, 0xE0,
|
||||
0x00, 0x00, 0x78, 0x50, 0x50, 0x50, 0x70, 0x88,
|
||||
0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x88, 0x70,
|
||||
0x00, 0x00, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0xA8,
|
||||
0x00, 0x00, 0x00, 0xF0, 0x88, 0x30, 0x88, 0x70,
|
||||
0x00, 0x00, 0x88, 0x98, 0xA8, 0xC8, 0x88, 0x88,
|
||||
0x00, 0x50, 0x20, 0x88, 0x98, 0xA8, 0xC8, 0x88,
|
||||
0x00, 0x00, 0x88, 0x90, 0xA0, 0xE0, 0x90, 0x88,
|
||||
0x00, 0x00, 0xF8, 0x48, 0x48, 0x48, 0x48, 0xC8,
|
||||
0x00, 0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88,
|
||||
0x00, 0x00, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
|
||||
0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x88,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x70, 0x50, 0x70, 0x08, 0x78, 0x88, 0x78,
|
||||
0x00, 0x88, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78,
|
||||
0x00, 0x88, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0x88, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
|
||||
0x00, 0x90, 0x00, 0xF0, 0x80, 0xE0, 0x80, 0xF0,
|
||||
0x00, 0x00, 0x70, 0x48, 0x70, 0x48, 0x48, 0xF0,
|
||||
0x00, 0x88, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x88, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x78,
|
||||
0x00, 0x70, 0x50, 0x70, 0x88, 0xF8, 0x88, 0x88,
|
||||
0x00, 0x88, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88,
|
||||
0x00, 0x88, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70,
|
||||
0x00, 0x88, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
|
||||
0x00, 0x88, 0xF8, 0x80, 0xE0, 0x80, 0x80, 0xF8,
|
||||
0x00, 0x40, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x78,
|
||||
0x00, 0x10, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x78,
|
||||
0x00, 0x20, 0x50, 0x70, 0x88, 0xF8, 0x80, 0x78,
|
||||
0x00, 0x40, 0x20, 0x70, 0x08, 0x78, 0x88, 0x78,
|
||||
0x00, 0x20, 0x50, 0x00, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x20, 0x10, 0x88, 0x88, 0x88, 0x88, 0x78,
|
||||
0x00, 0x00, 0x00, 0x70, 0x80, 0x80, 0x70, 0x20,
|
||||
0x00, 0x70, 0x88, 0x40, 0xF0, 0x40, 0x40, 0xF8,
|
||||
0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x88, 0x88, 0x88, 0xF0, 0x80, 0x80,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80,
|
||||
0x00, 0x00, 0x70, 0x88, 0x80, 0x80, 0x88, 0x70,
|
||||
0x00, 0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x00, 0x00, 0x88, 0x88, 0x50, 0x20, 0x40, 0x80,
|
||||
0x00, 0x00, 0x70, 0x20, 0xF8, 0xF8, 0x20, 0x70,
|
||||
0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88,
|
||||
0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0xF8, 0x08,
|
||||
0x00, 0x00, 0x88, 0x88, 0x88, 0xF8, 0x08, 0x38,
|
||||
0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8,
|
||||
0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8, 0x08,
|
||||
0x00, 0x00, 0xC0, 0x40, 0x70, 0x48, 0x48, 0x70,
|
||||
0x00, 0x00, 0x88, 0x88, 0xC8, 0xA8, 0xA8, 0xE8,
|
||||
0x00, 0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0xF0,
|
||||
0x00, 0x00, 0x70, 0x88, 0x38, 0x08, 0x88, 0x70,
|
||||
0x00, 0x00, 0x90, 0xA8, 0xA8, 0xE8, 0xA8, 0x90,
|
||||
0x00, 0x00, 0x38, 0x48, 0x48, 0x38, 0x28, 0x48,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
const unsigned char stdfont10x7[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0xE0, 0xF0, 0xFC, 0xF0, 0xE0, 0x80, 0x00, 0x00,
|
||||
0x00, 0x02, 0x0E, 0x1E, 0x7E, 0x1E, 0x0E, 0x02, 0x00, 0x00,
|
||||
0x00, 0x10, 0x7C, 0x92, 0x10, 0x92, 0x7C, 0x10, 0x00, 0x00,
|
||||
0x00, 0x90, 0x90, 0x90, 0x90, 0x00, 0x90, 0x90, 0x00, 0x00,
|
||||
0x00, 0x7E, 0x92, 0x92, 0x7E, 0x12, 0x12, 0x72, 0x00, 0x00,
|
||||
0x00, 0x7E, 0x80, 0x7C, 0x82, 0x7C, 0x02, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x10, 0x7C, 0x92, 0x10, 0x92, 0x7C, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x10, 0x7C, 0x92, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x10, 0x10, 0x10, 0x10, 0x92, 0x7C, 0x10, 0x00, 0x00,
|
||||
0x00, 0x00, 0x08, 0x04, 0xFE, 0x04, 0x08, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x20, 0x40, 0xFE, 0x40, 0x20, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x70, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x10, 0x7C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0xFE, 0x7C, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x44, 0xFE, 0x44, 0x44, 0x44, 0xFE, 0x44, 0x00, 0x00,
|
||||
0x00, 0x10, 0x7E, 0x90, 0x7C, 0x12, 0xFC, 0x10, 0x00, 0x00,
|
||||
0x00, 0x00, 0x04, 0x88, 0x10, 0x22, 0x40, 0x00, 0x00, 0x00,
|
||||
0x00, 0x38, 0x44, 0x44, 0x78, 0x86, 0x84, 0x7A, 0x00, 0x00,
|
||||
0x00, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00, 0x00,
|
||||
0x00, 0x40, 0x20, 0x10, 0x10, 0x10, 0x20, 0x40, 0x00, 0x00,
|
||||
0x00, 0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
|
||||
0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x02, 0x7C, 0x80, 0x80, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x02, 0x0C, 0x02, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x38, 0x48, 0x88, 0x88, 0xFE, 0x08, 0x08, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x80, 0x80, 0xFE, 0x02, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x3E, 0x40, 0x80, 0xFC, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0x7C, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0x7E, 0x02, 0x02, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x60, 0x00, 0x00,
|
||||
0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x02, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0x9A, 0x9C, 0x80, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x80, 0x80, 0xFC, 0x80, 0x80, 0xFE, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x80, 0x80, 0xFC, 0x80, 0x80, 0x80, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x80, 0x9E, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
|
||||
0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x84, 0x88, 0x90, 0xE0, 0x90, 0x88, 0x84, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x82, 0xEE, 0x92, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x82, 0xC2, 0xA2, 0x92, 0x8A, 0x86, 0x82, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x80, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0x82, 0x92, 0x8A, 0x7C, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x88, 0x84, 0x82, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x80, 0x7C, 0x02, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x6C, 0x00, 0x00,
|
||||
0x00, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x02, 0x0C, 0x10, 0x60, 0x80, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0x78, 0x00, 0x00,
|
||||
0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00,
|
||||
0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x00, 0x00,
|
||||
0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0xFC, 0x82, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7C, 0x82, 0x80, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x02, 0x02, 0x7E, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x30, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7E, 0x82, 0x82, 0x82, 0x7E, 0x02, 0x7C,
|
||||
0x00, 0x80, 0x80, 0xF8, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
|
||||
0x00, 0x40, 0x00, 0xC0, 0x40, 0x40, 0x40, 0xE0, 0x00, 0x00,
|
||||
0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60,
|
||||
0x00, 0x80, 0x80, 0x88, 0xB0, 0xC0, 0xB0, 0x88, 0x00, 0x00,
|
||||
0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0xE0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xEC, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xF8, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7C, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFC, 0x82, 0x82, 0x82, 0xFC, 0x80, 0x80,
|
||||
0x00, 0x00, 0x00, 0x7C, 0x84, 0x84, 0x84, 0x7C, 0x04, 0x3C,
|
||||
0x00, 0x00, 0x00, 0xB8, 0x44, 0x40, 0x40, 0x40, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7C, 0x80, 0x78, 0x04, 0xF8, 0x00, 0x00,
|
||||
0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x92, 0x6C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x7C, 0x04, 0xF8,
|
||||
0x00, 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8, 0x00, 0x00,
|
||||
0x00, 0x18, 0x20, 0x20, 0x40, 0x20, 0x20, 0x18, 0x00, 0x00,
|
||||
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x60, 0x10, 0x10, 0x08, 0x10, 0x10, 0x60, 0x00, 0x00,
|
||||
0x00, 0x00, 0x72, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x82, 0x80, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x62, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x6C, 0x6C, 0x6C, 0x6C, 0x7E, 0x82, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x80, 0x80, 0xFC, 0x80, 0x80, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x92, 0x92, 0x7C, 0x10, 0x7C, 0x92, 0x92, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x02, 0x1C, 0x02, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x82, 0x8E, 0x92, 0x92, 0x92, 0xE2, 0x82, 0x00, 0x00,
|
||||
0x00, 0x92, 0xE2, 0x8E, 0x92, 0x92, 0xE2, 0x82, 0x00, 0x00,
|
||||
0x00, 0x82, 0x8C, 0x90, 0xE0, 0x90, 0x8C, 0x82, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x8C, 0x00, 0x00,
|
||||
0x00, 0x82, 0xEE, 0x92, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x80, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0x6C, 0x10, 0x60, 0x80, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x10, 0xFE, 0x92, 0xFE, 0x10, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x6C, 0x10, 0x6C, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x02, 0x1E, 0x00, 0x00,
|
||||
0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x02, 0x00, 0x00,
|
||||
0x00, 0xE0, 0x60, 0x60, 0x7E, 0x62, 0x62, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x82, 0x82, 0xE2, 0x92, 0x92, 0x92, 0xF2, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0xFC, 0x82, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x82, 0x02, 0x7E, 0x02, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x8C, 0x92, 0x92, 0xF2, 0x92, 0x92, 0x8C, 0x00, 0x00,
|
||||
0x00, 0x7E, 0x82, 0x82, 0x7E, 0x12, 0x62, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7C, 0x02, 0x7E, 0x82, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0x80, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x82, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0x62, 0x62, 0x60, 0x60, 0xF0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7E, 0x6C, 0x6C, 0x6C, 0x7C, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7C, 0x82, 0xFE, 0x80, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x92, 0x7C, 0x10, 0x7C, 0x92, 0x92, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFC, 0x82, 0x1C, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x8E, 0x92, 0xE2, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x6C, 0x10, 0x82, 0x8E, 0x92, 0xE2, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x8C, 0x90, 0xF0, 0x8C, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0x62, 0x62, 0x62, 0x62, 0xE2, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0xEE, 0x92, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x44, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x44, 0x00, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x44, 0x00, 0x7C, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x82, 0x00, 0x82, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x8C, 0x00, 0xFC, 0x80, 0xF0, 0x80, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7C, 0x62, 0x7C, 0x62, 0x62, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x82, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x82, 0x00, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x44, 0x7C, 0x82, 0xFE, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x82, 0x7C, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x82, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x82, 0x00, 0x82, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x82, 0xFE, 0x80, 0xF0, 0x80, 0x80, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x60, 0x10, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x0C, 0x10, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x10, 0x6C, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x60, 0x10, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x10, 0x6C, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x10, 0x0C, 0x82, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7C, 0x80, 0x80, 0x7C, 0x10, 0x00, 0x00,
|
||||
0x00, 0x7C, 0x82, 0x60, 0xFC, 0x60, 0x60, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7C, 0x82, 0x80, 0x80, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x82, 0x6C, 0x10, 0x60, 0x80, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7C, 0x10, 0xFE, 0xFE, 0x10, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x6C, 0x10, 0x6C, 0x82, 0x82, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x1E, 0x00, 0x00,
|
||||
0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x00, 0x00,
|
||||
0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x02, 0x00, 0x00,
|
||||
0x00, 0x00, 0xE0, 0x60, 0x7C, 0x62, 0x62, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x82, 0x82, 0xE2, 0x92, 0x92, 0xF2, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0x80, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7C, 0x82, 0x1E, 0x02, 0x82, 0x7C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x8C, 0x92, 0x92, 0xF2, 0x92, 0x8C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1E, 0x62, 0x62, 0x1E, 0x12, 0x62, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
StdFont fonts[] = {
|
||||
{stdfont8x5, 8, 5},
|
||||
{stdfont10x7, 10, 7}
|
||||
};
|
||||
|
||||
//Returns the standard font size, 0 = invalid font
|
||||
// bits 0-7 = font width
|
||||
// bits 8-15 = font height
|
||||
unsigned int stdfont_getFontSize(unsigned int fontNumber)
|
||||
{
|
||||
if (fontNumber >= STDFONTS)
|
||||
return 0;
|
||||
return (fonts[fontNumber].charHeight << 8) | fonts[fontNumber].charWidth;
|
||||
}
|
||||
|
||||
//Returns a pointer to the desired font's bitmap representation
|
||||
unsigned char *stdfont_getBitmap(unsigned int fontNumber)
|
||||
{
|
||||
if (fontNumber >= STDFONTS)
|
||||
return 0;
|
||||
return (unsigned char *)fonts[fontNumber].fontPtr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// stdfont.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Standard font server
|
||||
|
||||
#ifndef __HOS_STDFONT__
|
||||
#define __HOS_STDFONT__ __HOS_STDFONT__
|
||||
|
||||
#define STDFONTS 2
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *fontPtr;
|
||||
unsigned int charHeight;
|
||||
unsigned int charWidth;
|
||||
} StdFont;
|
||||
|
||||
//Returns the standard font size, 0 = invalid font
|
||||
// bits 0-7 = font width
|
||||
// bits 8-15 = font height
|
||||
unsigned int stdfont_getFontSize(unsigned int fontNumber);
|
||||
|
||||
//Returns a pointer to the desired font's bitmap representation
|
||||
unsigned char *stdfont_getBitmap(unsigned int fontNumber);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
// video.c
|
||||
// 08/13/03 Josh Holtrop
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
#include "video.h"
|
||||
|
||||
ModeInfoBlock video_mode;
|
||||
dword videoMode = 0; //what video mode # we are in, 0 for console mode
|
||||
word *vid_ptr16 = (word *)0xF0000000;
|
||||
byte *vid_ptr24 = (byte *)0xF0000000;
|
||||
dword *vid_ptr32 = (dword *)0xF0000000;
|
||||
word console_memory[2000]; //holds a copy of the console's memory
|
||||
void (*video_psetp)(int, dword) = video_psetpnull; //function pointer to set a pixel
|
||||
|
||||
//Initialized the video mode information block video_mode and allocated double-buffer memory for graphics display
|
||||
void video_init()
|
||||
{
|
||||
videoMode = *(word *)BOOT_VIDEO_MODE;
|
||||
|
||||
if (!videoMode) //we are in console mode
|
||||
return;
|
||||
|
||||
video_mode = *(ModeInfoBlock *) BOOT_VIDEO_MODE_INFO_BLOCK;
|
||||
|
||||
switch(video_mode.BitsPerPixel)
|
||||
{
|
||||
case 16:
|
||||
video_psetp = &video_psetp16;
|
||||
break;
|
||||
case 24:
|
||||
video_psetp = &video_psetp24;
|
||||
break;
|
||||
case 32:
|
||||
video_psetp = &video_psetp32;
|
||||
}
|
||||
}
|
||||
|
||||
//Renders a character using stdfont[] as a bitmask
|
||||
void video_renderChar(int x, int y, int character, dword color)
|
||||
{
|
||||
int charpos = (character & 0xFF) * 8;
|
||||
int row;
|
||||
int col;
|
||||
for (row = 0; row < 8; row++)
|
||||
{
|
||||
for (col = 0; col < 5; col++)
|
||||
{
|
||||
if ((stdfont[charpos+row] >> (col+3)) & 0x01)
|
||||
video_pset(x+(5-col), y+row, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Draws a horizontal line
|
||||
void video_horiz(int y, int x1, int x2, dword color)
|
||||
{
|
||||
if (x1 > x2)
|
||||
{
|
||||
int tmp = x2;
|
||||
x2 = x1;
|
||||
x1 = tmp; //x2 >= x1 now
|
||||
}
|
||||
if (x2 < 0)
|
||||
return;
|
||||
if (x1 > video_mode.XResolution)
|
||||
return;
|
||||
if (x1 < 0)
|
||||
x1 = 0;
|
||||
if (x2 > video_mode.XResolution)
|
||||
x2 = video_mode.XResolution;
|
||||
int pixel = y*video_mode.XResolution+x1;
|
||||
for (; x1 <= x2; x1++)
|
||||
{
|
||||
video_psetp(pixel++, color);
|
||||
}
|
||||
}
|
||||
|
||||
//Draws a single pixel
|
||||
void video_pset(int x, int y, dword color)
|
||||
{
|
||||
if ((x < 0) || (x > video_mode.XResolution) || (y < 0) || (y > video_mode.YResolution))
|
||||
return;
|
||||
video_psetp(y*video_mode.XResolution+x, color);
|
||||
}
|
||||
|
||||
//Draws a pixel at the specified pixel position
|
||||
void video_pseti(int pixel, dword color)
|
||||
{
|
||||
video_psetp(pixel, color);
|
||||
}
|
||||
|
||||
//Draws a vertical line
|
||||
void video_vert(int x, int y1, int y2, dword color)
|
||||
{
|
||||
if (y1 > y2)
|
||||
{
|
||||
int tmp = y2;
|
||||
y2 = y1;
|
||||
y1 = tmp; //y2 >= y1 now
|
||||
}
|
||||
if (y2 < 0)
|
||||
return;
|
||||
if (y1 > video_mode.YResolution)
|
||||
return;
|
||||
if (y1 < 0)
|
||||
y1 = 0;
|
||||
if (y2 > video_mode.YResolution)
|
||||
y2 = video_mode.YResolution;
|
||||
int pixel = y1*video_mode.XResolution+x;
|
||||
for (; y1 <= y2; y1++)
|
||||
{
|
||||
video_psetp(pixel, color);
|
||||
pixel+=video_mode.XResolution;
|
||||
}
|
||||
}
|
||||
|
||||
//Draws a rectangle
|
||||
void video_rect(int x1, int y1, int x2, int y2, dword color)
|
||||
{
|
||||
video_horiz(y1, x1, x2, color);
|
||||
video_horiz(y2, x1, x2, color);
|
||||
video_vert(x1, y1, y2, color);
|
||||
video_vert(x2, y1, y2, color);
|
||||
}
|
||||
|
||||
//Draws a filled rectangle
|
||||
void video_rectf(int x1, int y1, int x2, int y2, dword color)
|
||||
{
|
||||
if (y2 < y1)
|
||||
{
|
||||
int tmp = y2;
|
||||
y2 = y1;
|
||||
y1 = tmp;
|
||||
}
|
||||
for (; y1 <= y2; y1++)
|
||||
video_horiz(y1, x1, x2, color);
|
||||
}
|
||||
|
||||
//Draws a pixel at the specified pixel position
|
||||
void video_psetp16(int pixel, dword color)
|
||||
{
|
||||
vid_ptr16[pixel] = ((color&0xFF)>>3) | ((((color>>8)&0xFF)>>2)<<5) | ((((color>>16)&0xFF)>>3)<<11);
|
||||
}
|
||||
|
||||
//Draws a pixel at the specified pixel position
|
||||
void video_psetp24(int pixel, dword color)
|
||||
{
|
||||
vid_ptr24[pixel*3] = color & 0xFF;
|
||||
vid_ptr24[pixel*3+1] = (color>>8) & 0xFF;
|
||||
vid_ptr24[pixel*3+2] = (color>>16) & 0xFF;
|
||||
}
|
||||
|
||||
//Draws a pixel at the specified pixel position
|
||||
void video_psetp32(int pixel, dword color)
|
||||
{
|
||||
vid_ptr32[pixel] = color;
|
||||
}
|
||||
|
||||
//Dummy function to not draw anything if there is no graphical mode enabled
|
||||
void video_psetpnull(int pixel, dword color) {}
|
||||
|
||||
|
||||
// This function draws a simple "console" window in graphical mode to display text
|
||||
void video_drawConsole()
|
||||
{
|
||||
video_rectf(9, 9, 490, 260, 0);
|
||||
video_rect(8, 8, 491, 261, 0x00777777);
|
||||
int x, y;
|
||||
for (x = 0; x < 80; x++)
|
||||
{
|
||||
for (y = 0; y < 25; y++)
|
||||
{
|
||||
video_renderChar(x*6+10, y*10+10, console_memory[y*80+x], 0x00FFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function draws a "console" character to the graphical video screen
|
||||
void video_drawConsoleChar(dword position)
|
||||
{
|
||||
int x = position % 80;
|
||||
int y = position / 80;
|
||||
video_renderChar(x*6+10, y*10+10, console_memory[y*80+x], 0x00FFFFFF);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// video.h
|
||||
// 08/18/03 Josh Holtrop
|
||||
// Modified: 03/02/04
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
#ifndef __HOS_VIDEO__
|
||||
#define __HOS_VIDEO__ __HOS_VIDEO__
|
||||
|
||||
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);
|
||||
void video_pset(int x, int y, dword color);
|
||||
void video_pseti(int pixel, dword color);
|
||||
void video_psetp16(int pixel, dword color);
|
||||
void video_psetp24(int pixel, dword color);
|
||||
void video_psetp32(int pixel, dword color);
|
||||
void video_psetpnull(int pixel, dword color);
|
||||
void video_renderChar(int x, int y, int character, dword color);
|
||||
void video_drawConsole();
|
||||
void video_drawConsoleChar(dword position);
|
||||
|
||||
|
||||
typedef struct{
|
||||
word ModeAttributes;
|
||||
byte WinAAttributes;
|
||||
byte WinBAttributes;
|
||||
word WinGranularity;
|
||||
word WinSize;
|
||||
word WinASegment;
|
||||
word WinBSegment;
|
||||
dword WinFuncPtr;
|
||||
word BytesPerScanLine;
|
||||
|
||||
word XResolution;
|
||||
word YResolution;
|
||||
byte XCharSize;
|
||||
byte YCharSize;
|
||||
byte NumberOfPlanes;
|
||||
byte BitsPerPixel;
|
||||
byte NumberOfBanks;
|
||||
byte MemoryModel;
|
||||
byte BankSize;
|
||||
byte NumberOfImagePages;
|
||||
byte Reserved1;
|
||||
|
||||
byte RedMaskSize;
|
||||
byte RedFieldPosition;
|
||||
byte GreenMaskSize;
|
||||
byte GreenFieldPosition;
|
||||
byte BlueMaskSize;
|
||||
byte BlueFieldPosition;
|
||||
byte RsvdMaskSize;
|
||||
byte RsvdFieldPosition;
|
||||
byte DirectColorModeInfo;
|
||||
|
||||
dword PhysBasePtr;
|
||||
dword OffScreenMemOffset;
|
||||
word OffScreenMemSize;
|
||||
byte Reserved[206];
|
||||
} ModeInfoBlock;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user