diff options
| author | Ian C <ianc@noddybox.co.uk> | 2007-03-01 00:36:54 +0000 | 
|---|---|---|
| committer | Ian C <ianc@noddybox.co.uk> | 2007-03-01 00:36:54 +0000 | 
| commit | 6be2806499299bb13edde3481803f28416429902 (patch) | |
| tree | ee80944e5af4f9ab002fb91c73f032ee6d385de8 /include | |
| parent | b7fc2934d2cd1e593fe5d1c99678321a21d0948d (diff) | |
Changed lower screen to 8-bits and added overlayed text mode.  Monitor stub in place.  Text mode helpers being developed.
Diffstat (limited to 'include')
| -rw-r--r-- | include/framebuffer.h | 69 | ||||
| -rw-r--r-- | include/monitor.h | 27 | ||||
| -rw-r--r-- | include/textmode.h | 37 | ||||
| -rw-r--r-- | include/z80_config.h | 2 | ||||
| -rw-r--r-- | include/zx81.h | 2 | 
5 files changed, 125 insertions, 12 deletions
| diff --git a/include/framebuffer.h b/include/framebuffer.h index 7b04685..3055e51 100644 --- a/include/framebuffer.h +++ b/include/framebuffer.h @@ -22,17 +22,64 @@  #ifndef DS81_FRAMEBUFFER_H  #define DS81_FRAMEBUFFER_H -#define FB_RGB(r,g,b)	((RGB15(r,g,b))|0x8000) - -void	FB_Init(uint16 *vram); -void	FB_Print(const char *text, int x, int y, int colour, int paper); -void	FB_Centre(const char *text, int y, int colour, int paper); -void	FB_printf(int x, int y, int colour, int paper, const char *format, ...); -void	FB_HLine(int x1, int x2, int y, int colour); -void	FB_VLine(int x, int y1, int y2, int colour); -void	FB_Box(int x, int y, int w, int h, int colour); -void	FB_FillBox(int x, int y, int w, int h, int colour); +/* Predefined colours. +*/ +typedef enum  +{ +    COL_TRANSPARENT	= -1, +    COL_BLACK		= 0, +    COL_WHITE		= 240, +    COL_RED		= 241, +    COL_GREEN		= 242, +    COL_BLUE		= 243, +    COL_GUISELECT	= 244, +    COL_GREY		= 245, +    COL_LIGHTGREY	= 246, +    COL_DARKGREY	= 247, +    COL_YELLOW		= 248 +} FB_Colour; + + +/* Initialise 'framebuffer' code.  vram is where the 8-bit framebuffer is. +   palette is the palette to use/set. +*/ +void	FB_Init(uint16 *vram, uint16 *palette); + +/* Load the internal framebuffer font as a set of ASCII tiles (starting with +   space) at tiles.  The tiles will use colour COL_WHITE. +*/ +void	FB_LoadASCIITiles(uint16 *tiles); + +/* Print the text into the framebuffer.  +*/ +void	FB_Print(const char *text, int x, int y, +		 FB_Colour colour, FB_Colour paper); +void	FB_Centre(const char *text, int y,  +		  FB_Colour colour, FB_Colour paper); +void	FB_printf(int x, int y, FB_Colour colour, FB_Colour paper, +		  const char *format, ...); + +/* Lines and boxes. +*/ +void	FB_HLine(int x1, int x2, int y, FB_Colour colour); +void	FB_VLine(int x, int y1, int y2, FB_Colour colour); +void	FB_Box(int x, int y, int w, int h, FB_Colour colour); +void	FB_FillBox(int x, int y, int w, int h, FB_Colour colour); + +/* Clear to background +*/  void	FB_Clear(void); -void	FB_Blit(sImage *img, int x, int y); + +/* Draw the image.  The image must be an 8-bit image, but with only the first +   16 palette entries used.  Just to complicate matters! + +   The image is assumed to be an even number of pixels wide.  Also the passed +   X co-ord will be forced even. + +   offset is used to give an offset into the palette to place colours from the +   image.  Palette entries 1 - 128 will always be safe to use (these routines +   will never use them). +*/ +void	FB_Blit(sImage *img, int x, int y, int offset);  #endif	/* DS81_FRAMEBUFFER_H */ diff --git a/include/monitor.h b/include/monitor.h new file mode 100644 index 0000000..5bbdc8b --- /dev/null +++ b/include/monitor.h @@ -0,0 +1,27 @@ +/* +   ds81 - Nintendo DS ZX81 emulator. + +   Copyright (C) 2007  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$ +*/ +#ifndef DS81_MONITOR_H +#define DS81_MONITOR_H + +void MachineCodeMonitor(void); + +#endif	/* DS81_MONITOR_H */ diff --git a/include/textmode.h b/include/textmode.h new file mode 100644 index 0000000..751ad05 --- /dev/null +++ b/include/textmode.h @@ -0,0 +1,37 @@ +/* +   ds81 - Nintendo DS ZX81 emulator. + +   Copyright (C) 2007  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$ +*/ +#ifndef DS81_TEXTMODE_H +#define DS81_TEXTMODE_H + +/* Note that the co-ords are into the map -- the user is free to use this and +   move the map around, scale it, blend it, do want they want with it... + +   The routines assume they can write into this map using the ASCII code  +   with 32 subtracted for each char. +*/ +void TM_Init(uint16 *vram, int map_width, int map_height, int map_is_rotation); + +void TM_Cls(void); +void TM_Put(int x, int y, const char *str); +void TM_printf(int x, int y, const char *format, ...); + +#endif	/* DS81_TEXTMODE_H */ diff --git a/include/z80_config.h b/include/z80_config.h index 8be062b..af36944 100644 --- a/include/z80_config.h +++ b/include/z80_config.h @@ -34,8 +34,8 @@  /* Define this to enable the disassembly interface -#define ENABLE_DISASSEM  */ +#define ENABLE_DISASSEM  /* Define this to enable the array-based memory model.  In this mode diff --git a/include/zx81.h b/include/zx81.h index c50c1a4..2606c98 100644 --- a/include/zx81.h +++ b/include/zx81.h @@ -77,6 +77,8 @@ void	ZX81WriteMem(Z80 *z80, Z80Word addr, Z80Byte val);  Z80Byte	ZX81ReadPort(Z80 *z80, Z80Word port);  void	ZX81WritePort(Z80 *z80, Z80Word port, Z80Byte val); +#define	ZX81ReadDisassem ZX81ReadMem +  #endif | 
