From 9b13ca03dacb6a385461dccad319010537add5cf Mon Sep 17 00:00:00 2001 From: Miguel Date: Sun, 19 Aug 2018 03:15:50 +0200 Subject: get vesa working in vmem. --- asm/multiboot.s | 9 +- driver/mouse.c | 3 + driver/vesa.c | 243 +++++++++ driver/vesa.h | 47 ++ kernel/kernel.c | 7 +- kernel/multiboot.c | 68 ++- kernel/multiboot.h | 10 +- kernel/syscalls.h | 10 + kernel/vmem.c | 55 +- kernel/vmem.h | 2 +- userspace/fonts/Makefile | 5 + userspace/fonts/binarize.py | 87 +++ userspace/fonts/binfont.src | 1235 +++++++++++++++++++++++++++++++++++++++++++ userspace/foolshell.c | 24 +- xxx/font/Makefile | 5 - xxx/font/binarize.py | 87 --- xxx/font/binfont.src | 1235 ------------------------------------------- xxx/video/vesa.c | 245 --------- xxx/video/vesa.h | 47 -- 19 files changed, 1775 insertions(+), 1649 deletions(-) create mode 100644 driver/vesa.c create mode 100644 driver/vesa.h create mode 100644 userspace/fonts/Makefile create mode 100644 userspace/fonts/binarize.py create mode 100644 userspace/fonts/binfont.src delete mode 100644 xxx/font/Makefile delete mode 100644 xxx/font/binarize.py delete mode 100644 xxx/font/binfont.src delete mode 100644 xxx/video/vesa.c delete mode 100644 xxx/video/vesa.h diff --git a/asm/multiboot.s b/asm/multiboot.s index 22be3d1..1d808a3 100644 --- a/asm/multiboot.s +++ b/asm/multiboot.s @@ -27,10 +27,10 @@ .long 0 .long 0 -.long 1 #gfx_stuff -.long 800 -.long 600 -.long 24 +.long 0 #gfx_stuff 0=enable! +.long 1280 +.long 1024 +.long 32 # Currently the stack pointer register (esp) points at anything and using it may # cause massive harm. Instead, we'll provide our own stack. We will allocate @@ -58,7 +58,6 @@ _start: push %ebx #pass address of the multiboot information data structure push %eax #pass eax, so kernel can check for magic number - call kernel_main diff --git a/driver/mouse.c b/driver/mouse.c index d676f45..d4dbb56 100644 --- a/driver/mouse.c +++ b/driver/mouse.c @@ -100,6 +100,7 @@ void mouse_init() void mouse_log() { //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%02x / %02x / %02x ",mouse_byte[0], mouse_byte[1],mouse_byte[2]); + //TODO: ignore last packet for 4packets mouse and resync if you get out of sync if(mouse_byte[0]&0x80||mouse_byte[0]&0x40)return; //skip packet on overflow if(!(mouse_byte[0]&0x8))panic(FOOLOS_MODULE_NAME,"mouse packets out of sync!?"); // this bit is always 1, otherwise panic! @@ -128,6 +129,8 @@ void mouse_log() if(mouse_y>600)mouse_y=600; log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d / %d / %02x ",mouse_x, mouse_y,mouse_byte[2]); + if (mouse_byte[0] & 1)vesa_put_rect(mouse_x,600-mouse_y,10,10,0x00ffff); + else vesa_put_rect(mouse_x,600-mouse_y,10,10,0x0000ff); //PutFont('X', mouse_x,600-mouse_y, 0xffffff); } diff --git a/driver/vesa.c b/driver/vesa.c new file mode 100644 index 0000000..9b0dd55 --- /dev/null +++ b/driver/vesa.c @@ -0,0 +1,243 @@ +//http://wiki.osdev.org/GUI + +#include +#include "kernel/mem.h" +#include "vesa.h" + +#include "lib/logger/log.h" // logger facilities +#include "lib/printf/printf.h" +#define FOOLOS_MODULE_NAME "vesa" + +//#define FOOLSOS_SHOW_VESAMODES + +static foolfont *deffont; +static vbemodeinfo *VbeModeInfoBlock; + +static int console_x; +static int console_y; + +static int console_lines; +static int console_cols; + +static uint8_t* buffer; +static uint8_t* physbase; + +void PutConsoleNL(); +void PutPixel(int x,int y, int color); + +void vesa_switch_buffers() +{ + for(int i=0;i<800*600*2;i++)physbase[i]=buffer[i]; +} + +void vesa_put_rect(int x, int y, int w , int h, int color) +{ + for(int i=x;iXres, VbeModeInfoBlock->Yres, 0xffffff); +} + +void vesa_set_physbase(uint32_t addr) +{ + VbeModeInfoBlock->physbase=addr; +} + + // + // We want to get output to the screen as fast as possible! + // + // Our Fool-Boot-Loader did set up VESA already for us. + // The desired VESA mode is hardcoded in [boot/mbr.asm]. + // + // The [vesa_init(...)] function requires: + // + // * the addresses of the vbeinfo struct + // * the address of the vbemodeinfo struct (for selected mode). + // * Fool Font loaded inside ramimage + // + // The first two paramters are hardcoded in [boot/mbr.asm], + // while the last one is set in the Makefile. The font binary + // is integrated in the kernel image. + // + // this function returns the physical base address of + // our video memory + // + +uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) +{ + //the only functionallu important init lines! (rest is log) + VbeModeInfoBlock=mode; + deffont=rawfont; + console_x=0; + console_y=0; + + int line_height=12; + int col_width=10; + console_lines=mode->Yres/line_height; + console_cols=mode->Xres/col_width; + + // vesa info + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"vbe version: 0x%x / video mode ptr: 0x%x 0x%x", + info->VbeVersion, info->VideoModePtr[1], info->VideoModePtr[0]); + + // vesa info on selected mode: + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"colors r:%d 0x%x g:%d 0x%x b:%d 0x%x", + mode->red_position,mode->red_mask, + mode->green_position,mode->green_mask, + mode->blue_position,mode->blue_mask); + + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"res: %d * %d / banks: %d / attr: 0x%x", + mode->Xres, mode->Yres, mode->banks, mode->attributes); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"bpp: %d / physbase: 0x%x", + mode->bpp,mode->physbase); + + // vesa modes + // todo: take segment from vbeinfo! +#ifdef FOOLSOS_SHOW_VESAMODES + uint16_t *modeptr=info->VideoModePtr[0]; + + while(*modeptr!=0xffff&&*modeptr!=0) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mode supported : 0x%X", (*modeptr)); + modeptr++; + } +#endif + + + return VbeModeInfoBlock->physbase; +} + + +// TODO: what will happen in 24bit mode? +void PutPixel(int x,int y, int color) +{ + //do not write memory outside the screen buffer, check parameters against the VBE mode info + if (x<0 || x>VbeModeInfoBlock->Xres|| y<0 || y>VbeModeInfoBlock->Yres) return; + if (x) x = (x*(VbeModeInfoBlock->bpp>>3)); // get bytes (divide by 8) + if (y) y = (y*VbeModeInfoBlock->pitch); + uint8_t *cTemp=VbeModeInfoBlock->physbase; + + cTemp[x+y] = (uint8_t)(color & 0xff); + cTemp[x+y+1] = (uint8_t)((color>>8) & 0xff); + cTemp[x+y+2] = (uint8_t)((color>>16) & 0xff); +} + + +void PutFont(char c, int x,int y, int color) +{ + + int fnt=0x126-0x20; + + if(c>=0x20&&c<=0x126)fnt=c-0x20; + + int posx, posy, sizex=8, sizey=10; + + for(posx=x;posx=console_cols)PutConsoleNL(); + #endif +} + +void PutConsole(char *str, int color) +{ + + while((*str)!=0) + { + PutConsoleChar(*str,color); + str++; + } + +} +void PutConsoleNL() +{ + console_x=0; + console_y++; + if(console_y>=console_lines-5)console_y=0; + + for(int i=0;iXres-200,VbeModeInfoBlock->Yres-200,0xff); + vesa_put_rect(boxx-10,boxy-10,20,20,0x999999); + + boxx++; +// boxy+=boxx; + if(boxx>VbeModeInfoBlock->Xres-100)boxx=100; + // if(boxy>VbeModeInfoBlock->Yres-200)boxy=200; + + vesa_switch_buffers(); +} + +/* +void vesa_init_doublebuff() +{ + boxx=300; + boxy=300; + + int blocks=800*600*2/4096+1; + physbase=VbeModeInfoBlock->physbase; + buffer=pmmngr_alloc_blocks(blocks); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Init buffer of %d blocks at 0x%08X",blocks,buffer); + + VbeModeInfoBlock->physbase=buffer; +} +*/ diff --git a/driver/vesa.h b/driver/vesa.h new file mode 100644 index 0000000..f6e3eaf --- /dev/null +++ b/driver/vesa.h @@ -0,0 +1,47 @@ +#include + +typedef struct foolfont_struct +{ + uint8_t line[10]; //every single fool font consists of 10 lines a 8 bit + +}foolfont; + +typedef struct vbeinfo_struct{ + char VbeSignature[4]; // == "VESA" + uint16_t VbeVersion; // == 0x0300 for VBE 3.0 + uint16_t OemStringPtr[2]; // isa vbeFarPtr + uint8_t Capabilities[4]; + uint16_t VideoModePtr[2]; // isa vbeFarPtr + uint16_t TotalMemory; // as # of 64KB blocks +}vbeinfo; + +typedef struct ModeInfoBlock { + uint16_t attributes; + uint8_t winA,winB; + uint16_t granularity; + uint16_t winsize; + uint16_t segmentA, segmentB; + uint16_t realFctPtr[2]; +// VBE_FAR(realFctPtr); + uint16_t pitch; // bytes per scanline + + uint16_t Xres, Yres; + uint8_t Wchar, Ychar, planes, bpp, banks; + uint8_t memory_model, bank_size, image_pages; + uint8_t reserved0; + + uint8_t red_mask, red_position; + uint8_t green_mask, green_position; + uint8_t blue_mask, blue_position; + uint8_t rsv_mask, rsv_position; + uint8_t directcolor_attributes; + + volatile uint32_t physbase; // your LFB (Linear Framebuffer) address ;) + uint32_t reserved1; + uint16_t reserved2; +}vbemodeinfo; + +uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont); + +void PutConsoleChar(char c, int color); +void PutConsole(char *str, int color); diff --git a/kernel/kernel.c b/kernel/kernel.c index fcfb8d7..4ba76fa 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -53,6 +53,9 @@ void kernel_main(uint32_t eax,uint32_t ebx) // MULTIBOOT HEADER multiboot_information *info=get_multiboot(eax, ebx); + + // INIT VESA + vesa_init(info->vbe_control_info,info->vbe_mode_info,0); // Gather Info about other processors. (APs = application processors) // ACPI or MP smp_processors procdata; @@ -71,9 +74,9 @@ void kernel_main(uint32_t eax,uint32_t ebx) //TODO: !!! Check commented out sleep ()!!! smp_log_procdata(&procdata); smp_start_aps(&procdata,"/boot/mp.bin"); //will be copied over mbr - + // VIRTUAL MEMORY (paging) - pdirectory *dir=vmem_init(kernel_blocks); + pdirectory *dir=vmem_init(kernel_blocks,(uint32_t)info->framebuffer_addr); // PCI Bus pci_init(); diff --git a/kernel/multiboot.c b/kernel/multiboot.c index 3132717..0440b8e 100644 --- a/kernel/multiboot.c +++ b/kernel/multiboot.c @@ -1,5 +1,7 @@ +//https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-information-format #define FOOLOS_MODULE_NAME "multiboot" #include "multiboot.h" +#include "driver/vesa.h" #include "lib/logger/log.h" multiboot_information* get_multiboot(uint32_t eax, uint32_t ebx) @@ -9,22 +11,74 @@ multiboot_information* get_multiboot(uint32_t eax, uint32_t ebx) multiboot_information *info; info=ebx; + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"multiboot flags: 0x%08X",info->flags); + + if(info->flags&&1<<0) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[0] mem_lower: %d KB",info->mem_lower); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[0] mem_upper: %d KB",info->mem_upper); + } + + if(info->flags&&1<<1) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[1] boot-device 0x%08X",info->boot_device); + } + + if(info->flags&&1<<2) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[2] cmdline: \"%s\"",info->cmdline); + } + + if(info->flags&&1<<3) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[3] loaded modules count: %d",info->mods_count); + } + + if(info->flags&&1<<4) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[4/5] a.out kernel image symbols found"); + } + + if(info->flags&&1<<5) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[4/5] ELF table: %d entries (sized %d) at 0x%08X",info->syms[0],info->syms[1],info->syms[2]); + } + + if(info->flags&&1<<6) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[6] Found memory map"); + } + + if(info->flags&&1<<7) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[7] Found Drives map"); + } + + if(info->flags&&1<<8) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[8] ROM Configuration Table at: 0x%08X",info->config_table); + } + if(info->flags&&1<<9) { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Loaded by: \"%s\"",info->boot_loader_name); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[9] Loaded by: \"%s\"",info->boot_loader_name); } - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"multiboot flags: 0x%08X",info->flags); + if(info->flags&&1<<10) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[10] APM Table present."); + } - if(info->flags&&1<<0) + if(info->flags&&1<<11) { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mem_lower: %d KB",info->mem_lower); - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mem_upper: %d KB",info->mem_upper); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[11] VBE control info: 0x%08X",info->vbe_control_info); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[11] VBE mode info: 0x%08X",info->vbe_mode_info); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[11] VBE current mode (spec V3.0): 0x%08X",info->vbe_mode); } - if(info->flags&&1<<2) + if(info->flags&&1<<12) { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"cmdline: \"%s\"",info->cmdline); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"[12] Framebuffer (w:%d h:%d bpp:%d) at addr=0x%08X",info->framebuffer_width,info->framebuffer_height,info->framebuffer_bpp,info->framebuffer_addr); } return info; diff --git a/kernel/multiboot.h b/kernel/multiboot.h index bb31a2e..560bae4 100644 --- a/kernel/multiboot.h +++ b/kernel/multiboot.h @@ -16,7 +16,7 @@ typedef struct multiboot_information_struct uint32_t cmdline; uint32_t mods_count; uint32_t mods_addr; - uint32_t mods_syms[4]; + uint32_t syms[4]; uint32_t mmap_length; uint32_t mmap_addr; uint32_t drives_length; @@ -30,7 +30,13 @@ typedef struct multiboot_information_struct uint16_t vbe_interface_seg; uint16_t vbe_interface_off; uint16_t vbe_interface_len; - + uint64_t framebuffer_addr; + uint32_t framebuffer_pitch; + uint32_t framebuffer_width; + uint32_t framebuffer_height; + uint8_t framebuffer_bpp; + uint8_t framebuffer_type; + //color_info; }multiboot_information; diff --git a/kernel/syscalls.h b/kernel/syscalls.h index c8bc807..e88d8c3 100644 --- a/kernel/syscalls.h +++ b/kernel/syscalls.h @@ -20,3 +20,13 @@ #define SYSCALL_READDIR 63 #define SYSCALL_KILL 73 #define SYSCALL_POLL 80 + + +// new planned syscalls for graphx +// TODO: split ncurses and our syscalls?? + +// int syscall_create_win("title"); +// int syscall_kill_win(int descriptor); +// int syscall_update_win(int descriptor, *mem, *rect); +// int syscall_callback(*func, ON_MOUSE); +// int syscall_sleep(); diff --git a/kernel/vmem.c b/kernel/vmem.c index f49689f..3d3456b 100644 --- a/kernel/vmem.c +++ b/kernel/vmem.c @@ -10,6 +10,7 @@ #define FOOLOS_MODULE_NAME "vmem" static uint32_t kernel_pages; +static uint32_t fb_addr; // TODO : why is the frame not 0xfffff?? enum PAGE_PTE_FLAGS @@ -305,6 +306,57 @@ pdirectory* vmem_new_space_dir(pdirectory *copy_dir) virt_addr+=1024*4096; } + // FRAMEBUFFER IDENTITY MAP (4pages enought? ) + phys_addr=fb_addr; + virt_addr=fb_addr; + + for(int j=0;j<4;j++) + { + + // this is the table for our page directory. It maps 1024*4096 bytes + ptable* table; + + // create new tables on init + if(copy_dir==NULL) + { + // alloc space for our new table + table = (ptable*) kballoc(1); + if (!table)panic(FOOLOS_MODULE_NAME,"unable to alloc table"); + + //! idenitity mapping + for (int i=0, frame=phys_addr, virt=virt_addr; i<1024; i++, frame+=4096, virt+=4096) + { + //! create a new page + pt_entry page=0; + pt_entry_add_attrib (&page, I86_PTE_PRESENT); + pt_entry_add_attrib (&page, I86_PTE_WRITABLE); + pt_entry_add_attrib (&page, I86_PTE_USER); + pt_entry_set_frame (&page, frame); + + //! ...and add it to the page table + table->m_entries [PAGE_TABLE_INDEX (virt) ] = page; + } + + pd_entry* entry = &dir->m_entries [PAGE_DIRECTORY_INDEX (virt_addr) ]; + *entry=0; + pd_entry_add_attrib (entry, I86_PDE_PRESENT); + pd_entry_add_attrib (entry, I86_PDE_WRITABLE); + pt_entry_add_attrib (entry, I86_PTE_USER); + pd_entry_set_frame (entry, (physical_addr)table); + + } + + // otherwise simply take existing stuff from pdir 0 + else + { + dir->m_entries[PAGE_DIRECTORY_INDEX(virt_addr)]= + copy_dir->m_entries[PAGE_DIRECTORY_INDEX(virt_addr)]; + + } + + phys_addr+=1024*4096; + virt_addr+=1024*4096; + } // programm space virt_addr=0x8000000; @@ -442,8 +494,9 @@ void vmem_set_dir(pdirectory *dir) x86_set_pdbr(dir); } -pdirectory* vmem_init(uint32_t kernel_blocks) +pdirectory* vmem_init(uint32_t kernel_blocks, uint32_t frameb_addr) { + fb_addr=frameb_addr; kernel_pages=kernel_blocks/1024+1; return vmem_new_space_dir(NULL); } diff --git a/kernel/vmem.h b/kernel/vmem.h index d30c7cf..104e5ab 100644 --- a/kernel/vmem.h +++ b/kernel/vmem.h @@ -34,4 +34,4 @@ typedef struct pdirectory_struct { pd_entry m_entries[PAGES_PER_DIR]; }pdirectory; -pdirectory* vmem_init(uint32_t kernel_blocks); +pdirectory* vmem_init(uint32_t kernel_blocks,uint32_t fb_addr); diff --git a/userspace/fonts/Makefile b/userspace/fonts/Makefile new file mode 100644 index 0000000..2eeaf37 --- /dev/null +++ b/userspace/fonts/Makefile @@ -0,0 +1,5 @@ +############ fool-font ############ +binfont.bin: binfont.src + python3.2 binarize.py $< $@ +clean: + -rm binfont.bin diff --git a/userspace/fonts/binarize.py b/userspace/fonts/binarize.py new file mode 100644 index 0000000..1abb9d6 --- /dev/null +++ b/userspace/fonts/binarize.py @@ -0,0 +1,87 @@ +import sys + +def binarize(file_in, file_out): + + """ Create a binary file from an ASCII file. Everything + but '0' and '1' (alternatively '_' and 'X') is ignored + from the input file. """ + + print ("binarizing " + file_in + " to "+ file_out + ".") + + try: + + f=open(file_in,'r') + + try: + + o=open(file_out,'wb') + + try: + + while True: + + b=readnext(f) + if b==-1: + break + + o.write(bytes([b])) + + except IOError: + print("IOError happened during processing."); + print("I am closing the input and ouput files and aborting."); + print("Warning: The output file is very likely incomplete."); + + o.close() + + except IOError: + print("IOError opening output file: " + file_out); + + f.close() + + except IOError: + print("IOError opening input file: " + file_in); + + +def readnext(f): + + """ Read next 'byte' from the given ASCII file (BufferedWriter) + everything but '_','X','0','1' is ignored. + Returns the byte as integer or -1 on EOF """ + + l=0 + b="" + + while l<8: + + c=f.read(1) + + if not c: + return -1 + + if c=="0" or c=='_': + l+=1 + b+="0" + + if c=="1" or c=='X': + l+=1 + b+="1" + + return int(b,2) + +def usage(): + + """ Prints usage information to sdtout """ + + print ("python3.x binarize.py [file_in] [file_out]") + + + +""" direct use """ + +if __name__ == "__main__": + + if(len(sys.argv)==3): + binarize(sys.argv[1],sys.argv[2]) + else: + usage() + diff --git a/userspace/fonts/binfont.src b/userspace/fonts/binfont.src new file mode 100644 index 0000000..c1d9ccc --- /dev/null +++ b/userspace/fonts/binfont.src @@ -0,0 +1,1235 @@ + +// space (ox2o) + +________ +________ +________ +________ +________ +________ +________ +________ +________ +________ + +// ! + +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +________ +________ +___XX___ +___XX___ + +// " + +_XX__XX_ +_XX__XX_ +_XX__XX_ +________ +________ +________ +________ +________ +________ +________ + +// # + +________ +__X__X__ +__X__X__ +XXXXXXXX +__X__X__ +__X__X__ +__X__X__ +XXXXXXXX +__X__X__ +__X__X__ + +// $ + +________ +___X____ +_XXXXXX_ +XX_X__XX +_XXX____ +__XXXX__ +___X_XX_ +XX_X__XX +_XXXXXX_ +___X____ + +// % + +______XX +_X___XX_ +X_X_XX__ +_X__XX__ +___XX___ +___XX___ +__XX__X_ +__XX_X_X +_XX___X_ +XX______ + +// & + +__X_____ +_X_X____ +X___X___ +_X_X____ +__XX____ +_X_X____ +X___X_X_ +X____X__ +X___X_X_ +_XXX___X + +// ' + +___XX___ +___XX___ +___XX___ +________ +________ +________ +________ +________ +________ +________ + +// ( + +___X____ +__X_____ +_X______ +_X______ +X_______ +X_______ +_X______ +_X______ +__X_____ +___X____ + +// ) + +___X____ +_____X__ +______X_ +______X_ +_______X +_______X +______X_ +______X_ +_____X__ +___X____ + +// * + +________ +________ +X__X__X_ +_X_X_X__ +__XXX___ +XXXXXXX_ +__XXX___ +_X_X_X__ +X__X__X_ +________ + +// + + +________ +________ +___XX___ +___XX___ +XXXXXXXX +XXXXXXXX +___XX___ +___XX___ +________ +________ + +// , + +________ +________ +________ +________ +________ +________ +________ +___XX___ +___XX___ +__XX____ + +// - + +________ +________ +________ +________ +_XXXXXX_ +_XXXXXX_ +________ +________ +________ +________ + +// . + +________ +________ +________ +________ +________ +________ +________ +________ +___XX___ +___XX___ + +// / +______XX +_____XX_ +____XX__ +____XX__ +___XX___ +___XX___ +__XX____ +__XX____ +_XX_____ +XX______ + +// zero + +_XXXXXX_ +XXXXXXXX +XX___XXX +XX__X_XX +XX__X_XX +XX_X__XX +XX_X__XX +XXX___XX +XXXXXXXX +_XXXXXX_ + +// one + +___XX___ +__XXX___ +__XXX___ +_XXXX___ +XX_XX___ +___XX___ +___XX___ +___XX___ +___XX___ +_XXXXXX_ + +// 2 + +_XXXXXX_ +XXXXXXXX +_____XXX +_____XXX +____XXX_ +___XXX__ +_XXX____ +XXX_____ +XXXXXXXX +XXXXXXXX + +// 3 + +XXXXXXXX +XXXXXXXX +_____XXX +____XX__ +___XX___ +__XXX___ +____XXX_ +XX___XXX +XXXXXXXX +_XXXXXX_ + +// 4 + +___XX___ +__XXX___ +__XXX___ +_XXXX___ +XX_XX___ +XXXXXXXX +XXXXXXXX +___XX___ +___XX___ +___XX___ + +// 5 + +XXXXXXXX +XXXXXXXX +XXX_____ +XXX_____ +XXXXXXX_ +_XXXXXXX +______XX +X_____XX +XXXXXXXX +_XXXXXX_ + +// 6 + +_XXXXXX_ +XXXXXXXX +XX______ +XX______ +XXXXXXX_ +XXXXXXX_ +XX____XX +XX____XX +XXXXXXXX +_XXXXXX_ + +// 7 + +XXXXXXXX +XXXXXXXX +_____XXX +____XXX_ +____XXX_ +___XXX__ +___XXX__ +__XXX___ +__XXX___ +_XXX____ + +// 8 + +_XXXXXX_ +XXXXXXXX +XX____XX +XX____XX +_XXXXXX_ +_XXXXXX_ +XX____XX +XX____XX +XXXXXXXX +_XXXXXX_ + +// 9 + +_XXXXXX_ +XXXXXXXX +XX____XX +XX____XX +_XXXXXXX +_XXXXXXX +______XX +______XX +XXXXXXXX +_XXXXXX_ + + +// : + +________ +________ +________ +________ +___XX___ +___XX___ +________ +___XX___ +___XX___ +________ + + +// ; + +________ +________ +________ +________ +___XX___ +___XX___ +________ +___XX___ +___XX___ +__XX____ + +// < + +________ +________ +______XX +____XX__ +__XX____ +XX______ +__XX____ +____XX__ +______XX +________ + +// = + +________ +________ +________ +________ +XXXXXXXX +________ +XXXXXXXX +________ +________ +________ + + +// > + +________ +________ +XX______ +__XX____ +____XX__ +______XX +____XX__ +__XX____ +XX______ +________ + +// ? + + +_XXXXXX_ +XXXXXXXX +XX____XX +_X___XX_ +____XX__ +___XX___ +___XX___ +________ +___XX___ +___XX___ + +// @ + +_XXXXXX_ +XXXXXXXX +XX____XX +XX_XXXXX +XX_X__XX +XX_X__XX +XX_XXXXX +XX______ +XXXXXXXX +_XXXXXXX + + +// A + +XXXXXXXX +XXXXXXXX +XX____XX +XX____XX +XXXXXXXX +XXXXXXXX +XX____XX +XX____XX +XX____XX +XX____XX + +// B + +XXXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XXXXXXX_ +XXXXXXX_ +XX____XX +XX____XX +XXXXXXXX +XXXXXXX_ + +// C + +XXXXXXXX +XXXXXXXX +XX______ +XX______ +XX______ +XX______ +XX______ +XX______ +XXXXXXXX +XXXXXXXX + +// D + +XXXXXX__ +XXXXXXX_ +XX___XXX +XX____XX +XX____XX +XX____XX +XX____XX +XX___XXX +XXXXXXX_ +XXXXXX__ + +// E + +XXXXXXXX +XXXXXXXX +XX______ +XX______ +XXXXXXX_ +XXXXXXX_ +XX______ +XX______ +XXXXXXXX +XXXXXXXX + +// F + +XXXXXXXX +XXXXXXXX +XX______ +XX______ +XXXXXXX_ +XXXXXXX_ +XX______ +XX______ +XX______ +XX______ + +// G + +XXXXXXXX +XXXXXXXX +XX______ +XX______ +XX__XXXX +XX__XXXX +XX____XX +XX____XX +XXXXXXXX +XXXXXXXX + +// H + +XX____XX +XX____XX +XX____XX +XX____XX +XXXXXXXX +XXXXXXXX +XX____XX +XX____XX +XX____XX +XX____XX + +// I + +_XXXXXX_ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +_XXXXXX_ + +// J + +XXXXXXXX +XXXXXXXX +______XX +______XX +______XX +______XX +XX____XX +XXX___XX +_XXXXXXX +__XXXXXX + +// K + +XX____XX +XX__XXX_ +XX__XXX_ +XX_XXX__ +XXXX____ +XXXX____ +XX_XXX__ +XX__XXX_ +XX__XXX_ +XX____XX + +// L + +XX______ +XX______ +XX______ +XX______ +XX______ +XX______ +XX______ +XX______ +XXXXXXXX +XXXXXXXX + +// M + +XX____XX +XXX__XXX +XXX_XXXX +XXXXXXXX +XXXXXXXX +XX_XX_XX +XX_XX_XX +XX____XX +XX____XX +XX____XX + +// N + +XX____XX +XXX___XX +XXX___XX +XXXX__XX +XXXXX_XX +XX_XXXXX +XX__XXXX +XX___XXX +XX___XXX +XX____XX + +// O + +_XXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XX____XX +XX____XX +XX____XX +XX____XX +XXXXXXXX +_XXXXXX_ + +// P + +XXXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XXXXXXXX +XXXXXXX_ +XX______ +XX______ +XX______ +XX______ + +// Q + +_XXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XX____XX +XX_XX_XX +XX_XXXXX +XX__XXXX +XXXXXXXX +_XXXXXXX + +// R + +XXXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XXXXXXXX +XXXXXXX_ +XXXXX___ +XX_XXX__ +XX__XXX_ +XX___XXX + +// S + +_XXXXXX_ +XXXXXXXX +XX____XX +_XX___X_ +__XX____ +___XXX__ +_X__XXX_ +XX___XXX +XXXXXXXX +_XXXXXX_ + +// T + +XXXXXXXX +XXXXXXXX +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ + +// U + +XX____XX +XX____XX +XX____XX +XX____XX +XX____XX +XX____XX +XX____XX +XX____XX +XXXXXXXX +_XXXXXX_ + +// V + +XX____XX +XX____XX +XX____XX +_XX__XX_ +_XX__XX_ +_XX__XX_ +__XXXX__ +__XXXX__ +___XX___ +___XX___ + +// W + +XX____XX +XX____XX +XX_XX_XX +XX_XX_XX +XXXXXXXX +XXXXXXXX +XXX__XXX +XXX__XXX +XX____XX +XX____XX + +// x big + +XX____XX +XX____XX +_XX__XX_ +_XX__XX_ +__XXXX__ +__XXXX__ +_XX__XX_ +_XX__XX_ +XX____XX +XX____XX + +// Y + +XX____XX +XX____XX +_XX__XX_ +_XX__XX_ +__XXXX__ +__XXXX__ +___XX___ +___XX___ +___XX___ +___XX___ + +// Z + +XXXXXXXX +XXXXXXXX +_____XXX +_____XXX +____XXX_ +___XXX__ +_XXX____ +XXX_____ +XXXXXXXX +XXXXXXXX + +// [ + +XXXX____ +XXXX____ +XX______ +XX______ +XX______ +XX______ +XX______ +XX______ +XXXX____ +XXXX____ +// \ + +XX______ +_XX_____ +__XX____ +__XX____ +___XX___ +___XX___ +____XX__ +____XX__ +_____XX_ +______XX + +// ] + +____XXXX +____XXXX +______XX +______XX +______XX +______XX +______XX +______XX +____XXXX +____XXXX +// ^ + +___XX___ +__XXXX__ +_XX__XX_ +XX____XX +________ +________ +________ +________ +________ +________ + +// underscore + +________ +________ +________ +________ +________ +________ +________ +________ +XXXXXXXX +XXXXXXXX + +// ` + +__XX____ +___XX___ +____XX__ +________ +________ +________ +________ +________ +________ +________ + +// a +________ +________ +_XXXXXX_ +XXXXXXXX +______XX +_XXXXXXX +XXXXXXXX +XX____XX +XXXXXXXX +_XXXX_XX + +// b + +XX______ +XX______ +XX______ +XX______ +XXXXXXX_ +XXXXXXX_ +XX____XX +XX____XX +XXXXXXX_ +XXXXXXX_ + +// c + +________ +________ +________ +_XXXXXX_ +XXXXXXXX +XX______ +XX______ +XX______ +XXXXXXXX +_XXXXXX_ + +// d + +______XX +______XX +______XX +______XX +_XXXXXXX +_XXXXXXX +XX____XX +XX____XX +_XXXXXXX +_XXXXXXX + +// e + +________ +________ +_XXXXXX_ +XXXXXXXX +XX_____X +XXXXXXX_ +XX______ +XX______ +XXXXXXXX +_XXXXXX_ + +// f + +_XXXXXX_ +XXXXXXXX +XX______ +XX______ +XXXXXXX_ +XXXXXXX_ +XX______ +XX______ +XX______ +XX______ + +// g + +________ +________ +_XXXXXXX +_XXXXXXX +XX____XX +XX____XX +_XXXXXXX +______XX +XX____XX +_XXXXXXX + +// h + +XX______ +XX______ +XX______ +XX______ +XXXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XX____XX +XX____XX + + +// i + +________ +________ +________ +___XX___ +________ +___XX___ +___XX___ +___XX___ +___XX___ +__XXXX__ + + +// j + +________ +________ +____XX__ +________ +____XX__ +____XX__ +____XX__ +_XX_XX__ +_XX_XX__ +__XXX___ + +// k + + +XX______ +XX______ +XX______ +XX______ +XX____XX +XX__XXX_ +XXXXXX__ +XX_XXX__ +XX__XXX_ +XX___XXX + +// l + + +_XXXX___ +_XXXX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +_XXXXXX_ + + +// m +________ +________ +________ +XX______ +XXXX_XX_ +XXXXXXXX +XX_XX_XX +XX_XX_XX +XX_XX_XX +XX_XX_XX + +// n +________ +________ +________ +XX______ +XXXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XX____XX +XX____XX + +// o +________ +________ +________ +_XXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XX____XX +XXXXXXXX +_XXXXXX_ + +// p +________ +________ +_XXXXXX_ +XXXXXXXX +XX____XX +XX____XX +XXXXXXX_ +XX______ +XX______ +XX______ + +// q + +________ +________ +_XXXXXX_ +XXXXXXXX +XX____XX +XX____XX +_XXXXXXX +______XX +______XX +______XX + +// r +________ +________ +________ +XX__XX__ +XX_XXXX_ +XXXX__XX +XX______ +XX______ +XX______ +XX______ + +// s + +________ +________ +________ +_XXXXXX_ +XX____XX +_XX_____ +__XXXX__ +_____XX_ +XX____XX +_XXXXXX_ + +// t + +__XX____ +__XX____ +XXXXXX__ +XXXXXX__ +__XX____ +__XX____ +__XX____ +__XX__X_ +__XX_XX_ +___XXX__ + +// u +________ +________ +________ +________ +XX____XX +XX____XX +XX____XX +XX____XX +XX____XX +_XXXXXX_ + +// v +________ +________ +________ +________ +XX____XX +XX____XX +_XX__XX_ +_XX__XX_ +__XXXX__ +___XX___ + +// w +________ +________ +________ +________ +XX_XX_XX +XX_XX_XX +XX_XX_XX +XX_XX_XX +XXXXXXXX +_XX__XX_ + + +// x + +________ +________ +________ +XX____XX +_XX__XX_ +_XX__XX_ +__XXXX__ +_XX__XX_ +_XX__XX_ +XX____XX + + +// y + +________ +________ +________ +XX____XX +_XX__XX_ +_XX__XX_ +__XXXX__ +___XX___ +__XX____ +_XX_____ + + +// z +________ +________ +________ +________ +XXXXXXXX +_____XX_ +____XX__ +__XXX___ +_XX_____ +XXXXXXXX + +// { + +____XX__ +___X____ +__X_____ +__X_____ +XX______ +XX______ +__X_____ +__X_____ +___X____ +____XX__ + +// | + +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ +___XX___ + +// } + +__XX____ +____X___ +_____X__ +_____X__ +______XX +______XX +_____X__ +_____X__ +____X___ +__XX____ + +// ~ + +________ +________ +________ +_XX_____ +X__XX__X +_____XX_ +________ +________ +________ +________ diff --git a/userspace/foolshell.c b/userspace/foolshell.c index 7247871..47d1e92 100644 --- a/userspace/foolshell.c +++ b/userspace/foolshell.c @@ -14,8 +14,6 @@ uint8_t buf_test[1024*300]; void hello() { // ascci art: http://patorjk.com/software/taag/#p=testall&f=Cards&t=Fool%20OS - // - puts( "\033c" @@ -73,6 +71,13 @@ int main(int argc, char **argv) printf("setvbuf returned %i\n",setvbuf(stdin,NULL,_IONBF,0)); + // TODO: remove test (Tryint to write directyly to frameubuff) + uint32_t *vmem=0xfd000000; + for(int i=0;i<2000;i++) + { + *vmem=0xff0000; + vmem++; + } while(1) { prompt(); @@ -88,6 +93,11 @@ int main(int argc, char **argv) buf[bl]=c; buf[bl+1]='\0'; bl++; + for(int i=0;i<20000;i++) + { + *vmem=0xff0000; + vmem++; + } } //fgets(buf,255,stdin); @@ -100,7 +110,6 @@ int main(int argc, char **argv) char **tokenize(char *buf) { - char **token; token=malloc(10*sizeof(char*)); @@ -134,9 +143,7 @@ char **tokenize(char *buf) token[c]=NULL; } - return token; - } int process(char *buf) @@ -194,9 +201,7 @@ int process(char *buf) token[t-1]=0; // printf("path token: '%s'\n",token); - - if(!strcmp(token,"..")) { left--; @@ -275,8 +280,3 @@ int process(char *buf) return 0; } - - - - - diff --git a/xxx/font/Makefile b/xxx/font/Makefile deleted file mode 100644 index 2eeaf37..0000000 --- a/xxx/font/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -############ fool-font ############ -binfont.bin: binfont.src - python3.2 binarize.py $< $@ -clean: - -rm binfont.bin diff --git a/xxx/font/binarize.py b/xxx/font/binarize.py deleted file mode 100644 index 1abb9d6..0000000 --- a/xxx/font/binarize.py +++ /dev/null @@ -1,87 +0,0 @@ -import sys - -def binarize(file_in, file_out): - - """ Create a binary file from an ASCII file. Everything - but '0' and '1' (alternatively '_' and 'X') is ignored - from the input file. """ - - print ("binarizing " + file_in + " to "+ file_out + ".") - - try: - - f=open(file_in,'r') - - try: - - o=open(file_out,'wb') - - try: - - while True: - - b=readnext(f) - if b==-1: - break - - o.write(bytes([b])) - - except IOError: - print("IOError happened during processing."); - print("I am closing the input and ouput files and aborting."); - print("Warning: The output file is very likely incomplete."); - - o.close() - - except IOError: - print("IOError opening output file: " + file_out); - - f.close() - - except IOError: - print("IOError opening input file: " + file_in); - - -def readnext(f): - - """ Read next 'byte' from the given ASCII file (BufferedWriter) - everything but '_','X','0','1' is ignored. - Returns the byte as integer or -1 on EOF """ - - l=0 - b="" - - while l<8: - - c=f.read(1) - - if not c: - return -1 - - if c=="0" or c=='_': - l+=1 - b+="0" - - if c=="1" or c=='X': - l+=1 - b+="1" - - return int(b,2) - -def usage(): - - """ Prints usage information to sdtout """ - - print ("python3.x binarize.py [file_in] [file_out]") - - - -""" direct use """ - -if __name__ == "__main__": - - if(len(sys.argv)==3): - binarize(sys.argv[1],sys.argv[2]) - else: - usage() - diff --git a/xxx/font/binfont.src b/xxx/font/binfont.src deleted file mode 100644 index c1d9ccc..0000000 --- a/xxx/font/binfont.src +++ /dev/null @@ -1,1235 +0,0 @@ - -// space (ox2o) - -________ -________ -________ -________ -________ -________ -________ -________ -________ -________ - -// ! - -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -________ -________ -___XX___ -___XX___ - -// " - -_XX__XX_ -_XX__XX_ -_XX__XX_ -________ -________ -________ -________ -________ -________ -________ - -// # - -________ -__X__X__ -__X__X__ -XXXXXXXX -__X__X__ -__X__X__ -__X__X__ -XXXXXXXX -__X__X__ -__X__X__ - -// $ - -________ -___X____ -_XXXXXX_ -XX_X__XX -_XXX____ -__XXXX__ -___X_XX_ -XX_X__XX -_XXXXXX_ -___X____ - -// % - -______XX -_X___XX_ -X_X_XX__ -_X__XX__ -___XX___ -___XX___ -__XX__X_ -__XX_X_X -_XX___X_ -XX______ - -// & - -__X_____ -_X_X____ -X___X___ -_X_X____ -__XX____ -_X_X____ -X___X_X_ -X____X__ -X___X_X_ -_XXX___X - -// ' - -___XX___ -___XX___ -___XX___ -________ -________ -________ -________ -________ -________ -________ - -// ( - -___X____ -__X_____ -_X______ -_X______ -X_______ -X_______ -_X______ -_X______ -__X_____ -___X____ - -// ) - -___X____ -_____X__ -______X_ -______X_ -_______X -_______X -______X_ -______X_ -_____X__ -___X____ - -// * - -________ -________ -X__X__X_ -_X_X_X__ -__XXX___ -XXXXXXX_ -__XXX___ -_X_X_X__ -X__X__X_ -________ - -// + - -________ -________ -___XX___ -___XX___ -XXXXXXXX -XXXXXXXX -___XX___ -___XX___ -________ -________ - -// , - -________ -________ -________ -________ -________ -________ -________ -___XX___ -___XX___ -__XX____ - -// - - -________ -________ -________ -________ -_XXXXXX_ -_XXXXXX_ -________ -________ -________ -________ - -// . - -________ -________ -________ -________ -________ -________ -________ -________ -___XX___ -___XX___ - -// / -______XX -_____XX_ -____XX__ -____XX__ -___XX___ -___XX___ -__XX____ -__XX____ -_XX_____ -XX______ - -// zero - -_XXXXXX_ -XXXXXXXX -XX___XXX -XX__X_XX -XX__X_XX -XX_X__XX -XX_X__XX -XXX___XX -XXXXXXXX -_XXXXXX_ - -// one - -___XX___ -__XXX___ -__XXX___ -_XXXX___ -XX_XX___ -___XX___ -___XX___ -___XX___ -___XX___ -_XXXXXX_ - -// 2 - -_XXXXXX_ -XXXXXXXX -_____XXX -_____XXX -____XXX_ -___XXX__ -_XXX____ -XXX_____ -XXXXXXXX -XXXXXXXX - -// 3 - -XXXXXXXX -XXXXXXXX -_____XXX -____XX__ -___XX___ -__XXX___ -____XXX_ -XX___XXX -XXXXXXXX -_XXXXXX_ - -// 4 - -___XX___ -__XXX___ -__XXX___ -_XXXX___ -XX_XX___ -XXXXXXXX -XXXXXXXX -___XX___ -___XX___ -___XX___ - -// 5 - -XXXXXXXX -XXXXXXXX -XXX_____ -XXX_____ -XXXXXXX_ -_XXXXXXX -______XX -X_____XX -XXXXXXXX -_XXXXXX_ - -// 6 - -_XXXXXX_ -XXXXXXXX -XX______ -XX______ -XXXXXXX_ -XXXXXXX_ -XX____XX -XX____XX -XXXXXXXX -_XXXXXX_ - -// 7 - -XXXXXXXX -XXXXXXXX -_____XXX -____XXX_ -____XXX_ -___XXX__ -___XXX__ -__XXX___ -__XXX___ -_XXX____ - -// 8 - -_XXXXXX_ -XXXXXXXX -XX____XX -XX____XX -_XXXXXX_ -_XXXXXX_ -XX____XX -XX____XX -XXXXXXXX -_XXXXXX_ - -// 9 - -_XXXXXX_ -XXXXXXXX -XX____XX -XX____XX -_XXXXXXX -_XXXXXXX -______XX -______XX -XXXXXXXX -_XXXXXX_ - - -// : - -________ -________ -________ -________ -___XX___ -___XX___ -________ -___XX___ -___XX___ -________ - - -// ; - -________ -________ -________ -________ -___XX___ -___XX___ -________ -___XX___ -___XX___ -__XX____ - -// < - -________ -________ -______XX -____XX__ -__XX____ -XX______ -__XX____ -____XX__ -______XX -________ - -// = - -________ -________ -________ -________ -XXXXXXXX -________ -XXXXXXXX -________ -________ -________ - - -// > - -________ -________ -XX______ -__XX____ -____XX__ -______XX -____XX__ -__XX____ -XX______ -________ - -// ? - - -_XXXXXX_ -XXXXXXXX -XX____XX -_X___XX_ -____XX__ -___XX___ -___XX___ -________ -___XX___ -___XX___ - -// @ - -_XXXXXX_ -XXXXXXXX -XX____XX -XX_XXXXX -XX_X__XX -XX_X__XX -XX_XXXXX -XX______ -XXXXXXXX -_XXXXXXX - - -// A - -XXXXXXXX -XXXXXXXX -XX____XX -XX____XX -XXXXXXXX -XXXXXXXX -XX____XX -XX____XX -XX____XX -XX____XX - -// B - -XXXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XXXXXXX_ -XXXXXXX_ -XX____XX -XX____XX -XXXXXXXX -XXXXXXX_ - -// C - -XXXXXXXX -XXXXXXXX -XX______ -XX______ -XX______ -XX______ -XX______ -XX______ -XXXXXXXX -XXXXXXXX - -// D - -XXXXXX__ -XXXXXXX_ -XX___XXX -XX____XX -XX____XX -XX____XX -XX____XX -XX___XXX -XXXXXXX_ -XXXXXX__ - -// E - -XXXXXXXX -XXXXXXXX -XX______ -XX______ -XXXXXXX_ -XXXXXXX_ -XX______ -XX______ -XXXXXXXX -XXXXXXXX - -// F - -XXXXXXXX -XXXXXXXX -XX______ -XX______ -XXXXXXX_ -XXXXXXX_ -XX______ -XX______ -XX______ -XX______ - -// G - -XXXXXXXX -XXXXXXXX -XX______ -XX______ -XX__XXXX -XX__XXXX -XX____XX -XX____XX -XXXXXXXX -XXXXXXXX - -// H - -XX____XX -XX____XX -XX____XX -XX____XX -XXXXXXXX -XXXXXXXX -XX____XX -XX____XX -XX____XX -XX____XX - -// I - -_XXXXXX_ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -_XXXXXX_ - -// J - -XXXXXXXX -XXXXXXXX -______XX -______XX -______XX -______XX -XX____XX -XXX___XX -_XXXXXXX -__XXXXXX - -// K - -XX____XX -XX__XXX_ -XX__XXX_ -XX_XXX__ -XXXX____ -XXXX____ -XX_XXX__ -XX__XXX_ -XX__XXX_ -XX____XX - -// L - -XX______ -XX______ -XX______ -XX______ -XX______ -XX______ -XX______ -XX______ -XXXXXXXX -XXXXXXXX - -// M - -XX____XX -XXX__XXX -XXX_XXXX -XXXXXXXX -XXXXXXXX -XX_XX_XX -XX_XX_XX -XX____XX -XX____XX -XX____XX - -// N - -XX____XX -XXX___XX -XXX___XX -XXXX__XX -XXXXX_XX -XX_XXXXX -XX__XXXX -XX___XXX -XX___XXX -XX____XX - -// O - -_XXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XX____XX -XX____XX -XX____XX -XX____XX -XXXXXXXX -_XXXXXX_ - -// P - -XXXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XXXXXXXX -XXXXXXX_ -XX______ -XX______ -XX______ -XX______ - -// Q - -_XXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XX____XX -XX_XX_XX -XX_XXXXX -XX__XXXX -XXXXXXXX -_XXXXXXX - -// R - -XXXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XXXXXXXX -XXXXXXX_ -XXXXX___ -XX_XXX__ -XX__XXX_ -XX___XXX - -// S - -_XXXXXX_ -XXXXXXXX -XX____XX -_XX___X_ -__XX____ -___XXX__ -_X__XXX_ -XX___XXX -XXXXXXXX -_XXXXXX_ - -// T - -XXXXXXXX -XXXXXXXX -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ - -// U - -XX____XX -XX____XX -XX____XX -XX____XX -XX____XX -XX____XX -XX____XX -XX____XX -XXXXXXXX -_XXXXXX_ - -// V - -XX____XX -XX____XX -XX____XX -_XX__XX_ -_XX__XX_ -_XX__XX_ -__XXXX__ -__XXXX__ -___XX___ -___XX___ - -// W - -XX____XX -XX____XX -XX_XX_XX -XX_XX_XX -XXXXXXXX -XXXXXXXX -XXX__XXX -XXX__XXX -XX____XX -XX____XX - -// x big - -XX____XX -XX____XX -_XX__XX_ -_XX__XX_ -__XXXX__ -__XXXX__ -_XX__XX_ -_XX__XX_ -XX____XX -XX____XX - -// Y - -XX____XX -XX____XX -_XX__XX_ -_XX__XX_ -__XXXX__ -__XXXX__ -___XX___ -___XX___ -___XX___ -___XX___ - -// Z - -XXXXXXXX -XXXXXXXX -_____XXX -_____XXX -____XXX_ -___XXX__ -_XXX____ -XXX_____ -XXXXXXXX -XXXXXXXX - -// [ - -XXXX____ -XXXX____ -XX______ -XX______ -XX______ -XX______ -XX______ -XX______ -XXXX____ -XXXX____ -// \ - -XX______ -_XX_____ -__XX____ -__XX____ -___XX___ -___XX___ -____XX__ -____XX__ -_____XX_ -______XX - -// ] - -____XXXX -____XXXX -______XX -______XX -______XX -______XX -______XX -______XX -____XXXX -____XXXX -// ^ - -___XX___ -__XXXX__ -_XX__XX_ -XX____XX -________ -________ -________ -________ -________ -________ - -// underscore - -________ -________ -________ -________ -________ -________ -________ -________ -XXXXXXXX -XXXXXXXX - -// ` - -__XX____ -___XX___ -____XX__ -________ -________ -________ -________ -________ -________ -________ - -// a -________ -________ -_XXXXXX_ -XXXXXXXX -______XX -_XXXXXXX -XXXXXXXX -XX____XX -XXXXXXXX -_XXXX_XX - -// b - -XX______ -XX______ -XX______ -XX______ -XXXXXXX_ -XXXXXXX_ -XX____XX -XX____XX -XXXXXXX_ -XXXXXXX_ - -// c - -________ -________ -________ -_XXXXXX_ -XXXXXXXX -XX______ -XX______ -XX______ -XXXXXXXX -_XXXXXX_ - -// d - -______XX -______XX -______XX -______XX -_XXXXXXX -_XXXXXXX -XX____XX -XX____XX -_XXXXXXX -_XXXXXXX - -// e - -________ -________ -_XXXXXX_ -XXXXXXXX -XX_____X -XXXXXXX_ -XX______ -XX______ -XXXXXXXX -_XXXXXX_ - -// f - -_XXXXXX_ -XXXXXXXX -XX______ -XX______ -XXXXXXX_ -XXXXXXX_ -XX______ -XX______ -XX______ -XX______ - -// g - -________ -________ -_XXXXXXX -_XXXXXXX -XX____XX -XX____XX -_XXXXXXX -______XX -XX____XX -_XXXXXXX - -// h - -XX______ -XX______ -XX______ -XX______ -XXXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XX____XX -XX____XX - - -// i - -________ -________ -________ -___XX___ -________ -___XX___ -___XX___ -___XX___ -___XX___ -__XXXX__ - - -// j - -________ -________ -____XX__ -________ -____XX__ -____XX__ -____XX__ -_XX_XX__ -_XX_XX__ -__XXX___ - -// k - - -XX______ -XX______ -XX______ -XX______ -XX____XX -XX__XXX_ -XXXXXX__ -XX_XXX__ -XX__XXX_ -XX___XXX - -// l - - -_XXXX___ -_XXXX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -_XXXXXX_ - - -// m -________ -________ -________ -XX______ -XXXX_XX_ -XXXXXXXX -XX_XX_XX -XX_XX_XX -XX_XX_XX -XX_XX_XX - -// n -________ -________ -________ -XX______ -XXXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XX____XX -XX____XX - -// o -________ -________ -________ -_XXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XX____XX -XXXXXXXX -_XXXXXX_ - -// p -________ -________ -_XXXXXX_ -XXXXXXXX -XX____XX -XX____XX -XXXXXXX_ -XX______ -XX______ -XX______ - -// q - -________ -________ -_XXXXXX_ -XXXXXXXX -XX____XX -XX____XX -_XXXXXXX -______XX -______XX -______XX - -// r -________ -________ -________ -XX__XX__ -XX_XXXX_ -XXXX__XX -XX______ -XX______ -XX______ -XX______ - -// s - -________ -________ -________ -_XXXXXX_ -XX____XX -_XX_____ -__XXXX__ -_____XX_ -XX____XX -_XXXXXX_ - -// t - -__XX____ -__XX____ -XXXXXX__ -XXXXXX__ -__XX____ -__XX____ -__XX____ -__XX__X_ -__XX_XX_ -___XXX__ - -// u -________ -________ -________ -________ -XX____XX -XX____XX -XX____XX -XX____XX -XX____XX -_XXXXXX_ - -// v -________ -________ -________ -________ -XX____XX -XX____XX -_XX__XX_ -_XX__XX_ -__XXXX__ -___XX___ - -// w -________ -________ -________ -________ -XX_XX_XX -XX_XX_XX -XX_XX_XX -XX_XX_XX -XXXXXXXX -_XX__XX_ - - -// x - -________ -________ -________ -XX____XX -_XX__XX_ -_XX__XX_ -__XXXX__ -_XX__XX_ -_XX__XX_ -XX____XX - - -// y - -________ -________ -________ -XX____XX -_XX__XX_ -_XX__XX_ -__XXXX__ -___XX___ -__XX____ -_XX_____ - - -// z -________ -________ -________ -________ -XXXXXXXX -_____XX_ -____XX__ -__XXX___ -_XX_____ -XXXXXXXX - -// { - -____XX__ -___X____ -__X_____ -__X_____ -XX______ -XX______ -__X_____ -__X_____ -___X____ -____XX__ - -// | - -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ -___XX___ - -// } - -__XX____ -____X___ -_____X__ -_____X__ -______XX -______XX -_____X__ -_____X__ -____X___ -__XX____ - -// ~ - -________ -________ -________ -_XX_____ -X__XX__X -_____XX_ -________ -________ -________ -________ diff --git a/xxx/video/vesa.c b/xxx/video/vesa.c deleted file mode 100644 index b43ca50..0000000 --- a/xxx/video/vesa.c +++ /dev/null @@ -1,245 +0,0 @@ -//http://wiki.osdev.org/GUI - -#include -#include "kernel/mem.h" -#include "vesa.h" - -#include "lib/logger/log.h" // logger facilities -#include "lib/printf/printf.h" -#define FOOLOS_MODULE_NAME "vesa" - -#define FOOLSOS_SHOW_VESAMODES - -static foolfont *deffont; -static vbemodeinfo *VbeModeInfoBlock; - -static int console_x; -static int console_y; - -static int console_lines; -static int console_cols; - -static uint8_t* buffer; -static uint8_t* physbase; - -void PutConsoleNL(); -void PutPixel(int x,int y, int color); - -void vesa_switch_buffers() -{ - for(int i=0;i<800*600*2;i++)physbase[i]=buffer[i]; - -} - -void vesa_put_rect(int x, int y, int w , int h, int color) -{ - for(int i=x;iXres, VbeModeInfoBlock->Yres, 0xffffff); -} - - -void vesa_set_physbase(uint32_t addr) -{ - VbeModeInfoBlock->physbase=addr; -} - - // - // We want to get output to the screen as fast as possible! - // - // Our Fool-Boot-Loader did set up VESA already for us. - // The desired VESA mode is hardcoded in [boot/mbr.asm]. - // - // The [vesa_init(...)] function requires: - // - // * the addresses of the vbeinfo struct - // * the address of the vbemodeinfo struct (for selected mode). - // * Fool Font loaded inside ramimage - // - // The first two paramters are hardcoded in [boot/mbr.asm], - // while the last one is set in the Makefile. The font binary - // is integrated in the kernel image. - // - // this function returns the physical base address of - // our video memory - // - -uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) -{ - //the only functionallu important init lines! (rest is log) - VbeModeInfoBlock=mode; - deffont=rawfont; - console_x=0; - console_y=0; - - int line_height=12; - int col_width=10; - console_lines=mode->Yres/line_height; - console_cols=mode->Xres/col_width; - - // vesa info - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"vbe version: 0x%x / video mode ptr: 0x%x 0x%x", - info->VbeVersion, info->VideoModePtr[1], info->VideoModePtr[0]); - - // vesa info on selected mode: - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"colors r:%d 0x%x g:%d 0x%x b:%d 0x%x", - mode->red_position,mode->red_mask, - mode->green_position,mode->green_mask, - mode->blue_position,mode->blue_mask); - - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"res: %d * %d / banks: %d / attr: 0x%x", - mode->Xres, mode->Yres, mode->banks, mode->attributes); - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"bpp: %d / physbase: 0x%x", - mode->bpp,mode->physbase); - - // vesa modes - // todo: take segment from vbeinfo! -#ifdef FOOLSOS_SHOW_VESAMODES - uint16_t *modeptr=info->VideoModePtr[0]; - - while(*modeptr!=0xffff&&*modeptr!=0) - { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mode supported : 0x%X", (*modeptr)); - modeptr++; - } -#endif - - - return VbeModeInfoBlock->physbase; - -} - -void PutPixel(int x,int y, int color){ - - //do not write memory outside the screen buffer, check parameters against the VBE mode info - if (x<0 || x>VbeModeInfoBlock->Xres|| y<0 || y>VbeModeInfoBlock->Yres) return; - if (x) x = (x*(VbeModeInfoBlock->bpp>>3)); // get bytes (divide by 8) - if (y) y = (y*VbeModeInfoBlock->pitch); - uint8_t *cTemp=VbeModeInfoBlock->physbase; - - cTemp[x+y] = (uint8_t)(color & 0xff); - cTemp[x+y+1] = (uint8_t)((color>>8) & 0xff); - //cTemp[x+y+2] = (uint8_t)((color>>16) & 0xff); - - } - - -void PutFont(char c, int x,int y, int color) -{ - - int fnt=0x126-0x20; - - if(c>=0x20&&c<=0x126)fnt=c-0x20; - - int posx, posy, sizex=8, sizey=10; - - for(posx=x;posx=console_cols)PutConsoleNL(); - #endif -} - -void PutConsole(char *str, int color) -{ - - while((*str)!=0) - { - PutConsoleChar(*str,color); - str++; - } - -} -void PutConsoleNL() -{ - console_x=0; - console_y++; - if(console_y>=console_lines-5)console_y=0; - - for(int i=0;iXres-200,VbeModeInfoBlock->Yres-200,0xff); - vesa_put_rect(boxx-10,boxy-10,20,20,0x999999); - - boxx++; -// boxy+=boxx; - if(boxx>VbeModeInfoBlock->Xres-100)boxx=100; - // if(boxy>VbeModeInfoBlock->Yres-200)boxy=200; - - vesa_switch_buffers(); -} - -/* -void vesa_init_doublebuff() -{ - boxx=300; - boxy=300; - - int blocks=800*600*2/4096+1; - physbase=VbeModeInfoBlock->physbase; - buffer=pmmngr_alloc_blocks(blocks); - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Init buffer of %d blocks at 0x%08X",blocks,buffer); - - VbeModeInfoBlock->physbase=buffer; -} -*/ diff --git a/xxx/video/vesa.h b/xxx/video/vesa.h deleted file mode 100644 index 371e944..0000000 --- a/xxx/video/vesa.h +++ /dev/null @@ -1,47 +0,0 @@ -#include - -typedef struct foolfont_struct -{ - uint8_t line[10]; //every single fool font consists of 10 lines a 8 bit - -}foolfont; - -typedef struct vbeinfo_struct{ - char VbeSignature[4]; // == "VESA" - uint16_t VbeVersion; // == 0x0300 for VBE 3.0 - uint16_t OemStringPtr[2]; // isa vbeFarPtr - uint8_t Capabilities[4]; - uint16_t VideoModePtr[2]; // isa vbeFarPtr - uint16_t TotalMemory; // as # of 64KB blocks -}vbeinfo; - - -typedef struct ModeInfoBlock { - uint16_t attributes; - uint8_t winA,winB; - uint16_t granularity; - uint16_t winsize; - uint16_t segmentA, segmentB; - uint16_t realFctPtr[2]; -// VBE_FAR(realFctPtr); - uint16_t pitch; // bytes per scanline - - uint16_t Xres, Yres; - uint8_t Wchar, Ychar, planes, bpp, banks; - uint8_t memory_model, bank_size, image_pages; - uint8_t reserved0; - - uint8_t red_mask, red_position; - uint8_t green_mask, green_position; - uint8_t blue_mask, blue_position; - uint8_t rsv_mask, rsv_position; - uint8_t directcolor_attributes; - - volatile uint32_t physbase; // your LFB (Linear Framebuffer) address ;) - uint32_t reserved1; - uint16_t reserved2; -}vbemodeinfo; - -uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont); -void PutConsoleChar(char c, int color); -void PutConsole(char *str, int color); -- cgit v1.2.3