diff options
Diffstat (limited to 'arm9/source/framebuffer.c')
-rw-r--r-- | arm9/source/framebuffer.c | 276 |
1 files changed, 0 insertions, 276 deletions
diff --git a/arm9/source/framebuffer.c b/arm9/source/framebuffer.c deleted file mode 100644 index 65bedc9..0000000 --- a/arm9/source/framebuffer.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - ds81 - Nintendo DS ZX81 emulator. - - Copyright (C) 2006 Ian Cowburn <ianc@noddybox.co.uk> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - $Id$ -*/ - -#include <nds.h> -#include <string.h> - -#include "ds81_global.h" - -/* ---------------------------------------- STATIC DATA -*/ -#define WIDTH 256 -#define HEIGHT 192 - -static uint16 *buff=0; - -static uint8 font[]= -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, - 0x00, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x24, 0x7e, 0x24, 0x24, 0x7e, 0x24, 0x00, - 0x00, 0x10, 0x7c, 0x14, 0x7c, 0x50, 0x7c, 0x10, - 0x00, 0x46, 0x26, 0x10, 0x08, 0x64, 0x62, 0x00, - 0x00, 0x08, 0x14, 0x08, 0x54, 0x22, 0x5c, 0x00, - 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x00, - 0x00, 0x04, 0x08, 0x08, 0x08, 0x08, 0x04, 0x00, - 0x00, 0x00, 0x28, 0x10, 0x7c, 0x10, 0x28, 0x00, - 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, - 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, - 0x00, 0x3c, 0x62, 0x52, 0x4a, 0x46, 0x3c, 0x00, - 0x00, 0x18, 0x14, 0x10, 0x10, 0x10, 0x7c, 0x00, - 0x00, 0x3c, 0x42, 0x40, 0x3c, 0x02, 0x7e, 0x00, - 0x00, 0x3c, 0x42, 0x30, 0x40, 0x42, 0x3c, 0x00, - 0x00, 0x10, 0x18, 0x14, 0x12, 0x7e, 0x10, 0x00, - 0x00, 0x7e, 0x02, 0x3e, 0x40, 0x42, 0x3c, 0x00, - 0x00, 0x3c, 0x02, 0x3e, 0x42, 0x42, 0x3c, 0x00, - 0x00, 0x7e, 0x40, 0x20, 0x10, 0x08, 0x08, 0x00, - 0x00, 0x3c, 0x42, 0x3c, 0x42, 0x42, 0x3c, 0x00, - 0x00, 0x3c, 0x42, 0x42, 0x7c, 0x40, 0x3c, 0x00, - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08, 0x04, - 0x00, 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, - 0x00, 0x3c, 0x42, 0x20, 0x10, 0x00, 0x10, 0x00, - 0x00, 0x3c, 0x52, 0x6a, 0x7a, 0x02, 0x3c, 0x00, - 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x00, - 0x00, 0x3e, 0x42, 0x3e, 0x42, 0x42, 0x3e, 0x00, - 0x00, 0x3c, 0x42, 0x02, 0x02, 0x42, 0x3c, 0x00, - 0x00, 0x1e, 0x22, 0x42, 0x42, 0x22, 0x1e, 0x00, - 0x00, 0x7e, 0x02, 0x3e, 0x02, 0x02, 0x7e, 0x00, - 0x00, 0x7e, 0x02, 0x3e, 0x02, 0x02, 0x02, 0x00, - 0x00, 0x3c, 0x42, 0x02, 0x72, 0x42, 0x3c, 0x00, - 0x00, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, - 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, - 0x00, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3c, 0x00, - 0x00, 0x22, 0x12, 0x0e, 0x12, 0x22, 0x42, 0x00, - 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x7e, 0x00, - 0x00, 0x42, 0x66, 0x5a, 0x42, 0x42, 0x42, 0x00, - 0x00, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x00, - 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, - 0x00, 0x3e, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x00, - 0x00, 0x3c, 0x42, 0x42, 0x4a, 0x52, 0x3c, 0x00, - 0x00, 0x3e, 0x42, 0x42, 0x3e, 0x22, 0x42, 0x00, - 0x00, 0x3c, 0x02, 0x3c, 0x40, 0x42, 0x3c, 0x00, - 0x00, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, - 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, - 0x00, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, - 0x00, 0x42, 0x42, 0x42, 0x42, 0x5a, 0x24, 0x00, - 0x00, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x00, - 0x00, 0x41, 0x22, 0x14, 0x08, 0x08, 0x08, 0x00, - 0x00, 0x7e, 0x20, 0x10, 0x08, 0x04, 0x7e, 0x00, - 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, - 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, - 0x00, 0x0e, 0x08, 0x08, 0x08, 0x08, 0x0e, 0x00, - 0x00, 0x08, 0x1c, 0x2a, 0x08, 0x08, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x00, 0x38, 0x44, 0x1e, 0x04, 0x04, 0x7e, 0x00, - 0x00, 0x00, 0x1c, 0x20, 0x3c, 0x22, 0x3c, 0x00, - 0x00, 0x04, 0x04, 0x3c, 0x44, 0x44, 0x3c, 0x00, - 0x00, 0x00, 0x38, 0x04, 0x04, 0x04, 0x38, 0x00, - 0x00, 0x20, 0x20, 0x3c, 0x22, 0x22, 0x3c, 0x00, - 0x00, 0x00, 0x1c, 0x22, 0x1e, 0x02, 0x3c, 0x00, - 0x00, 0x30, 0x08, 0x18, 0x08, 0x08, 0x08, 0x00, - 0x00, 0x00, 0x3c, 0x22, 0x22, 0x3c, 0x20, 0x1c, - 0x00, 0x02, 0x02, 0x1e, 0x22, 0x22, 0x22, 0x00, - 0x00, 0x08, 0x00, 0x0c, 0x08, 0x08, 0x1c, 0x00, - 0x00, 0x20, 0x00, 0x20, 0x20, 0x20, 0x24, 0x18, - 0x00, 0x04, 0x14, 0x0c, 0x0c, 0x14, 0x24, 0x00, - 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, 0x00, - 0x00, 0x00, 0x16, 0x2a, 0x2a, 0x2a, 0x2a, 0x00, - 0x00, 0x00, 0x1e, 0x22, 0x22, 0x22, 0x22, 0x00, - 0x00, 0x00, 0x1c, 0x22, 0x22, 0x22, 0x1c, 0x00, - 0x00, 0x00, 0x1e, 0x22, 0x22, 0x1e, 0x02, 0x02, - 0x00, 0x00, 0x3c, 0x22, 0x22, 0x3c, 0x20, 0x60, - 0x00, 0x00, 0x38, 0x04, 0x04, 0x04, 0x04, 0x00, - 0x00, 0x00, 0x1c, 0x02, 0x1c, 0x20, 0x1e, 0x00, - 0x00, 0x08, 0x1c, 0x08, 0x08, 0x08, 0x30, 0x00, - 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x1c, 0x00, - 0x00, 0x00, 0x22, 0x22, 0x14, 0x14, 0x08, 0x00, - 0x00, 0x00, 0x22, 0x2a, 0x2a, 0x2a, 0x14, 0x00, - 0x00, 0x00, 0x22, 0x14, 0x08, 0x14, 0x22, 0x00, - 0x00, 0x00, 0x22, 0x22, 0x22, 0x3c, 0x20, 0x1c, - 0x00, 0x00, 0x3e, 0x10, 0x08, 0x04, 0x3e, 0x00, - 0x00, 0x70, 0x10, 0x0c, 0x10, 0x10, 0x70, 0x00, - 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x0e, 0x08, 0x30, 0x08, 0x08, 0x0e, 0x00, - 0x00, 0x28, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3c, 0x42, 0x99, 0x85, 0x85, 0x99, 0x42, 0x3c -}; - -/* ---------------------------------------- PUBLIC INTERFACES -*/ -void FB_Init(uint16 *vram) -{ - buff=vram; -} - - -void FB_Print(const char *text, int x, int y, int colour, int paper) -{ - uint16 *base; - - base=buff+y*WIDTH+x; - - while(*text) - { - int x,y; - int ch; - - ch=((*text)-32)*8; - - for(y=0;y<8;y++) - { - for(x=0;x<8;x++) - { - if (font[ch]&(1<<x)) - { - *(base+x+y*WIDTH)=colour; - } - else - { - if (paper!=-1) - { - *(base+x+y*WIDTH)=paper; - } - } - } - - ch++; - } - - base+=8; - text++; - } -} - - -void FB_Centre(const char *text, int y, int colour, int paper) -{ - FB_Print(text,WIDTH/2-strlen(text)*4,y,colour,paper); -} - - -void FB_HLine(int x1, int x2, int y, int colour) -{ - uint16 *line; - - line=buff+y*WIDTH+x1; - - while(x1<=x2) - { - *line++=colour; - x1++; - } -} - - -void FB_VLine(int x, int y1, int y2, int colour) -{ - uint16 *line; - - line=buff+y1*WIDTH+x; - - while(y1<=y2) - { - *line=colour; - line+=WIDTH; - y1++; - } -} - - -void FB_Box(int x, int y, int w, int h, int colour) -{ - FB_HLine(x,x+w-1,y,colour); - FB_HLine(x,x+w-1,y+h-1,colour); - FB_VLine(x,y,y+h-1,colour); - FB_VLine(x+w-1,y,y+h-1,colour); -} - - -void FB_FillBox(int x, int y, int w, int h, int colour) -{ - int f; - uint16 *base; - - base=buff+x+y*WIDTH; - - while(h--) - { - for(f=0;f<w;f++) - { - *(base+f)=colour; - } - - base+=WIDTH; - } -} - - -void FB_Clear(void) -{ - uint16 *p; - int f; - - f=WIDTH*HEIGHT; - p=buff; - - while(f--) - { - *p++=0x8000; - } -} - - -void FB_Blit(sImage *img, int x, int y) -{ - if (img->width==WIDTH && img->height==HEIGHT) - { - dmaCopy(img->data8,buff,SCREEN_WIDTH*SCREEN_HEIGHT*2); - } - else - { - int f; - - for(f=0;f<img->height;f++) - { - dmaCopy(img->data16+(f*img->width), - buff+x+(y+f)*WIDTH,img->width*2); - } - } -} |