From a3db6647c13012e8976d09b6fc14556c77a3c311 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 3 Jun 2011 15:45:46 +0800 Subject: [PATCH] Deleted axwin0 (now backed up) --- Usermode/Applications/axwin0_src/Makefile | 11 - Usermode/Applications/axwin0_src/axwin.h | 48 ---- Usermode/Applications/axwin0_src/bitmaps.h | 34 --- Usermode/Applications/axwin0_src/desktop.c | 80 ------ .../Applications/axwin0_src/desktop_font.h | 47 ---- Usermode/Applications/axwin0_src/graphics.c | 107 -------- Usermode/Applications/axwin0_src/header.h | 49 ---- Usermode/Applications/axwin0_src/heap.c | 235 ------------------ Usermode/Applications/axwin0_src/import.asm | 117 --------- Usermode/Applications/axwin0_src/main.c | 183 -------------- Usermode/Applications/axwin0_src/start.asm | 98 -------- Usermode/Applications/axwin0_src/wm.c | 184 -------------- 12 files changed, 1193 deletions(-) delete mode 100644 Usermode/Applications/axwin0_src/Makefile delete mode 100644 Usermode/Applications/axwin0_src/axwin.h delete mode 100644 Usermode/Applications/axwin0_src/bitmaps.h delete mode 100644 Usermode/Applications/axwin0_src/desktop.c delete mode 100644 Usermode/Applications/axwin0_src/desktop_font.h delete mode 100644 Usermode/Applications/axwin0_src/graphics.c delete mode 100644 Usermode/Applications/axwin0_src/header.h delete mode 100644 Usermode/Applications/axwin0_src/heap.c delete mode 100644 Usermode/Applications/axwin0_src/import.asm delete mode 100644 Usermode/Applications/axwin0_src/main.c delete mode 100644 Usermode/Applications/axwin0_src/start.asm delete mode 100644 Usermode/Applications/axwin0_src/wm.c diff --git a/Usermode/Applications/axwin0_src/Makefile b/Usermode/Applications/axwin0_src/Makefile deleted file mode 100644 index fb51b2d1..00000000 --- a/Usermode/Applications/axwin0_src/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# Project: Acess GUI Window Manager - --include ../Makefile.cfg - -CPPFLAGS += -I../include - -DIR := Apps/AxWin/0.1 -BIN := ../AxWin0 -OBJ := main.o wm.o graphics.o desktop.o - --include ../Makefile.tpl diff --git a/Usermode/Applications/axwin0_src/axwin.h b/Usermode/Applications/axwin0_src/axwin.h deleted file mode 100644 index 6259f0f8..00000000 --- a/Usermode/Applications/axwin0_src/axwin.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -AxWin API -*/ - -#ifndef NULL -# define NULL ((void*)0) -#endif - -#ifndef _AXWIN_HEADER_H -typedef unsigned char Uint8; -typedef unsigned long Uint32; -typedef unsigned int Uint; -#endif - -typedef int (*wndproc_t)(void *handle, int message, int arg1, int arg2); - -typedef struct { - short width, height; - int bpp; - void *data; -} BITMAP; -typedef struct { - int x1, y1; - int x2, y2; -} RECT; - - -//Flag Values -#define WNDFLAG_SHOW 0x0001 -#define WNDFLAG_NOBORDER 0x0010 - -//Window Messages -enum MESSAGES { - WM_NULL, - WM_REPAINT, - WM_GETTEXT, - WM_SETTEXT, - WM_SETTITLE, - WM_GETTITLE -}; - -// === EXTERNAL FUNCTIONS === -extern void* WM_CreateWindow(int x, int y, int w, int h, wndproc_t wndProc, Uint flags); -extern int WM_SendMessage(void *hwnd, int msg, int a1, int a2); - -// === DEFINES === -#define WM_SetText(hwnd, text) WM_SendMessage((hwnd), WM_SETTEXT, (int)((char*)(text)), 0) -#define WM_SetTitle(hwnd, text) WM_SendMessage((hwnd), WM_SETTITLE, (int)((char*)(text)), 0) diff --git a/Usermode/Applications/axwin0_src/bitmaps.h b/Usermode/Applications/axwin0_src/bitmaps.h deleted file mode 100644 index 6ed63557..00000000 --- a/Usermode/Applications/axwin0_src/bitmaps.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -AcessOS Window Manager -Bitmaps -HEADER -*/ - -Uint32 bmpCursor[] = { //16x32 - 0xF0000000,0x00000000, - 0xFF000000,0x00000000, - 0xF1F00000,0x00000000, - 0xF11F0000,0x00000000, - 0xF111F000,0x00000000, - 0xF1111F00,0x00000000, - 0xF11111F0,0x00000000, - 0xF111111F,0x00000000, - 0xF1111111,0xF0000000, - 0xF1111111,0x1F000000, - 0xF1111111,0x11F00000, - 0xF111111F,0xFFFF0000, - 0xF111F11F,0x00000000, - 0xF11FF11F,0x00000000, - 0xF1F00F11,0xF0000000, - 0xFF000F11,0xF0000000, - 0xF00000F1,0x1F000000, - 0x000000F1,0x1F000000, - 0x0000000F,0x11F00000, - 0x0000000F,0x11F00000, - 0x00000000,0xFF000000, - 0x00000000,0x00000000, - 0x00000000,0x00000000, - 0x00000000,0x00000000, - 0x00000000,0x00000000, - 0x00000000,0x00000000, -}; diff --git a/Usermode/Applications/axwin0_src/desktop.c b/Usermode/Applications/axwin0_src/desktop.c deleted file mode 100644 index e474f75d..00000000 --- a/Usermode/Applications/axwin0_src/desktop.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -AcessOS Window Manager -Desktop Window -*/ -#include "axwin.h" -#include "desktop_font.h" -#include - -#define DEBUG 0 - -#define FGC 0xFFFFFFFF -#define BGC 0xFF000000 - -// === GLOBALS === - void* gHwnd = NULL; - int gW = 640; - int gH = 480; - -// === PROTOTYPES === -void Desktop_Init(); - int Desktop_WndProc(void *handle, int message, int arg1, int arg2); -void Desktop_PrintAt(BITMAP *bmp, int x, int y, char *text); - -// === CODE === -void Desktop_Init() -{ - gHwnd = WM_CreateWindow(0, 0, -1, -1, Desktop_WndProc, WNDFLAG_NOBORDER|WNDFLAG_SHOW); - if(gHwnd == 0) - { - //write(giConsoleFP, 32, "Unable to create desktop window\n"); - return; - } - WM_SetTitle(gHwnd, "Desktop"); -} - -int Desktop_WndProc(void *handle, int message, int arg1, int arg2) -{ - switch(message) - { - case WM_REPAINT: - { - BITMAP *bmp = (BITMAP*)arg1; - memset( bmp->data, BGC, bmp->width*bmp->height*4 ); - Desktop_PrintAt( bmp, 0, 0, "CAB@1337!" ); - } - break; - - default: - return 0; - } - return 1; // Handled -} - -void Desktop_PrintAt(BITMAP *bmp, int x, int y, char *text) -{ - int j,k,w; - Uint32 *buf; - - if( bmp == NULL || text == NULL ) - return; - - buf = bmp->data; - w = bmp->width; - buf += y*w+x; - while(*text) - { - for(j=0;j<9;j++) - { - int c = cFONT_ASCII[(int)*text][j]; - for(k=0;k<8;k++) - { - if(c&(1<<(7-k))) buf[j*w+k] = FGC; - else buf[j*w+k] = BGC; - } - buf[j*w+8] = BGC; - } - buf += 9; - text++; - } -} diff --git a/Usermode/Applications/axwin0_src/desktop_font.h b/Usermode/Applications/axwin0_src/desktop_font.h deleted file mode 100644 index 43f338fe..00000000 --- a/Usermode/Applications/axwin0_src/desktop_font.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -AcessOS Window Manager -Desktop Window -Font -HEADER -*/ - -Uint8 cFONT_ASCII[][9] = { -{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,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,0,0},{0,0,0,0,0,0,0,0,0}, //4 -{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,0,0,0,0,0}, //8 -{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,0,0,0,0,0}, //C -{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,0,0,0,0,0}, //10 -{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,0,0,0,0,0}, //14 -{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,0,0,0,0,0}, //18 -{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,0,0,0,0,0}, //1C -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x08,0x08}, //20+21 -{0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00}, {0x24,0x24,0xFF,0x24,0x24,0x24,0xFF,0x24,0x24}, //22+23 -{0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //24+25 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x10,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00}, //26+27 -{0x00,0x04,0x08,0x10,0x20,0x20,0x10,0x08,0x04}, {0x00,0x20,0x10,0x08,0x04,0x04,0x08,0x10,0x20}, //28+29 () -{0x54,0x38,0x54,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00}, //2A+2B *+ -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08}, {0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00}, //2C+2D ,- -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18}, {0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x60}, //2E+2F ./ -{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C}, {0x1C,0x28,0x08,0x08,0x08,0x08,0x08,0x08,0x3E}, //30+31 01 -{0x3C,0x42,0x04,0x08,0x10,0x10,0x20,0x40,0x7E}, {0x3C,0x42,0x02,0x02,0x3C,0x02,0x02,0x42,0x7E}, //32+33 23 -{0x08,0x18,0x28,0x48,0x7E,0x08,0x08,0x08,0x3C}, {0x7E,0x40,0x40,0x38,0x04,0x02,0x02,0x04,0x38}, //34+35 45 -{0x1E,0x20,0x40,0x40,0x7C,0x42,0x42,0x42,0x18}, {0x7E,0x02,0x04,0x08,0x08,0x10,0x10,0x20,0x20}, //36+37 67 -{0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C}, {0x3C,0x42,0x42,0x42,0x3E,0x02,0x02,0x04,0x78}, //38+39 89 -{0x00,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x00}, {0x00,0x00,0x18,0x00,0x00,0x18,0x30,0x60,0x00}, //3A+3B :; -{0x00,0x00,0x0C,0x30,0x40,0x30,0x0C,0x00,0x00}, {0x00,0x00,0x00,0x7E,0x00,0x7E,0x00,0x00,0x00}, //3C+3D <= -{0x00,0x00,0x30,0x0C,0x02,0x0C,0x30,0x00,0x00}, {0x3C,0x42,0x02,0x0C,0x10,0x10,0x00,0x30,0x00}, //3E+3F >? -{0x3C,0x42,0x4E,0x52,0x52,0x4C,0x40,0x40,0x3C}, {0x18,0x24,0x24,0x42,0x7E,0x42,0x42,0x42,0x42}, //40+41 @A -{0x7C,0x22,0x22,0x22,0x3C,0x22,0x22,0x22,0x7C}, {0x3C,0x42,0x40,0x40,0x40,0x40,0x40,0x42,0x3C}, //42+43 BC -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //44+45 DE -}; -#if 0 -00111100 -01000010 -01000000 -01000000 -01000000 -01000000 -01000000 -01000010 -00111100 -#endif diff --git a/Usermode/Applications/axwin0_src/graphics.c b/Usermode/Applications/axwin0_src/graphics.c deleted file mode 100644 index 38b06fa3..00000000 --- a/Usermode/Applications/axwin0_src/graphics.c +++ /dev/null @@ -1,107 +0,0 @@ -/* -Acess OS Window Manager -*/ -#include "header.h" - -#define ABS(x) ((x)<0?-(x):(x)) -#define PLOT(x,y,colour) (gScreenBuffer[(y)*SCREEN_WIDTH+(x)] = (colour)) - -void draw_line(int x1, int y1, int x2, int y2, Uint32 colour) -{ - int dy, dx; - int i; - float step; - - dy = ABS(y2 - y1); - dx = ABS(x2 - x1); - - if(dx == 0) { - if(y1 < y2) { - for(i=y1;iy1?step:-step); - for(i=x1;iy1?-step:step); - for(i=x2;iy1*SCREEN_WIDTH+rc->x1; - bi = bmp->data; bi16 = bmp->data; bi8 = bmp->data; - w = bmp->width; - h = bmp->height; - - #if DEBUG - k_printf(" draw_bmp: bmp->bpp = %i\n", bmp->bpp); - #endif - - switch(bmp->bpp) - { - // === 32bit Colour === - case 32: - for(i = 0; i < h; i++) - { - for(j = 0; j < w; j++) - { - a = *bi >> 24; - switch(a) - { - case 0xFF: //Fully Visible - buf[j] = *bi; - break; - case 0x80: // 50/50 - r = ((*bi>>16)&0xFF) + ((*buf>>16)&0xFF); - g = ((*bi>>8)&0xFF) + ((*buf>>8)&0xFF); - b = ((*bi)&0xFF) + ((*buf)&0xFF); - r >>= 1; g >>= 1; b >>= 1; - buf[j] = (r<<16) | (g<<8) | b; - break; - case 0x00: // Fully Transparent - break; - default: // Everything else - r = ((*bi>>16)&0xFF)*(255-a) + ((*buf>>16)&0xFF)*a; - g = ((*bi>>8)&0xFF)*(255-a) + ((*buf>>8)&0xFF)*a; - b = ((*bi)&0xFF)*(255-a) + ((*buf)&0xFF)*a; - r >>= 8; g >>= 8; b >>= 8; - buf[j] = (r<<16) | (g<<8) | b; - break; - } - bi++; - } - buf += SCREEN_WIDTH; - } - break; - } -} diff --git a/Usermode/Applications/axwin0_src/header.h b/Usermode/Applications/axwin0_src/header.h deleted file mode 100644 index 1244f592..00000000 --- a/Usermode/Applications/axwin0_src/header.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -Acess OS GUI -*/ -#ifndef _AXWIN_HEADER_H -#define _AXWIN_HEADER_H - -#include - -//CONSTANTS -#define SCREEN_WIDTH 640 -#define SCREEN_HEIGHT 480 -#define SCREEN_PX_COUNT (SCREEN_WIDTH*SCREEN_HEIGHT) -#define SCREEN_BUFFER_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT*4) - -#define NULL ((void*)0) - -typedef uint32_t Uint32; -typedef uint16_t Uint16; -typedef uint8_t Uint8; -typedef uint Uint; - -extern Uint32 *gScreenBuffer; - -#include "axwin.h" - -typedef struct sWINDOW{ - void *handle; - RECT rc; - char *title; - int flags; - int repaint; - - BITMAP bmp; - - struct sWINDOW *next, *prev; - struct sWINDOW *first_child, *last_child; - struct sWINDOW *parent; - - wndproc_t wndproc; -} tWINDOW; - -//PROTOTYPES -extern void wmUpdateWindows(); -extern void memcpyd(void *to, void *from, int count); -extern void draw_line(int x1, int y1, int x2, int y2, Uint32 colour); -extern void draw_rect(int x, int y, int w, int h, Uint32 colour); -extern void draw_bmp(BITMAP *bmp, RECT *rc); - -#endif diff --git a/Usermode/Applications/axwin0_src/heap.c b/Usermode/Applications/axwin0_src/heap.c deleted file mode 100644 index e7a1e392..00000000 --- a/Usermode/Applications/axwin0_src/heap.c +++ /dev/null @@ -1,235 +0,0 @@ -/* -AcessOS Basic LibC -Malloc.c - Heap Manager -*/ - -#include "header.h" - -#define MAGIC 0xACE2ACED //AcessOS1 -#define MAGIC_FREE (~MAGIC) //AcessOS1 -#define BLOCK_SIZE 16 //Minimum - -//Typedefs -typedef struct { - Uint magic; - Uint size; -} heap_head; -typedef struct { - heap_head *header; - Uint magic; -} heap_foot; - -//Globals -void *heap_start = NULL; -void *heap_end; -Uint endHeap; - -//Prototypes -void *malloc(Uint bytes); -void free(void *mem); -void *realloc(Uint bytes, void *mem); -void *extendHeap(int bytes); - -//Code -/* Initialise Heap - */ -void heap_init() -{ - heap_start = (void*)( (gAxeHdr.loadto + gAxeHdr.length + 0xFFF) & 0xFFFFF000) ; - heap_end = heap_start; - extendHeap( gAxeHdr.maxmem ); - endHeap = (Uint)heap_start + gAxeHdr.maxmem; -} - -void *malloc(Uint bytes) -{ - Uint bestSize; - Uint closestMatch = 0; - Uint bestMatchAddr = 0; - heap_head *curBlock = heap_start; - - if(heap_start == NULL) { - heap_init(); - curBlock = heap_start; - } - - bestSize = ((bytes+sizeof(heap_head)+sizeof(heap_foot))/BLOCK_SIZE+1)*BLOCK_SIZE; //Round up to block size - - while((Uint)curBlock < (Uint)heap_end) - { - if(curBlock->magic == MAGIC_FREE) - { - //foundFree = 1; - if(curBlock->size == bestSize) - break; - if(bestSize < curBlock->size && (curBlock->size < closestMatch || closestMatch == 0)) { - closestMatch = curBlock->size; - bestMatchAddr = (Uint)curBlock; - } - } else if(curBlock->magic != MAGIC) { - //Corrupt Heap - return NULL; - } - curBlock = (heap_head*)((Uint)curBlock + curBlock->size); - } - - if((Uint)curBlock < (Uint)heap_start) { - //panic("malloc: Heap underrun for some reason\n"); - return NULL; - } - - //Found a perfect match - if((Uint)curBlock < (Uint)heap_end) { - curBlock->magic = MAGIC; - return (void*)((Uint)curBlock + sizeof(heap_head)); - } - - //Out of Heap Space - if(!closestMatch) - { - #if 0 - curBlock = extendHeap(bestSize); //Allocate more - if(curBlock == NULL) { - //panic("malloc: Out of kernel heap memory\n"); - return NULL; - } - curBlock->magic = MAGIC; - return (void*)((Uint)curBlock + sizeof(heap_head)); - #else - return NULL; - #endif - } - - //Split Block? - if(closestMatch - bestSize > BLOCK_SIZE) { - heap_foot *foot; - curBlock = (heap_head*)bestMatchAddr; - curBlock->magic = MAGIC; - curBlock->size = bestSize; - foot = (heap_foot*)(bestMatchAddr + bestSize - sizeof(heap_foot)); - foot->header = curBlock; - foot->magic = MAGIC; - - curBlock = (heap_head*)(bestMatchAddr + bestSize); - curBlock->magic = MAGIC_FREE; - curBlock->size = closestMatch - bestSize; - - foot = (heap_foot*)(bestMatchAddr + closestMatch - sizeof(heap_foot)); - foot->header = curBlock; - - ((heap_head*)bestMatchAddr)->magic = MAGIC; //mark as used - return (void*)(bestMatchAddr + sizeof(heap_head)); - } - - //Don't Split the block - ((heap_head*)bestMatchAddr)->magic = MAGIC; - return (void*)(bestMatchAddr+sizeof(heap_head)); -} - -/* Free previously allocated memory - */ -void free(void *mem) -{ - heap_head *head = mem; - - if(head->magic != MAGIC) //Valid Heap Address - return; - - head->magic = MAGIC_FREE; - - //Unify Right - if((Uint)head + head->size < (Uint)heap_end) - { - heap_head *nextHead = (heap_head*)((Uint)head + head->size); - if(nextHead->magic == MAGIC_FREE) { //Is the next block free - head->size += nextHead->size; //Amalgamate - nextHead->magic = 0; //For Security - } - } - //Unify Left - if((Uint)head - sizeof(heap_foot) > (Uint)heap_start) - { - heap_head *prevHead; - heap_foot *prevFoot = (heap_foot *)((Uint)head - sizeof(heap_foot)); - if(prevFoot->magic == MAGIC) { - prevHead = prevFoot->header; - if(prevHead->magic == MAGIC_FREE) { - prevHead->size += head->size; //Amalgamate - head->magic = 0; //For Security - } - } - } -} - -/* Create a new block at the end of the heap area - */ -void *extendHeap(int bytes) -{ - heap_head *head = heap_end; - heap_foot *foot = (heap_foot*)(((Uint)heap_end) + bytes-sizeof(heap_foot)); - - //Create New Block - head->magic = MAGIC_FREE; //Unallocated - head->size = bytes; - - foot->header = head; - foot->magic = MAGIC; - - //Combine with previous block if nessasary - if(heap_end != heap_start && ((heap_foot*)((Uint)heap_end-sizeof(heap_foot)))->magic == MAGIC) { - heap_head *tmpHead = ((heap_foot*)((Uint)heap_end-sizeof(heap_foot)))->header; - if(tmpHead->magic == MAGIC_FREE) { - tmpHead->size += bytes; - foot->header = tmpHead; - head = tmpHead; - } - } - - heap_end = (void*) ((Uint)foot+sizeof(heap_foot)); - return head; -} - -/* Reallocate a block of memory - */ -void *realloc(Uint bytes, void *oldPos) -{ - void *ret; - heap_head *head; - - if(oldPos == NULL) { - return malloc(bytes); - } - - //Check for free space after block - head = (heap_head*)((Uint)oldPos-sizeof(heap_head)); - - //Hack to used free's amagamating algorithym and malloc's splitting - free(oldPos); - - //Allocate new memory - ret = malloc(bytes); - if(ret == NULL) - return NULL; - - //Copy Old Data - if((Uint)ret != (Uint)oldPos) - { - Uint *in, *out; - Uint count; - count = head->size - sizeof(heap_head) - sizeof(heap_foot); - if((Uint)ret < (Uint)out) - { - out = ret; in = oldPos; - while(count--) *out++ = *in++; - } - else - { - out = ret; in = oldPos; - out += count; in += count; - while(count--) *--out = *--in; - } - } - - //Return - return ret; -} diff --git a/Usermode/Applications/axwin0_src/import.asm b/Usermode/Applications/axwin0_src/import.asm deleted file mode 100644 index 81a1b670..00000000 --- a/Usermode/Applications/axwin0_src/import.asm +++ /dev/null @@ -1,117 +0,0 @@ - -global _k_fopen -global _k_fclose -global _k_ftell -global _k_fseek -global _k_fread -global _k_fwrite -global _k_fstat -;global _k_printf -global _k_puts -global _k_opendir -global _k_readdir -global _k_exec -global _k_ioctl - -%macro START_FRAME 0 - push ebp - mov ebp, esp - push ebx - push ecx - push edx -%endmacro -%macro END_FRAME 0 - pop edx - pop ecx - pop ebx - pop ebp -%endmacro - -_k_fopen: - START_FRAME - mov eax, 2 ;SYS_OPEN - mov ebx, DWORD [ebp+8] - mov ecx, DWORD [ebp+12] - mov edx, 0 - int 0xAC - END_FRAME - ret - ;jmp 0x0010001c -_k_fclose: - START_FRAME - mov eax, 3 ;SYS_CLOSE - mov ebx, DWORD [ebp+8] - int 0xAC - END_FRAME ;Restore Stack Frame - ret - ;jmp 0x00100022 -_k_ftell: - jmp 0x0010002e -_k_fseek: - jmp 0x001000a9 -_k_fread: - START_FRAME - mov eax, 4 ;SYS_READ - mov ebx, DWORD [ebp+8] - mov ecx, DWORD [ebp+12] - mov edx, DWORD [ebp+16] - int 0xAC - END_FRAME - ret -_k_fwrite: - START_FRAME - mov eax, 5 ;SYS_WRITE - mov ebx, DWORD [ebp+8] - mov ecx, DWORD [ebp+12] - mov edx, DWORD [ebp+16] - int 0xAC - END_FRAME - ret -_k_fstat: - START_FRAME - mov eax, 10 ;SYS_FSTAT - mov ebx, DWORD [ebp+8] - mov ecx, DWORD [ebp+12] - int 0xAC - END_FRAME - ret -;_k_printf: -; jmp 0x1000a4 -_k_puts: - jmp 0x105418 -_k_opendir: - START_FRAME - mov eax, 2 ;SYS_OPEN - mov ebx, DWORD [ebp+8] - mov ecx, 0 - mov edx, 0 - int 0xAC - END_FRAME - ret - ;jmp 0x00100050 -_k_readdir: - START_FRAME - mov eax, 11 ;SYS_READDIR - mov ebx, DWORD [ebp+8] - mov ecx, DWORD [ebp+12] - int 0xAC - END_FRAME - ret - -_k_exec: - START_FRAME - mov eax, 14 ;SYS_EXEC - mov ebx, DWORD [ebp+8] - int 0xAC - END_FRAME - ret - -_k_ioctl: - START_FRAME - mov eax, 12 ;SYS_IOCTL - mov ebx, DWORD [ebp+8] - mov ecx, DWORD [ebp+12] - mov edx, DWORD [ebp+16] - int 0xAC - END_FRAME - ret diff --git a/Usermode/Applications/axwin0_src/main.c b/Usermode/Applications/axwin0_src/main.c deleted file mode 100644 index a2ed61ac..00000000 --- a/Usermode/Applications/axwin0_src/main.c +++ /dev/null @@ -1,183 +0,0 @@ -/* -Acess OS Window Manager -*/ -#include "header.h" -#include "bitmaps.h" -#include -#include -#include - -#define USE_MOUSE 1 - -//GLOBALS - int giConsoleFP = -1; - int giScreenFP = -1; - int giScreenMode = 1; - int giScreenWidth = SCREEN_WIDTH; - int giScreenHeight = SCREEN_HEIGHT; - int giScreenDepth = 32; - int giScreenSize = SCREEN_WIDTH*SCREEN_HEIGHT*32/8; -Uint32 *gScreenBuffer; -#if USE_MOUSE -int giMouseFP = -1; -Uint32 gCursorBMP[sizeof(bmpCursor)*2] = {0}; -int mouseX=0, mouseY=0; -Uint8 buttonState; -#endif - -//PROTOTYPES -extern void Desktop_Init(); -extern void heap_init(); -void UpdateScreen(); -#if USE_MOUSE -void UpdateMouse(); -void BuildCursor(); -void DrawCursor(); -#endif -void memsetd(void *to, long val, int count); - -//CODE -int main(void) -{ - int tmp; - - giConsoleFP = open("/Devices/vterm/1", OPENFLAG_WRITE); - - printf("AcessOS GUI version 1\n"); - printf("Opening and Initialising Video and Mouse..."); - - #if USE_MOUSE - giMouseFP = open("/Devices/ps2mouse", OPENFLAG_READ); - #endif - - tmp = giScreenWidth; ioctl(giConsoleFP, 4, &tmp); // Width - tmp = giScreenHeight; ioctl(giConsoleFP, 5, &tmp); // Height - tmp = 1; ioctl(giConsoleFP, 6, &tmp); // Buffer Mode - - giScreenSize = giScreenWidth*giScreenHeight*giScreenDepth/8; - - #if USE_MOUSE - ioctl(giMouseFP, 2, &giScreenWidth); //Set Max X - ioctl(giMouseFP, 3, &giScreenHeight); //Set Max Y - #endif - printf("Done.\n"); - - // Allocate Screen Buffer - gScreenBuffer = malloc(giScreenSize); - if(gScreenBuffer == NULL) - printf("Unable to allocate double buffer (gScreenBuffer)\n"); - - UpdateScreen(); - Desktop_Init(); - #if USE_MOUSE - BuildCursor(); //Create Cursor - #endif - - for(;;) { - memset(gScreenBuffer, 0x6666FF, giScreenSize); // Set Background Colour - wmUpdateWindows(); - #if USE_MOUSE - UpdateMouse(); - DrawCursor(); - #endif - UpdateScreen(); - } - - return 1; -} - -/* Copy from the buffer to the screen - */ -void UpdateScreen() -{ - printf("Updating Framebuffer.\n"); - seek(giScreenFP, 0, 1); //SEEK SET - write(giScreenFP, giScreenSize, gScreenBuffer); -} - -#if USE_MOUSE -void UpdateMouse() -{ - struct { - int x, y, scroll; - Uint8 buttons; - } data; - //k_printf("Updating Mouse State..."); - - seek(giMouseFP, 0, 1); - read(giMouseFP, sizeof(data), &data); - - mouseX = data.x; mouseY = data.y; - //Button Press - if(data.buttons & ~buttonState) { - //wmMessageButtonDown(); - } - //Button Release - if(~data.buttons & buttonState) { - //wmMessageButtonUp(); - } - - buttonState = data.buttons; //Update Button State - //k_printf("Done.\n"); -} - -void DrawCursor() -{ - int i,j; - Uint32 *buf, *bi; - bi = gCursorBMP; - buf = gScreenBuffer + mouseY*giScreenWidth + mouseX; - for(i=0;i<24;i++) - { - for(j=0;j<16;j++) - { - if(*bi&0xFF000000) - { - buf[j] = *bi&0xFFFFFF; - } - bi++; - } - buf += giScreenWidth; - } -} - -void BuildCursor() -{ - int i,j; - Uint32 px; - Uint32 *buf, *bi; - bi = bmpCursor; - buf = gCursorBMP; - for(i=0;i> ((7-j)*4); - if( px & 0x1 ) - { - if(px & 8) *buf = 0xFF000000; //Black (100% Alpha) - else *buf = 0xFFFFFFFF; //White (100% Alpha) - } - else - *buf = 0; // 0% Alpha - buf++; - } - bi++; - for(j=0;j<8;j++) - { - px = (*bi & (0xF << ((7-j)*4) )) >> ((7-j)*4); - if( px & 0x1 ) - { - if(px & 8) *buf = 0xFF000000; // Black (100% Alpha) - else *buf = 0xFFFFFFFF; // White (100% Alpha) - } - else - { - *buf = 0; // 0% Alpha - } - buf++; - } - bi++; - } -} -#endif diff --git a/Usermode/Applications/axwin0_src/start.asm b/Usermode/Applications/axwin0_src/start.asm deleted file mode 100644 index c45e4196..00000000 --- a/Usermode/Applications/axwin0_src/start.asm +++ /dev/null @@ -1,98 +0,0 @@ -; AcessBasic Test Command Prompt -; Assembler Stub - -[BITS 32] - -extern _main -extern codeLength -extern loadTo -extern entrypoint -extern magic - -global start -global _gAxeHdr - -FLAGS equ 0 -MAXMEM equ 0x400000 ; 4Mb - -;Header -db 'A' -db 'X' -db 'E' -db 0 -;Size -_gAxeHdr: -dd codeLength ;Code Size -dd loadTo ;Load Address -dd entrypoint ;Entrypoint -dd MAXMEM ;Maximum Used Memory -dd FLAGS ;Flags -dd magic+FLAGS+MAXMEM - -;Code -start: - push eax - call _main - - ret - ret - -;String Compare -_strcmp: - push ebp - mov ebp, esp - push ebx - push ecx - - mov ebx, [ebp+8] - mov ecx, [ebp+12] -.cmp: - mov al, BYTE [ecx] - cmp BYTE [ebx], al - jnz .out - cmp BYTE [ecx],0 - jnz .out - inc ebx - inc edx - jmp .cmp -.out: - mov eax, DWORD 0 - mov al, BYTE [ebx] - sub al, BYTE [ecx] - ;Cleanup - pop ecx - pop ebx - pop ebp - ret - -;String Copy -_strcpy: - push ebp - mov ebp, esp - push ebx - push ecx - push edx - mov ebx, [ebp+8] ;Src - mov ecx, [ebp+12] ;Dest -.cmp: - cmp BYTE [ebx], 0 - jnz .out - mov dl, BYTE [ebx] - mov BYTE [ecx], dl - inc ebx - inc ecx - jmp .cmp -.out: ;Cleanup - pop edx - pop ecx - pop ebx - pop ebp - ret - - -[section .bss] -[global _startHeap] -[global _endHeap] -_startHeap: -resb 0x4000 ;Heap Space -_endHeap: diff --git a/Usermode/Applications/axwin0_src/wm.c b/Usermode/Applications/axwin0_src/wm.c deleted file mode 100644 index 28859845..00000000 --- a/Usermode/Applications/axwin0_src/wm.c +++ /dev/null @@ -1,184 +0,0 @@ -/* -Acess OS GUI -Window Manager -*/ -#include "header.h" -#include -#include - -#define DEBUG 0 -#define EXPORT - -// === STRUCTURES === -typedef struct sWINDOW_LIST { - struct sWINDOW_LIST *next; - tWINDOW *wnd; -} tWINDOW_LIST; - -// === IMPORTS === -extern int giScreenWidth,giScreenHeight; - -//GLOBALS -static tWINDOW *hwndRootWindow = NULL; -static tWINDOW_LIST *windowList = NULL; - -//PROTOTYPES -void wmDrawWindow(tWINDOW *wnd); -void wmRepaintWindow(tWINDOW *wnd); -void wmRepaintScreen(tWINDOW_LIST *ent); -void wmInvalidateWindow(tWINDOW *wnd); - -//CODE -void wmUpdateWindows() -{ - if(windowList == NULL) return; - wmRepaintScreen(windowList); - //wmRepaintWindow(hwndRootWindow); -} - -EXPORT void *WM_CreateWindow(int x, int y, int w, int h, wndproc_t wndProc, Uint flags) -{ - tWINDOW *tmpWindow; - tWINDOW_LIST *tmpListEnt; - - - #if DEBUG - //k_printf("WM_CreateWindow: (x=%i,y=%i,w=%i,h=%i,wndProc=0x%x,flags=0x%x)\n", x,y,w,h,wndProc,flags); - #endif - - if(x < 0 || y < 0 || wndProc == NULL) - return 0; - - tmpWindow = (tWINDOW*)malloc(sizeof(tWINDOW)); - if(tmpWindow == NULL) - return NULL; - - #if DEBUG - //k_printf(" WM_CreateWindow: tmpWindow = 0x%x\n", tmpWindow); - #endif - - tmpWindow->handle = tmpWindow; - tmpWindow->flags = flags; - tmpWindow->wndproc = wndProc; - tmpWindow->bmp.bpp = 32; - tmpWindow->bmp.width = (w==-1?giScreenWidth:w); - tmpWindow->bmp.height = (h==-1?giScreenHeight:h); - tmpWindow->bmp.data = (void *) malloc(4*tmpWindow->bmp.width*tmpWindow->bmp.height); - if(tmpWindow->bmp.data == NULL) - { - free(tmpWindow); - return NULL; - } - tmpWindow->rc.x1 = x; - tmpWindow->rc.y1 = y; - tmpWindow->rc.x2 = x + tmpWindow->bmp.width; - tmpWindow->rc.y2 = y + tmpWindow->bmp.height; - tmpWindow->next = NULL; - tmpWindow->prev = NULL; - tmpWindow->first_child = NULL; - tmpWindow->last_child = NULL; - tmpWindow->parent = NULL; - - if(flags & WNDFLAG_SHOW) - { - tmpListEnt = malloc(sizeof(tWINDOW_LIST)); - tmpListEnt->wnd = tmpWindow; - tmpListEnt->next = windowList; - windowList = tmpListEnt; - } - - if(hwndRootWindow == NULL) - { - hwndRootWindow = tmpWindow; - } - else - { - if(hwndRootWindow->first_child == NULL) - { - hwndRootWindow->last_child = tmpWindow; - hwndRootWindow->first_child = tmpWindow; - } - else - { - hwndRootWindow->last_child->next = tmpWindow; - tmpWindow->prev = hwndRootWindow->last_child; - tmpWindow->prev->next = tmpWindow; - hwndRootWindow->last_child = tmpWindow; - } - tmpWindow->parent = hwndRootWindow; - } - - wmInvalidateWindow(tmpWindow); - - return tmpWindow; -} - -EXPORT int WM_SendMessage(void *hwnd, int msg, int a1, int a2) -{ - if(hwnd == NULL || ((tWINDOW*)hwnd)->wndproc == NULL) - { - //k_printf("WM_SendMessage: ERROR - Window is undefined\n"); - return -1; - } - return ((tWINDOW*)hwnd)->wndproc( ((tWINDOW*)hwnd)->handle, msg, a1, a2 ); -} - -void wmRepaintWindow(tWINDOW *wnd) -{ - tWINDOW *child; - - if(wnd->repaint == 1) - { - for(child = wnd->first_child; child != NULL; child = child->next) { - wmRepaintWindow(child); - } - WM_SendMessage(wnd, WM_REPAINT, (Uint)&wnd->bmp, 0); - wmDrawWindow(wnd); - } -} - -void wmRepaintScreen(tWINDOW_LIST *ent) -{ - #if DEBUG - //k_printf("wmRepaintScreen: (ent=0x%x)\n", ent); - #endif - if(ent == NULL) - return; - if(ent->wnd->repaint == 1) - { - #if DEBUG - //k_printf("wmRepaintScreen: ent->wnd=0x%x\n", ent->wnd); - #endif - WM_SendMessage(ent->wnd, WM_REPAINT, (Uint)&ent->wnd->bmp, 0); - #if DEBUG - //k_printf("wmRepaintScreen: ent->wnd=0x%x\n", ent->wnd); - #endif - wmDrawWindow(ent->wnd); - } - if(ent->next != NULL) - { - wmRepaintScreen(ent->next); - } -} - -void wmDrawWindow(tWINDOW *wnd) -{ - #if DEBUG - //k_printf("wmDrawWindow: (wnd = 0x%x)\n", wnd); - #endif - if(wnd->flags & WNDFLAG_SHOW) { - #if DEBUG - //k_printf(" wmDrawWindow: Drawing Window\n"); - #endif - draw_bmp(&wnd->bmp, &wnd->rc); - } -} - -void wmInvalidateWindow(tWINDOW *wnd) -{ - tWINDOW *parent; - wnd->repaint = 1; - - while( (parent = wnd->parent) ) - parent->repaint = 1; -} -- 2.20.1