├── .gitignore ├── linker.ld ├── grub.cfg ├── include ├── stdlibc.h ├── types.h ├── vga.h └── multiboot2.h ├── makefile ├── src ├── boot │ ├── boot_keyboard.c │ ├── boot_stdlibc.c │ └── boot_vga.c ├── loader.s └── kernel.c ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | iso/ 2 | obj32/ 3 | obj64/ 4 | .vscode/ 5 | *.bin 6 | *.iso 7 | -------------------------------------------------------------------------------- /linker.ld: -------------------------------------------------------------------------------- 1 | ENTRY(loader) 2 | 3 | SECTIONS 4 | { 5 | . = 1M; 6 | 7 | .text : 8 | { 9 | . = ALIGN(8); 10 | KEEP(*(.multiboot)) 11 | *(.text*) 12 | *(.rodata) 13 | } 14 | .data : 15 | { 16 | *(.data) 17 | } 18 | 19 | .bss : 20 | { 21 | *(.bss) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /grub.cfg: -------------------------------------------------------------------------------- 1 | set timeout=0 2 | set default=0 3 | set gfxmode=1280x1024x32 4 | set gfxpayload=keep 5 | 6 | menuentry "My Operating System" { 7 | insmod multiboot 8 | multiboot /boot/mykernel.bin mykernel_arg1=myvalue 9 | # module /boot/module1.bin 10 | # insmod fat32 11 | # set root=(hd0,1) 12 | boot 13 | } 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /include/stdlibc.h: -------------------------------------------------------------------------------- 1 | #ifndef _STD_H 2 | #define _STD_H 1 3 | 4 | #include "types.h" 5 | 6 | /** 7 | * A bit of fancyness that allows us to sterotype functions and reuse the signatre, allowing us to 8 | * safely swap in and out functions at runtime. 9 | */ 10 | #define Fn_putchar(className) int className ## _putchar(uchar ch) 11 | typedef int (*PFn_putchar)(uchar); 12 | 13 | extern PFn_putchar putchar; 14 | 15 | int printf(const PChar restrict format, ...); 16 | int puts(const PChar str); 17 | 18 | Pointer memmove(Pointer dstptr, const Pointer srcptr, uint size); 19 | int memcmp(const Pointer aptr, const Pointer bptr, uint size); 20 | Pointer memcpy(Pointer restrict dstptr, const Pointer restrict srcptr, uint size); 21 | Pointer memset(Pointer bufptr, u8 value, uint size); 22 | 23 | uint strlen(const PChar str); 24 | PChar strcpy(PChar dest, const PChar src); 25 | 26 | void abort(void); 27 | 28 | u32 getAsciiKey(void); 29 | 30 | 31 | /** CHeck if a bit is set in an array*/ 32 | #define Bt(array, bit_index) \ 33 | ((array[(bit_index) / (sizeof(char) * 8)] & (1 << ((bit_index) % (sizeof(char) * 8)))) != 0) 34 | /** if clause to do basic array bounds check */ 35 | #define ifInside(index, size) if (index >= 0 && index < size) 36 | #endif -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | 2 | # sudo apt-get install g++ binutils libc6-dev-i386 3 | # sudo apt-get install VirtualBox grub-legacy xorriso 4 | 5 | GCCPARAMS = -Iinclude -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings -O2 6 | # GCCPARAMS = -Iinclude -fno-use-cxa-atexit -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings -O2 7 | # GCCPARAMS = -m32 -Iinclude -nostdlib -fno-builtin -fno-exceptions -fno-leading-underscore -Wno-write-strings -O2 8 | # ASPARAMS = --32 9 | # LDPARAMS = -melf_i386 10 | 11 | SRC_DIRS := src src/boot 12 | 13 | SRC_FILES_C := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) 14 | SRC_FILES_S := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.s)) 15 | SRC_FILES := $(SRC_FILES_C) $(SRC_FILES_S) 16 | 17 | run: mykernel.iso 18 | @echo "\033[0;32mRun VirtualBox\033[0m" 19 | # @cp mykernel.iso /mnt/d/VirtualBox\ VMs/ 20 | # @/mnt/d/VirtualBox/VBoxManage.exe startvm Multiboot 21 | qemu-system-x86_64 -m 500 -cdrom mykernel.iso 22 | 23 | 24 | mykernel.bin: linker.ld 25 | # just compile all the source files together 26 | @echo "\033[0;32mCompile mykernel.bin\033[0m" 27 | gcc -m32 $(GCCPARAMS) -T linker.ld -o mykernel.bin $(SRC_FILES) 28 | 29 | # gcc -Iinclude -fPIE -ffreestanding -T linker.ld -o mykernel2.bin $(SRC_FILES) 30 | 31 | mkdir obj32 obj64 32 | gcc -m32 -c $(GCCPARAMS) $(SRC_FILES) 33 | mv *.o obj32 34 | gcc -c $(GCCPARAMS) $(SRC_FILES) 35 | mv *.o obj64 36 | 37 | # ld -m elf_i386 $(GCCPARAMS) -nostdlib -T linker.ld -o mykernel2.bin obj/* 38 | 39 | mykernel.iso: mykernel.bin 40 | @echo "\033[0;32mMake mykernel.iso\033[0m" 41 | @mkdir iso 42 | @mkdir iso/boot 43 | @mkdir iso/boot/grub 44 | @cp mykernel.bin iso/boot/mykernel.bin 45 | @cp mykernel.bin iso/boot/module1.bin 46 | 47 | @cp grub.cfg iso/boot/grub/grub.cfg 48 | grub-mkrescue --output=mykernel.iso iso 49 | 50 | # install: mykernel.bin 51 | # sudo cp $< /boot/mykernel.bin 52 | 53 | .PHONY: clean 54 | clean: 55 | @echo "\033[0;32mClean mykernel.bin mykernel.iso iso\033[0m" 56 | rm -rf obj32 obj64 mykernel.bin mykernel.iso iso *.o 57 | -------------------------------------------------------------------------------- /src/boot/boot_keyboard.c: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | #include "stdlibc.h" 3 | #include 4 | 5 | 6 | 7 | /** scancode to ascii map*/ /* incomplete but works for ascii*/ 8 | static char *keymap = "\0`1234567890-=\0\tqwertyuiop[]\n\0asdfghjkl;'\0\0\\zxcvbnm,./\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; 9 | static char *keymapUppercase = "\0~!@#$%^&*()_+\0\tQWERTYUIOP{}\n\0ASDFGHJKL:\"\0\0\\ZXCVBNM<>?\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; 10 | 11 | static boolean shift = false, ctrl = false, alt = false; 12 | static u32 last = 0; 13 | 14 | /** 15 | * Poll to see if anything has changed since last time we checked 16 | * Only retursn change on key up 17 | */ 18 | u32 getAsciiKey() { 19 | // init 20 | if (last == 0) { 21 | last = inb(0x60); 22 | return 0; 23 | } 24 | /* 25 | keymap: 26 | db 0 27 | db '1234567890-=', bspace 28 | db tab,'qwertyuiop[]',enter_key 29 | db ctrl_key,'asdfghjkl;',39,'`',lshift 30 | db '\','zxcvbnm,./',rshift,prnscr,alt_key,' ' 31 | db caps,f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,numlock 32 | db scroll,home,arrowup,pgup,num_sub,arrowleft,center5,arrowright 33 | db num_plus,_end,arrowdown,pgdn,_ins,del 34 | */ 35 | 36 | u32 rawkeyScancode = inb(0x60); // read byte from post 0x60 37 | u32 keyScancode = rawkeyScancode & 0x7f; // ignore the up flag 38 | boolean up = (rawkeyScancode & 0x80); // just the key up 39 | 40 | if (rawkeyScancode != last) { 41 | last = rawkeyScancode; 42 | if (keyScancode == 0x2A || keyScancode == 0x36) { // left and right shift 43 | shift = !up; 44 | } else if (keyScancode == 0x38 || keyScancode == 0x3a) { // left and right control 45 | ctrl = !up; 46 | } else if (keyScancode == 0x71 || keyScancode == 0x72) { // alt 47 | alt = !up; 48 | } else if (keyScancode == 0x60) { // cursor keys? 49 | // cursor key? always seem to be an up event? 50 | 51 | } else if (up) { 52 | return shift ? keymapUppercase[keyScancode] : keymap[keyScancode]; 53 | } 54 | } 55 | return 0; 56 | } -------------------------------------------------------------------------------- /include/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | */ 15 | #ifndef __TYPES_H_ 16 | #define __TYPES_H_ 17 | 18 | /* 19 | define some specific length types 20 | */ 21 | 22 | typedef unsigned char u8; 23 | typedef signed char i8; 24 | typedef unsigned short int u16; 25 | typedef signed short int i16; 26 | typedef unsigned int u32; 27 | typedef signed int i32; 28 | typedef unsigned long long int u64; 29 | typedef signed long long int i64; 30 | typedef float f32; 31 | typedef double f64; 32 | 33 | // Convienience types 34 | typedef u8 b8; 35 | typedef u8 boolean; 36 | typedef void* Pointer; 37 | typedef unsigned char uchar; 38 | typedef uchar* PChar; 39 | typedef i64 num; 40 | 41 | #ifndef __x64__ 42 | typedef u32 uint; 43 | typedef u32 size_t; 44 | #else 45 | typedef u64 uint; 46 | typedef u64 size_t; 47 | #endif 48 | 49 | #define true 1 50 | #define false 0 51 | 52 | #define null ((void*)0) 53 | 54 | #define I8_MIN (-0x80) 55 | #define I8_MAX 0x7F 56 | #define U8_MIN 0 57 | #define U8_MAX 0xFF 58 | #define I16_MIN (-0x8000) 59 | #define I16_MAX 0x7FFF 60 | #define U16_MIN 0 61 | #define U16_MAX 0xFFFF 62 | #define I32_MIN (-0x80000000) 63 | #define I32_MAX 0x7FFFFFFF 64 | #define U32_MIN 0 65 | #define U32_MAX 0xFFFFFFFF 66 | #define I64_MIN (-0x8000000000000000) 67 | #define I64_MAX 0x7FFFFFFFFFFFFFFF 68 | #define U64_MIN 0 69 | #define U64_MAX 0xFFFFFFFFFFFFFFFF 70 | #define INVALID_PTR I64_MAX 71 | 72 | // #define U64_F64_MAX (0x43F0000000000000(F64)) 73 | // #define F64_MAX (0x7FEFFFFFFFFFFFFF(F64)) 74 | // #define F64_MIN (0xFFEFFFFFFFFFFFFF(F64)) 75 | // #define inf (0x7FF0000000000000(F64)) 76 | // #define � (0x7FF0000000000000(F64)) 77 | // #define pi (0x400921FB54442D18(F64)) 78 | // #define � (0x400921FB54442D18(F64)) 79 | // #define exp_1 (0x4005BF0A8B145769(F64)) //The number "e" 80 | // #define log2_10 (0x400A934F0979A371(F64)) 81 | // #define log2_e (0x3FF71547652B82FE(F64)) 82 | // #define log10_2 (0x3FD34413509F79FF(F64)) 83 | // #define loge_2 (0x3FE62E42FEFA39EF(F64)) 84 | // #define sqrt2 (0x3FF6A09E667F3BCD(F64)) 85 | // #define eps (0x3CB0000000000000(F64)) 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /include/vga.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | */ 16 | 17 | #ifndef __MYOS__DRIVERS__VGA_H 18 | #define __MYOS__DRIVERS__VGA_H 19 | 20 | #include "multiboot2.h" 21 | #include "types.h" 22 | #include "stdlibc.h" 23 | 24 | typedef struct VideoGraphicsArray 25 | { 26 | /* data */ 27 | u32 width; 28 | u32 height; 29 | u32 indexMax; 30 | 31 | u32 *buffer; 32 | u32 *screen; 33 | u32 *dest; 34 | } VideoGraphicsArray; 35 | 36 | typedef struct VideoGraphicsArray * PVideoGraphicsArray; 37 | extern PVideoGraphicsArray videoGraphicsArray; 38 | extern struct VgaConsole* vgaConsole; 39 | 40 | void boot_vga_init(PVideoGraphicsArray pvideoGraphicsArray, const PMultibootHeader boot_header, u32 *buffer); 41 | void boot_vga_putPixel(i32 x, i32 y, u32 color); 42 | void boot_vga_putChar(uchar ch, i32 x, i32 y, u32 fgColor, u32 bgColor); 43 | void boot_vga_putStr(PChar ch, i32 x, i32 y, u32 fgColor, u32 bgColor); 44 | void boot_vga_fillRectangle(i32 x, i32 y, u32 w, u32 h, u32 color); 45 | void boot_vga_bufferToScreen(); 46 | void boot_vga_window(i32 x, i32 y, u32 w, u32 h); 47 | void boot_vga_init_window_console(); 48 | void crt_boot_console_cursor(); 49 | 50 | extern u64 FONT[256]; 51 | extern u8 sys_font_std_8x12[256*12]; 52 | 53 | #define CLR_MED_GREY 0x909090 54 | #define CLR_LIGHT_GREY_1 0xC0C0C0 55 | #define CLR_LIGHT_GREY_2 0xD0D0D0 56 | #define CLR_LIGHT_GREY_3 0xE0E0E0 57 | #define CLR_DARK_GREY_1 0x101010 58 | #define CLR_DARK_GREY_2 0x404040 59 | #define CLR_DARK_BLUE_1 0x2040E0 60 | #define CLR_DARK_BLUE_2 0x002080 61 | #define CLR_BLUE 0x1030A0 62 | #define CLR_WHITE 0xFFFFFF 63 | #define CLR_YELLOW 0xFFFF10 64 | #define CLR_GREEN 0x10FF10 65 | #define CLR_RED 0xFF1010 66 | #define CLR_BLACK 0x000000 67 | 68 | typedef struct VgaConsole { 69 | u32 col; // track current position 70 | u32 row; // track current position 71 | u32 fgColor; 72 | u32 bgColor; 73 | u32 width; // in chars 74 | u32 height; // in chars 75 | u32 xpos; // in pixels 76 | u32 ypos; // in pixels 77 | u32 fontWidth; 78 | u32 fontHeight; 79 | PChar font; 80 | PChar buffer; 81 | boolean cursor; 82 | } VgaConsole; 83 | 84 | typedef struct CrtConsole { 85 | u32 col; // track current position 86 | u32 row; // track current position 87 | u8 color; 88 | PChar buffer; 89 | } CrtConsole; 90 | 91 | Fn_putchar(vga_boot_console); 92 | Fn_putchar(crt_boot_console); 93 | Fn_putchar(log_boot_console); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/loader.s: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | 16 | */ 17 | 18 | /* 19 | 20 | Boot loader this is the boot entry point, it calls the kernelMain in kernel.cpp 21 | 22 | #define MULTIBOOT_HEADER_FLAGS MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_MODE | AOUT_KLUDGE 23 | 24 | */ 25 | // .set FLAGS, 7 = graphics, 3 = crt 26 | .code32 27 | .set REQUEST_FLAGS, 7 28 | 29 | .set MAGIC, 0x1badb002 30 | .set FLAGS, REQUEST_FLAGS /* crt mode */ 31 | .set CHECKSUM, -(MAGIC + FLAGS) 32 | .set MODE_TYPE, 0 33 | .set WIDTH, 1024 /* requested width */ 34 | .set HEIGHT, 768 /* requested height */ 35 | .set DEPTH, 32 /* requested bits per pixel BPP */ 36 | .set HEADER_ADDR, 0 37 | .set LOAD_ADDR, 0 38 | .set LOAD_END_ADDR, 0 39 | .set BSS_END_ADDR, 0 40 | .set ENTRY_ADDR, 0 41 | 42 | /** 43 | from https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#OS-image-format 44 | 45 | 0 u32 magic required 46 | 4 u32 flags required 47 | 8 u32 checksum required 48 | 12 u32 header_addr if flags[16] is set 49 | 16 u32 load_addr if flags[16] is set 50 | 20 u32 load_end_addr if flags[16] is set 51 | 24 u32 bss_end_addr if flags[16] is set 52 | 28 u32 entry_addr if flags[16] is set 53 | 32 u32 mode_type if flags[2] is set 54 | 36 u32 width if flags[2] is set 55 | 40 u32 height if flags[2] is set 56 | 44 u32 depth if flags[2] is set 57 | 58 | */ 59 | 60 | .global bootresponse 61 | .global loader 62 | .global multiboot 63 | .global kernel_stack 64 | 65 | .section .multiboot 66 | multiboot: 67 | .long MAGIC 68 | .long FLAGS 69 | .long CHECKSUM 70 | .long HEADER_ADDR 71 | .long LOAD_ADDR 72 | .long LOAD_END_ADDR 73 | .long BSS_END_ADDR 74 | .long ENTRY_ADDR 75 | .long MODE_TYPE 76 | .long WIDTH 77 | .long HEIGHT 78 | .long DEPTH 79 | /* enough space for the returned header - this isn't where is puts it*/ 80 | multibootHeader: 81 | .space 4 * 13 82 | bootresponse: .long 83 | multibootHdr: .long 84 | .section .text 85 | .extern kernelMain 86 | .extern callConstructors 87 | 88 | loader: 89 | mov $kernel_stack, %esp 90 | mov %eax, bootresponse 91 | mov %ebx, [bootresponse + 4] 92 | /* I think there may be some moves missing to set DS, ES, CS SS etc */ 93 | call kernelMain 94 | 95 | _stop: 96 | cli 97 | hlt 98 | jmp _stop 99 | 100 | .section .bss 101 | .space 200*1024*1024; # 200 MiB 102 | kernel_stack: 103 | 104 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Multiboot Basic Graphics 2 | Very Basic example of Booting with GRUB, and requesting a 32bit Graphics mode with Multiboot 1024 x 768 x 32 3 | 4 | # Overview 5 | The purpose of this is a basic sample of using a GRUB boot and requesting a graphics mode with MultiBoot, and then doing some very basic drawing functions. 6 | 7 | Included is a loyalty free font, with example use so you can write stuff to screen in your OS. 8 | 9 | The idea is that it will be a reference for people who have created their own OS and would like to add graphics to it, and want to use MultiBoot to figure it out for them instead of coding all the required steps them selfs. 10 | 11 | # MultiBoot basics 12 | The multiboot works by setting specific values at specific offsets in the boot executable file, so we are requesting the graphics mode with the following: 13 | ```asm 14 | .set WIDTH, 1024 /* requested width */ 15 | .set HEIGHT, 768 /* requested height */ 16 | .set DEPTH, 32 /* requested depth */ 17 | ``` 18 | 19 | GRUB will read those values and set the Graphics mode prior to handing execution over to our application, so when our application starts, if the requested mode is valid, it will already be in that mode. 20 | 21 | GRUB will also pass through the multiboot header containing what the Graphics mode is set to and other values of interest. 22 | 23 | The framebuffer_addr is where you will write your graphics operations to. 24 | 25 | Things to note, request a valid Graphics Mode, In the GRUB menu [https://askubuntu.com/questions/16042/how-to-get-to-the-grub-menu-at-boot-time] CLI the `videoinfo` will list the available and valid modes. 26 | 27 | I would recommend working with 32Bit graphics it is simplier and I would have thought as fast or faster than other options. Before you go thinking but 8bit graphics will be faster measure it. 28 | 29 | # Basic principles 30 | * Don't read from the framebuffer_addr it will be slow. 31 | * Don't fiddle around writing bits and peices to the framebuffer_addr write in bulk in a single loop from a buffer, the reason for this is, in the underlying architecture you are transfering data from your main RAM to the PCI-E bus, if you do it as single opertions you will be using burst writing in Cache which makes a huge difference. 32 | * If you run directly against Hardware ie not in a Virtual machine you will need to setup up write combining for the framebuffer_addr in the Cache so it will busrt write in blocks to the PCI-E bus (in a VM you get this for free as the underlying OS has already done it). 33 | 34 | # Features: 35 | * Boots into 1024 x 768 x 32 Graphics mode. 36 | * 8 x 8 loyalty free Font 37 | * Basic draw functions 38 | * 32bit not x64 39 | 40 | The basic 8x8 font was created in TempleOS using the FontEd example. 41 | 42 | # Building 43 | Needs to be built under Linux (I tried WLS but it doesn't create the ISO image) 44 | The Make script will create an ISO, 45 | ``` 46 | g++ 47 | binutils 48 | libc6-dev-i386 49 | VirtualBox 50 | grub-legacy 51 | xorriso 52 | ``` 53 | 54 | 55 | # Running 56 | Create a new virtual machine in VirtualBox 57 | Mount the ISO 58 | Boot 59 | 60 | # What it is not 61 | It has no drivers for anything, no memory managment, no keyboard or mouse IO, not Disk IO, nothing. 62 | 63 | # Boot sequence 64 | * Grub loads 65 | * Grub is configured to load our exec 66 | * Grub switchs from 16bit mode to 32bit mode 67 | * Grub read our exe, sees the request for the graphics mode 68 | * Grub sets the graphics mode 69 | * Grub starts executing our exe, (loader.s writen in ASM) 70 | * Loader.s calls teh CPP KernalMain 71 | 72 | -------------------------------------------------------------------------------- /src/boot/boot_stdlibc.c: -------------------------------------------------------------------------------- 1 | #include "vga.h" 2 | #include "types.h" 3 | #include "stdarg.h" // @TODO implement header 4 | 5 | static const PChar hex = "0123456789ABCDEF"; 6 | 7 | int puts(const PChar str) { 8 | for (int i = 0; str[i] != 0; putchar(str[i++])); 9 | } 10 | 11 | 12 | void putInt$(int num) { 13 | // Buffer to hold the digits of the number in reverse order 14 | char buffer[12]; // Enough to hold all digits of a 32-bit integer including the sign 15 | int i = 0; 16 | 17 | // Handle zero case explicitly 18 | if (num == 0) { 19 | putchar('0'); 20 | return; 21 | } 22 | 23 | // Handle negative numbers 24 | if (num < 0) { 25 | putchar('-'); 26 | num = -num; 27 | } 28 | 29 | // Extract digits and store them in reverse order 30 | while (num != 0) { 31 | buffer[i++] = (num % 10) + '0'; // Convert digit to character and store 32 | num /= 10; 33 | } 34 | 35 | // Print the digits in correct order 36 | while (i > 0) { 37 | putchar(buffer[--i]); 38 | } 39 | } 40 | 41 | /** 42 | * @TODO not fully featured 43 | * @TODO lacking in error control 44 | */ 45 | int printf(const PChar restrict format, ...) { 46 | va_list args; 47 | va_start(args, format); 48 | 49 | PChar fmt = format; 50 | char ch; 51 | 52 | while ((ch = *fmt)) { 53 | if (ch == '%') { 54 | fmt++; 55 | switch (*fmt) { 56 | case 'c': 57 | putchar(va_arg(args, int)); 58 | break; 59 | case 's': 60 | puts(va_arg(args, PChar)); 61 | break; 62 | case 'x': // hex 63 | puts("0x"); 64 | u32 value = va_arg(args, int); 65 | 66 | int ix = 28; 67 | for (int i = 0; i < 8; i++, ix -= 4) { 68 | putchar(hex[(value >> ix) & 0xF]); 69 | } 70 | break; 71 | case 'B': // boolean 72 | int res = va_arg(args, int); 73 | if (res) { 74 | puts("true"); 75 | } else { 76 | puts("false"); 77 | } 78 | break; 79 | case 'b': // binary 80 | puts("0b"); 81 | u32 valueb = va_arg(args, int); 82 | for (int i = 31; i >= 0; i--) { 83 | putchar((valueb & (1 << i)) ? '1' : '0'); 84 | } 85 | break; 86 | case 'i': //integer 87 | putInt$(va_arg(args, int)); 88 | break; 89 | case 'd': //decimal 90 | default: 91 | putchar('%'); 92 | putchar(*fmt); 93 | break; 94 | } 95 | } else { 96 | putchar(ch); 97 | } 98 | fmt++; 99 | } 100 | va_end(args); 101 | } 102 | 103 | Pointer memmove(Pointer dstptr, const Pointer srcptr, uint size) { 104 | PChar dst = (PChar) dstptr; 105 | const PChar src = (const PChar) srcptr; 106 | if (dst < src) { 107 | for (uint i = 0; i < size; i++) 108 | dst[i] = src[i]; 109 | } else { 110 | for (uint i = size; i != 0; i--) 111 | dst[i-1] = src[i-1]; 112 | } 113 | return dstptr; 114 | } 115 | 116 | int memcmp(const Pointer aptr, const Pointer bptr, uint size) { 117 | const PChar a = (const PChar) aptr; 118 | const PChar b = (const PChar) bptr; 119 | for (uint i = 0; i < size; i++) { 120 | if (a[i] < b[i]) 121 | return -1; 122 | else if (b[i] < a[i]) 123 | return 1; 124 | } 125 | return 0; 126 | } 127 | 128 | Pointer memcpy(Pointer restrict dstptr, const Pointer restrict srcptr, uint size) { 129 | PChar dst = (PChar) dstptr; 130 | const PChar src = (const PChar) srcptr; 131 | for (uint i = 0; i < size; i++) 132 | dst[i] = src[i]; 133 | return dstptr; 134 | } 135 | 136 | Pointer memset(Pointer bufptr, u8 value, uint size) { 137 | PChar buf = (PChar) bufptr; 138 | for (uint i = 0; i < size; i++) 139 | buf[i] = value; 140 | return bufptr; 141 | } 142 | 143 | uint strlen(const PChar str) { 144 | uint len = 0; 145 | while (str[len]) 146 | len++; 147 | return len; 148 | } 149 | 150 | PChar strcpy(PChar dest, const PChar src) { 151 | if (dest == null) { 152 | return null; // Return if no memory is allocated to the destination 153 | } 154 | 155 | if (src == dest) { 156 | return dest; 157 | } 158 | 159 | PChar ptr = dest; // Pointer to the beginning of the destination string 160 | PChar sptr = src; // Pointer to the beginning of the destination string 161 | 162 | while (*sptr != 0) { 163 | *dest++ = *sptr++; // Copy character from source to destination 164 | } 165 | 166 | *dest = 0; // Include the terminating null character 167 | return ptr; // Return the pointer to the destination 168 | } 169 | 170 | __attribute__((__noreturn__)) 171 | void abort(void) { 172 | // TODO: Abnormally terminate the process as if by SIGABRT. 173 | printf("abort()\n"); 174 | while (1) { } 175 | __builtin_unreachable(); 176 | } 177 | -------------------------------------------------------------------------------- /src/kernel.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | 16 | */ 17 | #include "vga.h" 18 | #include "stdarg.h" 19 | #include "stdlibc.h" 20 | #include "multiboot2.h" 21 | 22 | #define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) 23 | 24 | #define SCREEN_WIDTH 1024 // hard coded - not good please change 25 | #define SCREEN_HEIGHT 768 // hard coded - not good please change 26 | 27 | u32 buffer[SCREEN_WIDTH * SCREEN_HEIGHT]; // hard coded - not good please change 28 | 29 | struct VideoGraphicsArray vga; 30 | PMultibootHeader multibootHeader; 31 | PFn_putchar putchar; 32 | 33 | /** 34 | * print the flags we set in the application header given to Grub Multiboot 35 | */ 36 | int requestFlags(u32 requestFlags) { 37 | printf ("request flags:\n pageAlign(%B), memInfo(%B), videoMode(%B)\n", 38 | requestFlags & MULTIBOOT_PAGE_ALIGN, 39 | requestFlags & MULTIBOOT_MEMORY_INFO, 40 | requestFlags & MULTIBOOT_VIDEO_MODE); 41 | } 42 | 43 | int validateBoot(u32 magic, u32 flags) { 44 | /* Am I booted by a Multiboot-compliant boot loader? */ 45 | if (magic != MULTIBOOT_BOOTLOADER_MAGIC) { 46 | printf ("Invalid magic number: %x, expecting %x\n", magic, MULTIBOOT_BOOTLOADER_MAGIC); 47 | return 1; 48 | } 49 | 50 | /* Bits 4 and 5 are mutually exclusive! */ 51 | if ((flags & MULTIBOOT_INFO_AOUT_SYMS) && (flags & MULTIBOOT_INFO_ELF_SHDR)) { 52 | printf ("Both bits 4 and 5 are set.\n"); 53 | return 2; 54 | } 55 | return 0; 56 | } 57 | 58 | void bootFlags(u32 flags) { 59 | /* Print out the flags. */ 60 | printf ("flags:\n"); 61 | 62 | printf (" mem(%B), ", flags & MULTIBOOT_INFO_MEMORY); 63 | printf ("boot_device(%B), ", flags & MULTIBOOT_INFO_BOOTDEV); 64 | printf ("cmdline(%B), ", flags & MULTIBOOT_INFO_CMDLINE); 65 | printf ("mods(%B)\n", flags & MULTIBOOT_INFO_MODS); 66 | printf (" aout(%B), ", flags & MULTIBOOT_INFO_AOUT_SYMS); 67 | printf ("elf(%B), ", flags & MULTIBOOT_INFO_ELF_SHDR); 68 | printf ("mmap(%B), ", flags & MULTIBOOT_INFO_MEM_MAP); 69 | printf ("drive info(%B), ", flags & MULTIBOOT_INFO_DRIVE_INFO); 70 | printf ("Config Table(%B)\n", flags & MULTIBOOT_INFO_CONFIG_TABLE); 71 | printf (" Boot Loader(%B), ", flags & MULTIBOOT_INFO_BOOT_LOADER_NAME); 72 | printf ("APM(%B), ", flags & MULTIBOOT_INFO_APM_TABLE); 73 | printf ("VBE(%B), ", flags & MULTIBOOT_INFO_VBE_INFO); 74 | printf ("framebuffer(%B)\n", flags & MULTIBOOT_INFO_FRAMEBUFFER_INFO); 75 | } 76 | 77 | extern u32 loader; 78 | extern u32* multiboot; 79 | u32 *mbPtr = &multiboot; 80 | extern u32 bootresponse; 81 | extern u32 kernel_stack; 82 | 83 | 84 | 85 | /** 86 | 87 | entry point, this is what gets called by the ASM loader.s 88 | you don't need stack pointer its just there to check whats going on 89 | 90 | */ 91 | 92 | void main() {}; 93 | 94 | void kernelMain() { 95 | u32 *bootRes = &bootresponse; 96 | u32 magic = bootRes[0]; 97 | multibootHeader = bootRes[1]; 98 | u32 c1, c2, c3; 99 | 100 | putchar = &crt_boot_console_putchar; 101 | u32 mbRequestFlags = mbPtr[1]; 102 | 103 | 104 | if (mbRequestFlags & MULTIBOOT_VIDEO_MODE) { 105 | boot_vga_init(&vga, multibootHeader, buffer); 106 | putchar = &vga_boot_console_putchar; 107 | } else { 108 | crt_clear_screen(0); 109 | } 110 | 111 | if (validateBoot(magic, multibootHeader->flags)) { 112 | return 1; 113 | } 114 | 115 | if (mbRequestFlags & MULTIBOOT_VIDEO_MODE) { 116 | boot_vga_window(100, 200, 100, 30); 117 | boot_vga_window(120, 40, 80, 50); 118 | } 119 | 120 | requestFlags(mbRequestFlags); 121 | bootFlags(multibootHeader->flags); 122 | 123 | // dump some runtme information 124 | 125 | printf("multiboot request flags: %x, %b\n", mbRequestFlags, mbRequestFlags); 126 | printf("x bootresponse addr : %x\n", bootRes); 127 | printf("x magic : %x\n", magic); 128 | printf("x multibootHeader : %x\n", bootRes[1]); 129 | printf("x multibootRequest offest: %x\n", mbPtr); 130 | printf("x stackPointer top : %x\n", &kernel_stack); 131 | printf("instructionPointer : %x\n", &kernelMain); 132 | if (mbRequestFlags & MULTIBOOT_VIDEO_MODE) { 133 | printf("screen buffer : %x\n", buffer); 134 | printf("screen buffer end : %x\n", &buffer[multibootHeader->framebuffer_width*multibootHeader->framebuffer_height]); 135 | printf("buffer size : %x\n", multibootHeader->framebuffer_width*multibootHeader->framebuffer_height*(multibootHeader->framebuffer_bpp / 8)); 136 | printf("vga : %x\n", &vga); 137 | } 138 | 139 | printf("u32 flags : %x, %b\n", multibootHeader->flags, multibootHeader->flags); 140 | printf("u32 mem_lower : %x\n", multibootHeader->mem_lower); 141 | printf("u32 mem_upper : %x\n", multibootHeader->mem_upper); 142 | printf("u32 boot_device : %x\n", multibootHeader->boot_device); 143 | printf("u32 cmdline : %x, %s \n", multibootHeader->cmdline, multibootHeader->cmdline); 144 | if (multibootHeader->flags & MULTIBOOT_INFO_MODS) { 145 | printf("u32 mods_count : %x\n", multibootHeader->mods_count); 146 | printf("u32 mods_addr : %x\n", multibootHeader->mods_addr); 147 | } 148 | 149 | if (multibootHeader->flags & MULTIBOOT_INFO_ELF_SHDR) { 150 | printf("u32 u.elf_sec.addr : %x\n", multibootHeader->u.elf_sec.addr); 151 | printf("u32 u.elf_sec.num : %x\n", multibootHeader->u.elf_sec.num); 152 | // printf("u32 u.elf_sec.shndx : %x\n", (int)multibootHeader->u.elf_sec.shndx); 153 | printf("u32 u.elf_sec.size : %x\n", multibootHeader->u.elf_sec.size); 154 | } 155 | printf("u32 mmap_length : %x\n", multibootHeader->mmap_length); 156 | printf("u32 mmap_addr : %x\n", multibootHeader->mmap_addr); 157 | if (multibootHeader->flags & MULTIBOOT_INFO_DRIVE_INFO) { 158 | printf("u32 drives_length : %x\n", multibootHeader->drives_length); 159 | printf("u32 drives_addr : %x\n", multibootHeader->drives_addr); 160 | } 161 | if (multibootHeader->flags & MULTIBOOT_INFO_CONFIG_TABLE) { 162 | printf("u32 config_table : %x\n", multibootHeader->config_table); 163 | } 164 | printf("u32 boot_loader_name : %x\n", multibootHeader->boot_loader_name); 165 | if (multibootHeader->flags & MULTIBOOT_INFO_APM_TABLE) { 166 | printf("u32 apm_table : %x\n", multibootHeader->apm_table); 167 | } 168 | if (mbRequestFlags & MULTIBOOT_VIDEO_MODE) { 169 | printf("u32 vbe_control_info : %x\n", multibootHeader->vbe_control_info); 170 | printf("u32 vbe_mode_info : %x\n", multibootHeader->vbe_mode_info); 171 | printf("u16 vbe_mode : %x\n", multibootHeader->vbe_mode); 172 | printf("u16 vbe_interface_seg : %x\n", multibootHeader->vbe_interface_seg); 173 | printf("u32 vbe_interface_off : %x\n", multibootHeader->vbe_interface_off); 174 | printf("u32 vbe_interface_len : %x\n", multibootHeader->vbe_interface_len); 175 | printf("u64 framebuffer_addr : %x\n", multibootHeader->framebuffer_addr); 176 | printf("u32 framebuffer_pitch : %x\n", multibootHeader->framebuffer_pitch); 177 | 178 | printf("u32 framebuffer_(width,height,bpp) :%ix%ix%i\n", multibootHeader->framebuffer_width, multibootHeader->framebuffer_height, multibootHeader->framebuffer_bpp); 179 | printf("u8 framebuffer_type : %x\n", multibootHeader->framebuffer_type); 180 | } 181 | 182 | for (int i = 0; i < 256; i++) { 183 | printf("%c", i); 184 | } 185 | 186 | printf("\n (root)> "); 187 | 188 | vgaConsole->cursor = true; 189 | crt_boot_console_cursor(); 190 | while (true) { 191 | char code = getAsciiKey(); 192 | if (code != 0) { 193 | if (code == '\n') { 194 | printf("\nerror: not found\n (root)> "); // nothing is ever found 195 | } else { 196 | printf("%c", code); 197 | } 198 | } 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /include/multiboot2.h: -------------------------------------------------------------------------------- 1 | /* 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | */ 15 | #ifndef __MULTIBOOT2__H 16 | #define __MULTIBOOT2__H 17 | 18 | #include "types.h" 19 | 20 | /* How many bytes from the start of the file we search for the header. */ 21 | #define MULTIBOOT_SEARCH 8192 22 | #define MULTIBOOT_HEADER_ALIGN 4 23 | /* The magic field should contain this. */ 24 | #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 25 | /* This should be in %eax. */ 26 | #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 27 | /* Alignment of multiboot modules. */ 28 | #define MULTIBOOT_MOD_ALIGN 0x00001000 29 | /* Alignment of the multiboot info structure. */ 30 | #define MULTIBOOT_INFO_ALIGN 0x00000004 31 | /* Flags set in the ’flags’ member of the multiboot header. */ 32 | /* Align all boot modules on i386 page (4KB) boundaries. */ 33 | #define MULTIBOOT_PAGE_ALIGN 0x00000001 34 | /* Must pass memory information to OS. */ 35 | #define MULTIBOOT_MEMORY_INFO 0x00000002 36 | /* Must pass video information to OS. */ 37 | #define MULTIBOOT_VIDEO_MODE 0x00000004 38 | /* This flag indicates the use of the address fields in the header. */ 39 | #define MULTIBOOT_AOUT_KLUDGE 0x00010000 40 | /* Flags to be set in the ’flags’ member of the multiboot info structure. */ 41 | /* is there basic lower/upper memory information? */ 42 | #define MULTIBOOT_INFO_MEMORY 0x00000001 43 | /* is there a boot device set? */ 44 | #define MULTIBOOT_INFO_BOOTDEV 0x00000002 45 | /* is the command-line defined? */ 46 | #define MULTIBOOT_INFO_CMDLINE 0x00000004 47 | /* are there modules to do something with? */ 48 | #define MULTIBOOT_INFO_MODS 0x00000008 49 | /* These next two are mutually exclusive */ 50 | /* is there a symbol table loaded? */ 51 | #define MULTIBOOT_INFO_AOUT_SYMS 0x00000010 52 | /* is there an ELF section header table? */ 53 | #define MULTIBOOT_INFO_ELF_SHDR 0X00000020 54 | /* is there a full memory map? */ 55 | #define MULTIBOOT_INFO_MEM_MAP 0x00000040 56 | /* Is there drive info? */ 57 | #define MULTIBOOT_INFO_DRIVE_INFO 0x00000080 58 | /* Is there a config table? */ 59 | #define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100 60 | /* Is there a boot loader name? */ 61 | #define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200 62 | /* Is there a APM table? */ 63 | #define MULTIBOOT_INFO_APM_TABLE 0x00000400 64 | /* Is there video information? */ 65 | #define MULTIBOOT_INFO_VBE_INFO 0x00000800 66 | #define MULTIBOOT_INFO_FRAMEBUFFER_INFO 0x00001000 67 | 68 | 69 | 70 | /* The symbol table for a.out. */ 71 | struct MultibootAoutSymbolTable 72 | { 73 | u32 tabsize; 74 | u32 strsize; 75 | u32 addr; 76 | // u32 reserved; 77 | }; 78 | typedef struct MultibootAoutSymbolTable MultibootAoutSymbolTable_t; 79 | 80 | /* The section header table for ELF. */ 81 | struct MultibootElfSectionHeaderTable 82 | { 83 | u32 num; 84 | u32 size; 85 | u32 addr; 86 | // u32 shndx; 87 | }; 88 | typedef struct MultibootElfSectionHeaderTable MultibootElfSectionHeaderTable_t; 89 | /** 90 | * The multiboot section which is passed in by grub at boot up with the following fields 91 | * populated. 92 | * for more information see: 93 | * https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-information-format 94 | * 95 | * 96 | * 0 | flags | (required) 97 | +-------------------+ 98 | 4 | mem_lower | (present if flags[0] is set) 99 | 8 | mem_upper | (present if flags[0] is set) 100 | +-------------------+ 101 | 12 | boot_device | (present if flags[1] is set) 102 | +-------------------+ 103 | 16 | cmdline | (present if flags[2] is set) 104 | +-------------------+ 105 | 20 | mods_count | (present if flags[3] is set) 106 | 24 | mods_addr | (present if flags[3] is set) 107 | +-------------------+ 108 | 28 - 40 | syms | (present if flags[4] or 109 | | | flags[5] is set) 110 | +-------------------+ 111 | 44 | mmap_length | (present if flags[6] is set) 112 | 48 | mmap_addr | (present if flags[6] is set) 113 | +-------------------+ 114 | 52 | drives_length | (present if flags[7] is set) 115 | 56 | drives_addr | (present if flags[7] is set) 116 | +-------------------+ 117 | 60 | config_table | (present if flags[8] is set) 118 | +-------------------+ 119 | 64 | boot_loader_name | (present if flags[9] is set) 120 | +-------------------+ 121 | 68 | apm_table | (present if flags[10] is set) 122 | +-------------------+ 123 | 72 | vbe_control_info | (present if flags[11] is set) 124 | 76 | vbe_mode_info | 125 | 80 | vbe_mode | 126 | 82 | vbe_interface_seg | 127 | 84 | vbe_interface_off | 128 | 86 | vbe_interface_len | 129 | +-------------------+ 130 | 88 | framebuffer_addr | (present if flags[12] is set) 131 | 96 | framebuffer_pitch | 132 | 100 | framebuffer_width | 133 | 104 | framebuffer_height| 134 | 108 | framebuffer_bpp | 135 | 109 | framebuffer_type | 136 | 110-115 | color_info | 137 | +-------------------+ 138 | * 139 | */ 140 | typedef struct MultibootHeader { 141 | u32 flags; 142 | u32 mem_lower; 143 | u32 mem_upper; 144 | u32 boot_device; 145 | u32 cmdline; 146 | u32 mods_count; 147 | u32 mods_addr; 148 | union 149 | { 150 | MultibootAoutSymbolTable_t aout_sym; 151 | MultibootElfSectionHeaderTable_t elf_sec; 152 | } u; 153 | u32 mmap_length; 154 | u32 mmap_addr; 155 | u32 drives_length; 156 | u32 drives_addr; 157 | u32 config_table; 158 | u32 boot_loader_name; 159 | u32 apm_table; 160 | u32 vbe_control_info; 161 | u32 vbe_mode_info; 162 | u16 vbe_mode; 163 | u16 vbe_interface_seg; 164 | u32 vbe_interface_off; 165 | u32 vbe_interface_len; 166 | u64 framebuffer_addr; 167 | u32 framebuffer_pitch; 168 | 169 | u32 framebuffer_width; 170 | u32 framebuffer_height; 171 | u8 framebuffer_bpp; 172 | #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0 173 | #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1 174 | #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2 175 | u8 framebuffer_type; 176 | union 177 | { 178 | struct 179 | { 180 | u32 framebuffer_palette_addr; 181 | u16 framebuffer_palette_num_colors; 182 | }; 183 | struct 184 | { 185 | u8 framebuffer_red_field_position; 186 | u8 framebuffer_red_mask_size; 187 | u8 framebuffer_green_field_position; 188 | u8 framebuffer_green_mask_size; 189 | u8 framebuffer_blue_field_position; 190 | u8 framebuffer_blue_mask_size; 191 | }; 192 | }; 193 | } MultibootHeader; 194 | typedef struct MultibootHeader * PMultibootHeader; 195 | 196 | typedef struct MultibootMmapEntry 197 | { 198 | u32 size; 199 | u64 addr; 200 | u64 len; 201 | #define MULTIBOOT_MEMORY_AVAILABLE 1 202 | #define MULTIBOOT_MEMORY_RESERVED 2 203 | #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3 204 | #define MULTIBOOT_MEMORY_NVS 4 205 | #define MULTIBOOT_MEMORY_BADRAM 5 206 | u32 type; 207 | } __attribute__((packed)) MultibootMmapEntry; 208 | 209 | typedef struct MultibootModList 210 | { 211 | /* the memory used goes from bytes ’mod_start’ to ’mod_end-1’ inclusive */ 212 | u32 mod_start; 213 | u32 mod_end; 214 | 215 | /* Module command line */ 216 | u32 cmdline; 217 | 218 | /* padding to take it to 16 bytes (must be zero) */ 219 | u32 pad; 220 | } MultibootModList; 221 | 222 | /* APM BIOS info. */ 223 | typedef struct MultibootApmInfo 224 | { 225 | u16 version; 226 | u16 cseg; 227 | u32 offset; 228 | u16 cseg_16; 229 | u16 dseg; 230 | u16 flags; 231 | u16 cseg_len; 232 | u16 cseg_16_len; 233 | u16 dseg_len; 234 | } MultibootApmInfo; 235 | 236 | typedef struct MultibootApmInfo * PMultibootApmInfo; 237 | 238 | #endif 239 | -------------------------------------------------------------------------------- /src/boot/boot_vga.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | videoGraphicsArray program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | videoGraphicsArray program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with videoGraphicsArray program. If not, see . 15 | 16 | */ 17 | 18 | /* 19 | 20 | Basic graphics utility methods 21 | 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | #define CRT_VIDEO_MEMORY ((volatile PChar)0xB8000) 28 | #define SCREEN_WIDTH 80 29 | #define SCREEN_HEIGHT 25 30 | 31 | uchar logBuffer[256 * 256]; 32 | u32 logBufferIx = 0; 33 | 34 | PVideoGraphicsArray videoGraphicsArray; 35 | 36 | VgaConsole *vgaConsole; 37 | 38 | struct VgaConsole vgaBootConsole = { 39 | 0, 0, CLR_WHITE, CLR_BLACK, 80, 25, 0, 0, 8, 8, (PChar)FONT, false 40 | }; 41 | 42 | struct VgaConsole vgaFauxWindow = { 43 | 0, 0, CLR_BLACK, CLR_LIGHT_GREY_3, 0, 0, 0, 0, 8, 12, sys_font_std_8x12, false 44 | }; 45 | 46 | 47 | struct CrtConsole crtConsole = { 48 | 0, 0, 0x0f 49 | }; 50 | 51 | 52 | Fn_putchar(log_boot_console) { 53 | // retain everything so it can be stored to file 54 | ifInside(logBufferIx, 256 * 256) 55 | logBuffer[logBufferIx++] = ch; 56 | } 57 | 58 | /** 59 | * @TODO add scrolling 60 | */ 61 | Fn_putchar(vga_boot_console) { 62 | // also write to crt console 63 | boolean curs = vgaConsole->cursor; 64 | vgaConsole->cursor = false; 65 | crt_boot_console_putchar(ch); 66 | if (ch == '\n') { 67 | if (curs) { 68 | boot_vga_putChar(' ', 69 | vgaConsole->col * vgaConsole->fontWidth + vgaConsole->xpos, 70 | vgaConsole->row * vgaConsole->fontHeight + vgaConsole->ypos, 71 | vgaConsole->fgColor, 72 | vgaConsole->bgColor); 73 | } 74 | vgaConsole->row++; 75 | vgaConsole->col = 0; 76 | } else { 77 | boot_vga_putChar(ch, 78 | vgaConsole->col * vgaConsole->fontWidth + vgaConsole->xpos, 79 | vgaConsole->row * vgaConsole->fontHeight + vgaConsole->ypos, 80 | vgaConsole->fgColor, 81 | vgaConsole->bgColor); 82 | vgaConsole->col++; 83 | 84 | if (vgaConsole->col >= vgaConsole->width) { 85 | vgaConsole->row++; 86 | vgaConsole->col = 0; 87 | } 88 | } 89 | vgaConsole->cursor = curs; 90 | crt_boot_console_cursor(); 91 | } 92 | 93 | 94 | void crt_boot_console_cursor() { 95 | if (vgaConsole->cursor) { 96 | boot_vga_putChar(' ', 97 | vgaConsole->col * vgaConsole->fontWidth + vgaConsole->xpos, 98 | vgaConsole->row * vgaConsole->fontHeight + vgaConsole->ypos, 99 | vgaConsole->bgColor, 100 | vgaConsole->fgColor); 101 | 102 | } 103 | } 104 | 105 | /** 106 | * put ch in crt mode (in loader.s if you set REQUEST_FLAGS = 3 instead of 7) 107 | */ 108 | int crt_putChar(uchar c, u8 color, u32 x, u32 y) { 109 | if (x >= SCREEN_WIDTH || y >= SCREEN_HEIGHT) { 110 | return 1; // Out of bounds check 111 | } 112 | 113 | uint index = (y * SCREEN_WIDTH + x) * 2; 114 | if (index < SCREEN_WIDTH * SCREEN_HEIGHT * 2) { 115 | CRT_VIDEO_MEMORY[index++] = c; 116 | CRT_VIDEO_MEMORY[index] = color; 117 | return 0; 118 | } 119 | return 1; 120 | } 121 | 122 | void crt_clear_screen(u8 color) { 123 | for (uint y = 0; y < SCREEN_HEIGHT; ++y) { 124 | for (uint x = 0; x < SCREEN_WIDTH; ++x) { 125 | crt_putChar(' ', color, x, y); 126 | } 127 | } 128 | } 129 | 130 | /** 131 | * @TODO no scrolling 132 | */ 133 | Fn_putchar(crt_boot_console) { 134 | if (ch == '\n') { 135 | crtConsole.row++; 136 | crtConsole.col = 0; 137 | } else { 138 | crt_putChar(ch, crtConsole.color, crtConsole.col, crtConsole.row); 139 | crtConsole.col++; 140 | } 141 | } 142 | 143 | /* 144 | 145 | As the is no memory management the Offscreen buffer is allocated elsewhere and passed in. 146 | 147 | videoGraphicsArray class could be re-worked as a Canvas with out to many changes 148 | 149 | */ 150 | void boot_vga_putPixel(i32 x, i32 y, u32 color) { 151 | if (x < 0 || videoGraphicsArray->width <= x || y < 0 || videoGraphicsArray->height <= y) 152 | return; 153 | 154 | ifInside(videoGraphicsArray->width * y + x, videoGraphicsArray->indexMax) 155 | videoGraphicsArray->dest[ videoGraphicsArray->width * y + x] = color; 156 | } 157 | 158 | void boot_vga_fillRectangle(i32 x, i32 y, u32 w, u32 h, u32 color) { 159 | u32 i =videoGraphicsArray->width* (y - 1); 160 | 161 | // test if the Rectangle will be clipped (will it be fully in the screen or partially) 162 | if (x >= 0 && x+w < videoGraphicsArray->width && y >= 0 && y+h < videoGraphicsArray->height) { 163 | // fully drawn 164 | i += x + w; 165 | for(i32 yy = h; yy > 0; yy--) { 166 | i += videoGraphicsArray->width - w; 167 | for(i32 xx = w; xx > 0; xx--) { 168 | ifInside(i, videoGraphicsArray->indexMax) 169 | videoGraphicsArray->dest[i++] = color; 170 | } 171 | } 172 | } else { 173 | // clipped 174 | for(i32 yy = y; yy < y+h; yy++) { 175 | i += videoGraphicsArray->width; 176 | for(i32 xx = x; xx < x+w; xx++) { 177 | if (xx >= 0 && xx < videoGraphicsArray->width && yy >= 0 && yy < videoGraphicsArray->height) 178 | ifInside(i + xx, videoGraphicsArray->indexMax) 179 | videoGraphicsArray->dest[i + xx] = color; 180 | } 181 | } 182 | } 183 | } 184 | 185 | /** 186 | * Copy the screen buffer to the screen 187 | */ 188 | void boot_vga_bufferToScreen() { 189 | // do the multiply once and test against 0 190 | for(int i = videoGraphicsArray->width * videoGraphicsArray->height; i >= 0; i--) { 191 | videoGraphicsArray->screen[i] = videoGraphicsArray->buffer[i]; 192 | } 193 | 194 | // clear the buffer once copied 195 | for(int i = videoGraphicsArray->width * videoGraphicsArray->height; i >= 0; i--) { 196 | videoGraphicsArray->buffer[i] = 0; 197 | } 198 | } 199 | 200 | void boot_vga_putChar(uchar ch, i32 x, i32 y, u32 fgColor, u32 bgColor) { 201 | if (x < 0 || x + vgaConsole->fontWidth > videoGraphicsArray->width 202 | || y < 0 || y + vgaConsole->fontHeight > videoGraphicsArray->height) { 203 | // don't draw if parially or fully outside screen 204 | return; 205 | } 206 | 207 | u8 *fontPointer = &vgaConsole->font[(ch & 0xFF) * vgaConsole->fontHeight]; 208 | u32 ix = (videoGraphicsArray->width * y) + x; 209 | u32 rowInc = videoGraphicsArray->width - vgaConsole->fontWidth; 210 | 211 | u32 nextRow = vgaConsole->fontWidth -1; 212 | for (int i = 0; i < vgaConsole->fontWidth * vgaConsole->fontHeight; i++) 213 | { 214 | ifInside(ix, videoGraphicsArray->indexMax) 215 | if (Bt(fontPointer, i)) 216 | videoGraphicsArray->dest[ix] = fgColor; // Foreground 217 | else 218 | videoGraphicsArray->dest[ix] = bgColor; // Background 219 | 220 | ix++; 221 | 222 | if (i == nextRow) { 223 | ix += rowInc; 224 | nextRow += vgaConsole->fontWidth; 225 | } 226 | } 227 | } 228 | 229 | void boot_vga_putStr(PChar ch, i32 x, i32 y, u32 fgColor, u32 bgColor) { 230 | for (int i; ch[i] != 0; i++, x += vgaConsole->fontWidth) { 231 | boot_vga_putChar(ch[i], x, y, fgColor, bgColor); 232 | } 233 | } 234 | 235 | void boot_vga_init(PVideoGraphicsArray pvideoGraphicsArray, const PMultibootHeader bootHeader, u32 * _buffer) { 236 | videoGraphicsArray = pvideoGraphicsArray; 237 | 238 | videoGraphicsArray->width = bootHeader->framebuffer_width; 239 | videoGraphicsArray->height = bootHeader->framebuffer_height; 240 | videoGraphicsArray->screen = (u32*)bootHeader->framebuffer_addr; 241 | 242 | videoGraphicsArray->buffer = _buffer; 243 | 244 | // initialiase to 0 245 | for (u32 i = 0; i < (videoGraphicsArray->width * (videoGraphicsArray->height)); i++) { 246 | videoGraphicsArray->buffer[i] = (u32)0; 247 | } 248 | 249 | videoGraphicsArray->dest = videoGraphicsArray->screen; 250 | videoGraphicsArray->indexMax = videoGraphicsArray->width * videoGraphicsArray->height; 251 | vgaConsole = &vgaBootConsole; 252 | } 253 | 254 | void boot_vga_window(i32 x, i32 y, u32 cols, u32 rows) { 255 | boot_vga_init_window_console(); 256 | u32 w = cols * vgaConsole->fontWidth + 8; 257 | u32 h = (rows * vgaConsole->fontHeight) + (20 + (vgaConsole->fontHeight*2)); 258 | 259 | vgaFauxWindow.xpos = x+4; 260 | vgaFauxWindow.ypos = y+vgaConsole->fontHeight + 6; 261 | vgaFauxWindow.width = cols; 262 | vgaFauxWindow.height = rows; 263 | 264 | boot_vga_fillRectangle(x, y, w, h, CLR_MED_GREY); // full 265 | boot_vga_fillRectangle(x+2, y+2, w-4, 2, CLR_DARK_BLUE_1); // top bar 266 | boot_vga_fillRectangle(x+2, y+4, w-4, vgaConsole->fontHeight, CLR_BLUE); // top bar 267 | boot_vga_fillRectangle(x+2, y+vgaConsole->fontHeight + 4, w-4, 2, CLR_DARK_BLUE_2); // top bar 268 | boot_vga_fillRectangle(x+2, y+vgaConsole->fontHeight + 6, w-4, h-(vgaConsole->fontHeight * 2 + 12), CLR_LIGHT_GREY_3); // content 269 | boot_vga_fillRectangle(x+2, y+h-(vgaConsole->fontHeight +4), w-4, vgaConsole->fontHeight+2, CLR_LIGHT_GREY_1); // bottom bar 270 | boot_vga_fillRectangle(x+w-37, y+3, vgaConsole->fontWidth+2, vgaConsole->fontHeight+2, CLR_LIGHT_GREY_2); // button back 271 | boot_vga_fillRectangle(x+w-25, y+3, vgaConsole->fontWidth+2, vgaConsole->fontHeight+2, CLR_LIGHT_GREY_2); // button back 272 | boot_vga_fillRectangle(x+w-13, y+3, vgaConsole->fontWidth+2, vgaConsole->fontHeight+2, CLR_LIGHT_GREY_2); // button back 273 | boot_vga_putStr("Look a window", x+(w/2)-(13*8)/2, y+4, CLR_WHITE, CLR_BLUE); 274 | 275 | boot_vga_putChar(255, x+4, y+4, CLR_RED, CLR_BLUE); // square 276 | boot_vga_putChar(255, x+14, y+4, CLR_GREEN, CLR_BLUE); // square 277 | boot_vga_putChar(255, x+24, y+4, CLR_YELLOW, CLR_BLUE); // square 278 | boot_vga_putChar('_', x+w-36, y+4, CLR_DARK_GREY_1, CLR_LIGHT_GREY_2); // minimize 279 | boot_vga_fillRectangle(x+w-24, y+4, vgaConsole->fontWidth, vgaConsole->fontHeight, CLR_DARK_GREY_1); // maximize 280 | boot_vga_fillRectangle(x+w-23, y+5, vgaConsole->fontWidth-2, vgaConsole->fontHeight-2, CLR_LIGHT_GREY_2); // maximize 281 | boot_vga_putChar('X', x+w-12, y+4, CLR_DARK_GREY_1, CLR_LIGHT_GREY_2); // exit 282 | 283 | boot_vga_putStr("Status bar | with | interesting | stuff ", x+4, y+h-(vgaConsole->fontHeight+2), CLR_DARK_GREY_2, CLR_LIGHT_GREY_1); 284 | } 285 | 286 | void boot_vga_init_window_console() { 287 | // transition from being on a blan screen to being in a faux window 288 | vgaConsole = &vgaFauxWindow; 289 | }; 290 | 291 | /* 292 | * 8 * 8 font 1 bit per pixel, 64 bits per charactor 293 | * - I used fonted in TempleOS to draw it. 294 | */ 295 | u64 FONT[256] = { 296 | 0x0000000000000000, 297 | 0x0000000000000000, 298 | 0x000000FF00000000, 299 | 0x000000FF00FF0000, 300 | 0x1818181818181818, 301 | 0x6C6C6C6C6C6C6C6C, 302 | 0x181818F800000000, 303 | 0x6C6C6CEC0CFC0000, 304 | 0x1818181F00000000, 305 | 0x6C6C6C6F607F0000, 306 | 0x000000F818181818, 307 | 0x000000FC0CEC6C6C, 308 | 0x0000001F18181818, 309 | 0x0000007F606F6C6C, 310 | 0x187E7EFFFF7E7E18, // circle 0x00187EFFFF7E1800 311 | 0x0081818181818100, // square 312 | 0x0000000000000000, 313 | 0x0000000000000000, 314 | 0x0000000000000000, 315 | 0x0000000000000000, 316 | 0x0000000000000000, 317 | 0x0000000000000000, 318 | 0x0000000000000000, 319 | 0x0000000000000000, 320 | 0x0000000000000000, 321 | 0x0000000000000000, 322 | 0x0000000000000000, 323 | 0x0000000000000000, 324 | 0x0000000000000000, 325 | 0x0000000000000000, 326 | 0x0000000000000000, 327 | 0x0008000000000000, //  328 | 0x0000000000000000, // 329 | 0x00180018183C3C18, //! 330 | 0x0000000000121236, //" 331 | 0x006C6CFE6CFE6C6C, // # 332 | 0x00187ED07C16FC30, //$$ 333 | 0x0060660C18306606, //% 334 | 0x00DC66B61C36361C, //& 335 | 0x0000000000181818, //' 336 | 0x0030180C0C0C1830, //( 337 | 0x000C18303030180C, //) 338 | 0x0000187E3C7E1800, //* 339 | 0x000018187E181800, //+ 340 | 0x0C18180000000000, //, 341 | 0x000000007E000000, //- 342 | 0x0018180000000000, //. 343 | 0x0000060C18306000, /// 344 | 0x003C42464A52623C, // 0 345 | 0x007E101010101C10, // 1 346 | 0x007E04081020423C, // 2 347 | 0x003C42403840423C, // 3 348 | 0x0020207E22242830, // 4 349 | 0x003C4240403E027E, // 5 350 | 0x003C42423E020438, // 6 351 | 0x000404081020407E, // 7 352 | 0x003C42423C42423C, // 8 353 | 0x001C20407C42423C, // 9 354 | 0x0018180018180000, //: 355 | 0x0C18180018180000, //; 356 | 0x0030180C060C1830, //< 357 | 0x0000007E007E0000, //= 358 | 0x000C18306030180C, //> 359 | 0x001800181830663C, //? 360 | 0x003C06765676663C, //@ 361 | 0x0042427E42422418, // A 362 | 0x003E42423E42423E, // B 363 | 0x003C42020202423C, // C 364 | 0x001E22424242221E, // D 365 | 0x007E02023E02027E, // E 366 | 0x000202023E02027E, // F 367 | 0x003C42427202423C, // G 368 | 0x004242427E424242, // H 369 | 0x007C10101010107C, // I 370 | 0x001C22202020207E, // J 371 | 0x004222120E0A1222, // K 372 | 0x007E020202020202, // L 373 | 0x0082828292AAC682, // M 374 | 0x00424262524A4642, // N 375 | 0x003C42424242423C, // O 376 | 0x000202023E42423E, // P 377 | 0x005C22424242423C, // Q 378 | 0x004242423E42423E, // R 379 | 0x003C42403C02423C, // S 380 | 0x001010101010107C, // T 381 | 0x003C424242424242, // U 382 | 0x0018244242424242, // V 383 | 0x0044AAAA92828282, // W 384 | 0x0042422418244242, // X 385 | 0x0010101038444444, // Y 386 | 0x007E04081020407E, // Z 387 | 0x003E02020202023E, //[ 388 | 0x00006030180C0600, /* //\ */ 389 | 0x007C40404040407C, //] 390 | 0x000000000000663C, //^ 391 | 0xFF00000000000000, //_ 392 | 0x000000000030180C, //` 393 | 0x007C427C403C0000, // a 394 | 0x003E4242423E0202, // b 395 | 0x003C4202423C0000, // c 396 | 0x007C4242427C4040, // d 397 | 0x003C027E423C0000, // e 398 | 0x000404043E040438, // f 399 | 0x3C407C42427C0000, // g 400 | 0x00424242423E0202, // h 401 | 0x003C1010101C0018, // i 402 | 0x0E101010101C0018, // j 403 | 0x0042221E22420200, // k 404 | 0x003C101010101018, // l 405 | 0x00829292AA440000, // m 406 | 0x00424242423E0000, // n 407 | 0x003C4242423C0000, // o 408 | 0x02023E42423E0000, // p 409 | 0xC0407C42427C0000, // q 410 | 0x00020202463A0000, // r 411 | 0x003E403C027C0000, // s 412 | 0x00380404043E0404, // t 413 | 0x003C424242420000, // u 414 | 0x0018244242420000, // v 415 | 0x006C929292820000, // w 416 | 0x0042241824420000, // x 417 | 0x3C407C4242420000, // y 418 | 0x007E0418207E0000, // z 419 | 0x003018180E181830, //{ 420 | 0x0018181818181818, //| 421 | 0x000C18187018180C, //} 422 | 0x000000000062D68C, //~ 423 | 0xFFFFFFFFFFFFFFFF, 424 | 0x1E30181E3303331E, // € 425 | 0x007E333333003300, //  426 | 0x001E033F331E0038, // ‚ 427 | 0x00FC667C603CC37E, // ƒ 428 | 0x007E333E301E0033, // „ 429 | 0x007E333E301E0007, // … 430 | 0x007E333E301E0C0C, // † 431 | 0x3C603E03033E0000, // ‡ 432 | 0x003C067E663CC37E, // ˆ 433 | 0x001E033F331E0033, // ‰ 434 | 0x001E033F331E0007, // Š 435 | 0x001E0C0C0C0E0033, // ‹ 436 | 0x003C1818181C633E, // Œ 437 | 0x001E0C0C0C0E0007, //  438 | 0x00333F33331E0C33, // Ž 439 | 0x00333F331E000C0C, //  440 | 0x003F061E063F0038, //  441 | 0x00FE33FE30FE0000, // ‘ 442 | 0x007333337F33367C, // ’ 443 | 0x001E33331E00331E, // “ 444 | 0x001E33331E003300, // ” 445 | 0x001E33331E000700, // • 446 | 0x007E33333300331E, // – 447 | 0x007E333333000700, // — 448 | 0x1F303F3333003300, // ˜ 449 | 0x001C3E63633E1C63, // ™ 450 | 0x001E333333330033, // š 451 | 0x18187E03037E1818, // › 452 | 0x003F67060F26361C, // œ 453 | 0x000C3F0C3F1E3333, //  454 | 0x70337B332F1B1B0F, // ž 455 | 0x0E1B18187E18D870, // Ÿ 456 | 0x007E333E301E0038, //   457 | 0x001E0C0C0C0E001C, // ¡ 458 | 0x001E33331E003800, // ¢ 459 | 0x007E333333003800, // £ 460 | 0x003333331F001F00, // ¤ 461 | 0x00333B3F3733003F, // ¥ 462 | 0x00007E007C36363C, // ¦ 463 | 0x00007E003C66663C, // § 464 | 0x001E3303060C000C, // ¨ 465 | 0x000003033F000000, // © 466 | 0x000030303F000000, // ª 467 | 0xF81973C67C1B3363, // « 468 | 0xC0F9F3E6CF1B3363, // ¬ 469 | 0x183C3C1818001800, // ­ 470 | 0x0000CC663366CC00, // ® 471 | 0x00003366CC663300, // ¯ 472 | 0x1144114411441144, // ° 473 | 0x55AA55AA55AA55AA, // ± 474 | 0xEEBBEEBBEEBBEEBB, // ² 475 | 0x1818181818181818, // ³ 476 | 0x1818181F18181818, // ´ 477 | 0x1818181F181F1818, // µ 478 | 0x6C6C6C6F6C6C6C6C, // ¶ 479 | 0x6C6C6C7F00000000, // · 480 | 0x1818181F181F0000, // ¸ 481 | 0x6C6C6C6F606F6C6C, // ¹ 482 | 0x6C6C6C6C6C6C6C6C, // º 483 | 0x6C6C6C6F607F0000, // » 484 | 0x0000007F606F6C6C, // ¼ 485 | 0x0000007F6C6C6C6C, // ½ 486 | 0x0000001F181F1818, // ¾ 487 | 0x1818181F00000000, // ¿ 488 | 0x000000F818181818, // À 489 | 0x000000FF18181818, // Á 490 | 0x181818FF00000000, //  491 | 0x181818F818181818, // à 492 | 0x000000FF00000000, // Ä 493 | 0x181818FF18181818, // Å 494 | 0x181818F818F81818, // Æ 495 | 0x6C6C6CEC6C6C6C6C, // Ç 496 | 0x000000FC0CEC6C6C, // È 497 | 0x6C6C6CEC0CFC0000, // É 498 | 0x000000FF00EF6C6C, // Ê 499 | 0x6C6C6CEF00FF0000, // Ë 500 | 0x6C6C6CEC0CEC6C6C, // Ì 501 | 0x000000FF00FF0000, // Í 502 | 0x6C6C6CEF00EF6C6C, // Î 503 | 0x000000FF00FF1818, // Ï 504 | 0x000000FF6C6C6C6C, // Ð 505 | 0x181818FF00FF0000, // Ñ 506 | 0x6C6C6CFF00000000, // Ò 507 | 0x000000FC6C6C6C6C, // Ó 508 | 0x000000F818F81818, // Ô 509 | 0x181818F818F80000, // Õ 510 | 0x6C6C6CFC00000000, // Ö 511 | 0x6C6C6CEF6C6C6C6C, // × 512 | 0x181818FF00FF1818, // Ø 513 | 0x0000001F18181818, // Ù 514 | 0x181818F800000000, // Ú 515 | 0xFFFFFFFFFFFFFFFF, // Û 516 | 0xFFFFFFFF00000000, // Ü 517 | 0x0F0F0F0F0F0F0F0F, // Ý 518 | 0xF0F0F0F0F0F0F0F0, // Þ 519 | 0x00000000FFFFFFFF, // ß 520 | 0x006E3B133B6E0000, // à 521 | 0x03031F331F331E00, // á 522 | 0x0003030303637F00, // â 523 | 0x0036363636367F00, // ã 524 | 0x007F660C180C667F, // ä 525 | 0x001E3333337E0000, // å 526 | 0x03063E6666666600, // æ 527 | 0x00181818183B6E00, // ç 528 | 0x3F0C1E33331E0C3F, // è 529 | 0x001C36637F63361C, // é 530 | 0x007736366363361C, // ê 531 | 0x001E33333E180C38, // ë 532 | 0x00007EDBDB7E0000, // ì 533 | 0x03067EDBDB7E3060, // í 534 | 0x003C06033F03063C, // î 535 | 0x003333333333331E, // ï 536 | 0x00003F003F003F00, // ð 537 | 0x003F000C0C3F0C0C, // ñ 538 | 0x003F00060C180C06, // ò 539 | 0x003F00180C060C18, // ó 540 | 0x1818181818D8D870, // ô 541 | 0x0E1B1B1818181818, // õ 542 | 0x000C0C003F000C0C, // ö 543 | 0x0000394E00394E00, // ÷ 544 | 0x000000001C36361C, // ø 545 | 0x0000001818000000, // ù 546 | 0x0000001800000000, // ú 547 | 0x383C3637303030F0, // û 548 | 0x000000363636361E, // ü 549 | 0x0000003E061C301E, // ý 550 | 0x00003C3C3C3C0000, // þ 551 | 0xFFFFFFFFFFFFFFFF, // ÿ 552 | }; 553 | 554 | 555 | u8 sys_font_std_8x12[256*12] = { 556 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 557 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 558 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00, 559 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, 560 | 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, 561 | 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, 562 | 0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x38,0x18,0x18,0x18,0x18, 563 | 0x00,0x00,0x00,0x00,0xF8,0x1C,0xCC,0xEC,0x6C,0x6C,0x6C,0x6C, 564 | 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x1C,0x18,0x18,0x18,0x18, 565 | 0x00,0x00,0x00,0x00,0x3F,0x70,0x67,0x6E,0x6C,0x6C,0x6C,0x6C, 566 | 0x18,0x18,0x18,0x18,0x18,0x38,0xF0,0x00,0x00,0x00,0x00,0x00, 567 | 0x3C,0x3C,0x3C,0x7C,0xFC,0xFC,0xF8,0x00,0x00,0x00,0x00,0x00, 568 | 0x18,0x18,0x18,0x18,0x18,0x1C,0x0F,0x00,0x00,0x00,0x00,0x00, 569 | 0x6C,0x6C,0x6C,0x6E,0x67,0x70,0x3F,0x00,0x00,0x00,0x00,0x00, 570 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 571 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 572 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 573 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 574 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 575 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 576 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 577 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 578 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 579 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 580 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 581 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 582 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 583 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 584 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 585 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 586 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 587 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,// 588 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 589 | 0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,//! 590 | 0x00,0x6C,0x6C,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 591 | 0x00,0x00,0x00,0x36,0x7F,0x36,0x36,0x36,0x7F,0x36,0x00,0x00,//# 592 | 0x00,0x08,0x3E,0x6B,0x0E,0x1C,0x38,0x6B,0x3E,0x08,0x00,0x00,//$$ 593 | 0x00,0x00,0x00,0x46,0x66,0x30,0x18,0x0C,0x66,0x63,0x00,0x00,//% 594 | 0x00,0x1C,0x36,0x1C,0x1C,0x4E,0x7F,0x33,0x33,0x6E,0x00,0x00,//& 595 | 0x38,0x38,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 596 | 0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,//( 597 | 0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,//) 598 | 0x00,0x00,0x00,0x36,0x1C,0x7F,0x1C,0x36,0x00,0x00,0x00,0x00,//* 599 | 0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,//+ 600 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x18,0x00,//, 601 | 0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,//- 602 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,//. 603 | 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x03,0x00,0x00,0x00,/// 604 | 0x00,0x3E,0x63,0x63,0x63,0x6B,0x63,0x63,0x63,0x3E,0x00,0x00,//0 605 | 0x00,0x18,0x1E,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,//1 606 | 0x00,0x3E,0x63,0x63,0x30,0x18,0x0C,0x06,0x63,0x7F,0x00,0x00,//2 607 | 0x00,0x3E,0x63,0x60,0x60,0x3C,0x60,0x60,0x63,0x3E,0x00,0x00,//3 608 | 0x00,0x30,0x38,0x3C,0x36,0x33,0x7F,0x30,0x30,0x30,0x00,0x00,//4 609 | 0x00,0x7F,0x03,0x03,0x03,0x3F,0x60,0x60,0x63,0x3E,0x00,0x00,//5 610 | 0x00,0x3E,0x63,0x03,0x03,0x3F,0x63,0x63,0x63,0x3E,0x00,0x00,//6 611 | 0x00,0x7F,0x63,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x00,0x00,//7 612 | 0x00,0x3E,0x63,0x63,0x63,0x3E,0x63,0x63,0x63,0x3E,0x00,0x00,//8 613 | 0x00,0x3E,0x63,0x63,0x63,0x7E,0x60,0x60,0x63,0x3E,0x00,0x00,//9 614 | 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 615 | 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x18,0x00,//; 616 | 0x00,0x30,0x18,0x0C,0x06,0x03,0x06,0x0C,0x18,0x30,0x00,0x00,//< 617 | 0x00,0x00,0x00,0x00,0x7F,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,//= 618 | 0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,//> 619 | 0x00,0x3E,0x63,0x63,0x30,0x18,0x18,0x00,0x18,0x18,0x00,0x00,//? 620 | 0x00,0x3E,0x63,0x63,0x7B,0x7B,0x7B,0x3B,0x03,0x7E,0x00,0x00,//@ 621 | 0x00,0x1C,0x36,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x00,0x00,//A 622 | 0x00,0x3F,0x66,0x66,0x66,0x3E,0x66,0x66,0x66,0x3F,0x00,0x00,//B 623 | 0x00,0x3C,0x66,0x03,0x03,0x03,0x03,0x03,0x66,0x3C,0x00,0x00,//C 624 | 0x00,0x1F,0x36,0x66,0x66,0x66,0x66,0x66,0x36,0x1F,0x00,0x00,//D 625 | 0x00,0x7F,0x66,0x06,0x06,0x3E,0x06,0x06,0x66,0x7F,0x00,0x00,//E 626 | 0x00,0x7F,0x66,0x06,0x06,0x3E,0x06,0x06,0x06,0x0F,0x00,0x00,//F 627 | 0x00,0x3E,0x63,0x63,0x03,0x03,0x73,0x63,0x63,0x3E,0x00,0x00,//G 628 | 0x00,0x63,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x63,0x00,0x00,//H 629 | 0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,//I 630 | 0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x1B,0x1B,0x0E,0x00,0x00,//J 631 | 0x00,0x63,0x33,0x1B,0x0F,0x0F,0x1B,0x33,0x63,0x63,0x00,0x00,//K 632 | 0x00,0x0F,0x06,0x06,0x06,0x06,0x06,0x46,0x66,0x7F,0x00,0x00,//L 633 | 0x00,0x63,0x63,0x77,0x7F,0x6B,0x6B,0x6B,0x63,0x63,0x00,0x00,//M 634 | 0x00,0x63,0x63,0x67,0x67,0x6F,0x7B,0x73,0x73,0x63,0x00,0x00,//N 635 | 0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,//O 636 | 0x00,0x3F,0x66,0x66,0x66,0x3E,0x06,0x06,0x06,0x0F,0x00,0x00,//P 637 | 0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x6B,0x3E,0x60,0x00,//Q 638 | 0x00,0x3F,0x66,0x66,0x66,0x3E,0x1E,0x36,0x66,0x67,0x00,0x00,//R 639 | 0x00,0x3E,0x63,0x03,0x06,0x1C,0x30,0x60,0x63,0x3E,0x00,0x00,//S 640 | 0x00,0x7E,0x5A,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,//T 641 | 0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,//U 642 | 0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x08,0x00,0x00,//V 643 | 0x00,0x63,0x63,0x6B,0x6B,0x6B,0x7F,0x77,0x63,0x63,0x00,0x00,//W 644 | 0x00,0x63,0x63,0x36,0x1C,0x1C,0x1C,0x36,0x63,0x63,0x00,0x00,//X 645 | 0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x3C,0x00,0x00,//Y 646 | 0x00,0x7F,0x63,0x31,0x18,0x0C,0x06,0x43,0x63,0x7F,0x00,0x00,//Z 647 | 0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x3E,0x00,0x00,//[ 648 | 0x00,0x00,0x00,0x03,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,// 649 | 0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E,0x00,0x00,//] 650 | 0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 651 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,//_ 652 | 0x38,0x38,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 653 | 0x00,0x00,0x00,0x00,0x1E,0x30,0x3E,0x33,0x3B,0x6E,0x00,0x00,//a 654 | 0x00,0x07,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x3F,0x00,0x00,//b 655 | 0x00,0x00,0x00,0x00,0x3E,0x63,0x03,0x03,0x63,0x3E,0x00,0x00,//c 656 | 0x00,0x38,0x30,0x30,0x3E,0x33,0x33,0x33,0x33,0x7E,0x00,0x00,//d 657 | 0x00,0x00,0x00,0x00,0x3E,0x63,0x7F,0x03,0x63,0x3E,0x00,0x00,//e 658 | 0x00,0x38,0x6C,0x0C,0x0C,0x3F,0x0C,0x0C,0x0C,0x1E,0x00,0x00,//f 659 | 0x00,0x00,0x00,0x00,0x6E,0x73,0x63,0x63,0x7E,0x60,0x63,0x3E,//g 660 | 0x00,0x07,0x06,0x06,0x36,0x6E,0x66,0x66,0x66,0x67,0x00,0x00,//h 661 | 0x00,0x18,0x18,0x00,0x1C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,//i 662 | 0x00,0x00,0x30,0x30,0x00,0x38,0x30,0x30,0x30,0x33,0x33,0x1E,//j 663 | 0x00,0x07,0x06,0x06,0x66,0x36,0x1E,0x36,0x66,0x67,0x00,0x00,//k 664 | 0x00,0x0E,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x2C,0x18,0x00,0x00,//l 665 | 0x00,0x00,0x00,0x00,0x36,0x7F,0x6B,0x6B,0x63,0x63,0x00,0x00,//m 666 | 0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x66,0x00,0x00,//n 667 | 0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,//o 668 | 0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x3E,0x06,0x06,0x0F,//p 669 | 0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x3E,0x30,0x30,0x78,//q 670 | 0x00,0x00,0x00,0x00,0x3B,0x66,0x06,0x06,0x06,0x0F,0x00,0x00,//r 671 | 0x00,0x00,0x00,0x00,0x3E,0x63,0x0E,0x38,0x63,0x3E,0x00,0x00,//s 672 | 0x00,0x0C,0x0C,0x0C,0x3F,0x0C,0x0C,0x0C,0x6C,0x38,0x00,0x00,//t 673 | 0x00,0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x33,0x6E,0x00,0x00,//u 674 | 0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x36,0x1C,0x08,0x00,0x00,//v 675 | 0x00,0x00,0x00,0x00,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x00,0x00,//w 676 | 0x00,0x00,0x00,0x00,0x63,0x36,0x1C,0x1C,0x36,0x63,0x00,0x00,//x 677 | 0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x73,0x6E,0x60,0x63,0x3E,//y 678 | 0x00,0x00,0x00,0x00,0x7F,0x31,0x18,0x0C,0x46,0x7F,0x00,0x00,//z 679 | 0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x70,0x00,0x00,//{ 680 | 0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,//| 681 | 0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x0E,0x00,0x00,//} 682 | 0x00,0x6E,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 683 | 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00, 684 | 0x00,0x00,0x1E,0x33,0x03,0x33,0x1E,0x18,0x30,0x1E,0x00,0x00,//� 685 | 0x00,0x00,0x00,0x33,0x00,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,//� 686 | 0x00,0x00,0x38,0x00,0x1E,0x33,0x3F,0x03,0x1E,0x00,0x00,0x00,//� 687 | 0x00,0x00,0x7E,0xC3,0x3C,0x60,0x7C,0x66,0xFC,0x00,0x00,0x00,//� 688 | 0x00,0x00,0x33,0x00,0x1E,0x30,0x3E,0x33,0x7E,0x00,0x00,0x00,//� 689 | 0x00,0x00,0x07,0x00,0x1E,0x30,0x3E,0x33,0x7E,0x00,0x00,0x00,//� 690 | 0x00,0x00,0x0C,0x0C,0x1E,0x30,0x3E,0x33,0x7E,0x00,0x00,0x00,//� 691 | 0x00,0x00,0x00,0x00,0x3E,0x03,0x03,0x3E,0x60,0x3C,0x00,0x00,//� 692 | 0x00,0x00,0x7E,0xC3,0x3C,0x66,0x7E,0x06,0x3C,0x00,0x00,0x00,//� 693 | 0x00,0x00,0x33,0x00,0x1E,0x33,0x3F,0x03,0x1E,0x00,0x00,0x00,//� 694 | 0x00,0x00,0x07,0x00,0x1E,0x33,0x3F,0x03,0x1E,0x00,0x00,0x00,//� 695 | 0x00,0x00,0x33,0x00,0x0E,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,//� 696 | 0x00,0x00,0x3E,0x63,0x1C,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,//� 697 | 0x00,0x00,0x07,0x00,0x0E,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,//� 698 | 0x00,0x00,0x33,0x0C,0x1E,0x33,0x33,0x3F,0x33,0x00,0x00,0x00,//� 699 | 0x00,0x00,0x0C,0x0C,0x00,0x1E,0x33,0x3F,0x33,0x00,0x00,0x00,//� 700 | 0x00,0x00,0x38,0x00,0x3F,0x06,0x1E,0x06,0x3F,0x00,0x00,0x00,//� 701 | 0x00,0x00,0x00,0x00,0xFE,0x30,0xFE,0x33,0xFE,0x00,0x00,0x00,//� 702 | 0x00,0x00,0x7C,0x36,0x33,0x7F,0x33,0x33,0x73,0x00,0x00,0x00,//� 703 | 0x00,0x00,0x1E,0x33,0x00,0x1E,0x33,0x33,0x1E,0x00,0x00,0x00,//� 704 | 0x00,0x00,0x00,0x33,0x00,0x1E,0x33,0x33,0x1E,0x00,0x00,0x00,//� 705 | 0x00,0x00,0x00,0x07,0x00,0x1E,0x33,0x33,0x1E,0x00,0x00,0x00,//� 706 | 0x00,0x00,0x1E,0x33,0x00,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,//� 707 | 0x00,0x00,0x00,0x07,0x00,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,//� 708 | 0x00,0x00,0x00,0x33,0x00,0x33,0x33,0x3F,0x30,0x1F,0x00,0x00,//� 709 | 0x00,0x00,0x63,0x1C,0x3E,0x63,0x63,0x3E,0x1C,0x00,0x00,0x00,//� 710 | 0x00,0x00,0x33,0x00,0x33,0x33,0x33,0x33,0x1E,0x00,0x00,0x00,//� 711 | 0x00,0x00,0x18,0x18,0x7E,0x03,0x03,0x7E,0x18,0x18,0x00,0x00,//� 712 | 0x00,0x00,0x1C,0x36,0x26,0x0F,0x06,0x67,0x3F,0x00,0x00,0x00,//� 713 | 0x00,0x00,0x33,0x33,0x1E,0x3F,0x0C,0x3F,0x0C,0x00,0x00,0x00,//� 714 | 0x00,0x00,0x0F,0x1B,0x1B,0x2F,0x33,0x7B,0x33,0x70,0x00,0x00,//� 715 | 0x00,0x00,0x70,0xD8,0x18,0x7E,0x18,0x18,0x1B,0x0E,0x00,0x00,//� 716 | 0x00,0x00,0x38,0x00,0x1E,0x30,0x3E,0x33,0x7E,0x00,0x00,0x00,//� 717 | 0x00,0x00,0x1C,0x00,0x0E,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,//� 718 | 0x00,0x00,0x00,0x38,0x00,0x1E,0x33,0x33,0x1E,0x00,0x00,0x00,//� 719 | 0x00,0x00,0x00,0x38,0x00,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,//� 720 | 0x00,0x00,0x00,0x1F,0x00,0x1F,0x33,0x33,0x33,0x00,0x00,0x00,//� 721 | 0x00,0x00,0x3F,0x00,0x33,0x37,0x3F,0x3B,0x33,0x00,0x00,0x00,//� 722 | 0x00,0x00,0x3C,0x36,0x36,0x7C,0x00,0x7E,0x00,0x00,0x00,0x00,//� 723 | 0x00,0x00,0x3C,0x66,0x66,0x3C,0x00,0x7E,0x00,0x00,0x00,0x00,//� 724 | 0x00,0x00,0x0C,0x00,0x0C,0x06,0x03,0x33,0x1E,0x00,0x00,0x00,//� 725 | 0x00,0x00,0x00,0x00,0x00,0x3F,0x03,0x03,0x00,0x00,0x00,0x00,//� 726 | 0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x30,0x00,0x00,0x00,0x00,//� 727 | 0x00,0x00,0x63,0x33,0x1B,0x7C,0xC6,0x73,0x19,0xF8,0x00,0x00,//� 728 | 0x00,0x00,0x63,0x33,0x1B,0xCF,0xE6,0xF3,0xF9,0xC0,0x00,0x00,//� 729 | 0x00,0x00,0x00,0x18,0x00,0x18,0x18,0x3C,0x3C,0x18,0x00,0x00,//� 730 | 0x00,0x00,0x00,0xCC,0x66,0x33,0x66,0xCC,0x00,0x00,0x00,0x00,//� 731 | 0x00,0x00,0x00,0x33,0x66,0xCC,0x66,0x33,0x00,0x00,0x00,0x00,//� 732 | 0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,//� 733 | 0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,//� 734 | 0xBB,0xEE,0xBB,0xEE,0xBB,0xEE,0xBB,0xEE,0xBB,0xEE,0xBB,0xEE,//� 735 | 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,//� 736 | 0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,//� 737 | 0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,//� 738 | 0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x6F,0x6C,0x6C,0x6C,0x6C,0x6C,//� 739 | 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x7C,0x6C,0x6C,0x6C,0x6C,//� 740 | 0x00,0x00,0x00,0x00,0x0F,0x1C,0x1F,0x18,0x18,0x18,0x18,0x18,//� 741 | 0x6C,0x6C,0x6C,0x6C,0x67,0x60,0x67,0x6C,0x6C,0x6C,0x6C,0x6C,//� 742 | 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,//� 743 | 0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,//� 744 | 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xFF,0xFF,0x7F,0x3F,//� 745 | 0x6C,0x6C,0x6C,0x6C,0x6C,0x7C,0x3F,0x00,0x00,0x00,0x00,0x00,//� 746 | 0x18,0x18,0x18,0x18,0x1F,0x1C,0x0F,0x00,0x00,0x00,0x00,0x00,//� 747 | 0x00,0x3F,0x7F,0x70,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,//� 748 | 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0E,0xFE,0xFC,0x00,//� 749 | 0x00,0x00,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,//� 750 | 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,//� 751 | 0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,//� 752 | 0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//� 753 | 0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,//� 754 | 0x18,0x18,0x18,0x38,0xD8,0x18,0xD8,0x38,0x18,0x18,0x18,0x18,//� 755 | 0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0xEC,0x6C,0x6C,0x6C,0x6C,0x6C,//� 756 | 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x1F,0xFF,0xFF,0xFE,0xFC,//� 757 | 0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,//� 758 | 0x00,0x00,0x6C,0x6C,0xEF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,//� 759 | 0x00,0x00,0x00,0x00,0xFF,0x00,0xEF,0x6C,0x6C,0x6C,0x00,0x00,//� 760 | 0x00,0x00,0x6C,0x6C,0xEC,0x0C,0xEC,0x6C,0x6C,0x6C,0x00,0x00,//� 761 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,//� 762 | 0x6C,0x6C,0x6C,0x6C,0xEF,0x00,0xEF,0x6C,0x6C,0x6C,0x6C,0x6C,//� 763 | 0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,//� 764 | 0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0xFF,0x00,0x00,0x00,0x00,0x00,//� 765 | 0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,//� 766 | 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x6C,0x6C,0x6C,0x6C,0x6C,//� 767 | 0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0xFC,0x00,0x00,0x00,0x00,0x00,//� 768 | 0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,//� 769 | 0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,//� 770 | 0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x6C,0x6C,0x6C,0x6C,0x6C,//� 771 | 0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0xEF,0x6C,0x6C,0x6C,0x6C,0x6C,//� 772 | 0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,//� 773 | 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x70,0x7F,0x3F,0x00,//� 774 | 0x00,0xFC,0xFE,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,//� 775 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,//� 776 | 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,//� 777 | 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,//� 778 | 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,//� 779 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,//� 780 | 0x00,0x00,0x00,0x00,0x6E,0x3B,0x13,0x3B,0x6E,0x00,0x00,0x00,//� 781 | 0x00,0x00,0x00,0x1E,0x33,0x1F,0x33,0x1F,0x03,0x03,0x00,0x00,//� 782 | 0x00,0x00,0x00,0x7F,0x63,0x03,0x03,0x03,0x03,0x00,0x00,0x00,//� 783 | 0x00,0x00,0x00,0x7F,0x36,0x36,0x36,0x36,0x36,0x00,0x00,0x00,//� 784 | 0x00,0x00,0x7F,0x66,0x0C,0x18,0x0C,0x66,0x7F,0x00,0x00,0x00,//� 785 | 0x00,0x00,0x00,0x00,0x7E,0x33,0x33,0x33,0x1E,0x00,0x00,0x00,//� 786 | 0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3E,0x06,0x03,0x00,0x00,//� 787 | 0x00,0x00,0x00,0x6E,0x3B,0x18,0x18,0x18,0x18,0x00,0x00,0x00,//� 788 | 0x00,0x00,0x3F,0x0C,0x1E,0x33,0x33,0x1E,0x0C,0x3F,0x00,0x00,//� 789 | 0x00,0x00,0x1C,0x36,0x63,0x7F,0x63,0x36,0x1C,0x00,0x00,0x00,//� 790 | 0x00,0x00,0x1C,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x00,0x00,//� 791 | 0x00,0x00,0x38,0x0C,0x18,0x3E,0x33,0x33,0x1E,0x00,0x00,0x00,//� 792 | 0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,//� 793 | 0x00,0x00,0x60,0x30,0x7E,0xDB,0xDB,0x7E,0x06,0x03,0x00,0x00,//� 794 | 0x00,0x00,0x3C,0x06,0x03,0x3F,0x03,0x06,0x3C,0x00,0x00,0x00,//� 795 | 0x00,0x00,0x1E,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,//� 796 | 0x00,0x00,0x00,0x3F,0x00,0x3F,0x00,0x3F,0x00,0x00,0x00,0x00,//� 797 | 0x00,0x00,0x0C,0x0C,0x3F,0x0C,0x0C,0x00,0x3F,0x00,0x00,0x00,//� 798 | 0x00,0x00,0x06,0x0C,0x18,0x0C,0x06,0x00,0x3F,0x00,0x00,0x00,//� 799 | 0x00,0x00,0x18,0x0C,0x06,0x0C,0x18,0x00,0x3F,0x00,0x00,0x00,//� 800 | 0x00,0x00,0x70,0xD8,0xD8,0x18,0x18,0x18,0x18,0x18,0x00,0x00,//� 801 | 0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x1B,0x1B,0x1E,0x0C,0x00,//� 802 | 0x00,0x00,0x0C,0x0C,0x00,0x3F,0x00,0x0C,0x0C,0x00,0x00,0x00,//� 803 | 0x00,0x00,0x00,0x4E,0x39,0x00,0x4E,0x39,0x00,0x00,0x00,0x00,//� 804 | 0x00,0x00,0x1C,0x36,0x36,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,//� 805 | 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,//� 806 | 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,//� 807 | 0x00,0x00,0xF0,0x30,0x30,0x30,0x37,0x36,0x3C,0x38,0x30,0x00,//� 808 | 0x00,0x00,0x1E,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x00,0x00,//� 809 | 0x00,0x00,0x1E,0x30,0x1C,0x06,0x3E,0x00,0x00,0x00,0x00,0x00,//� 810 | 0x00,0x00,0x00,0x00,0x3C,0x3C,0x3C,0x3C,0x00,0x00,0x00,0x00,//� 811 | 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,//� 812 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------