summaryrefslogtreecommitdiff
path: root/source/main.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2006-10-04 23:05:43 +0000
committerIan C <ianc@noddybox.co.uk>2006-10-04 23:05:43 +0000
commitb16b3120a84f1b180e874367d3101264479a595f (patch)
treea7e0c23c6f380fa49034e07c61058b3ff509a5a0 /source/main.c
parent773de5353e3b2e6e03ecb885a00ce08ef78d8558 (diff)
Development checkin
Diffstat (limited to 'source/main.c')
-rw-r--r--source/main.c85
1 files changed, 64 insertions, 21 deletions
diff --git a/source/main.c b/source/main.c
index a5f5035..a2b0565 100644
--- a/source/main.c
+++ b/source/main.c
@@ -28,6 +28,7 @@
#include "gui.h"
#include "splashimg_bin.h"
+#include "zx81_bin.h"
/* ---------------------------------------- STATIC DATA
*/
@@ -46,10 +47,12 @@ static void Splash(void)
{
"DS81 \177 2006 Ian C",
" ",
- "ZX81 ROM \177 1981",
+ "ZX81 ROM",
+ "\177 1981",
"Nine Tiles Networks LTD",
" ",
- "3D MONSTER MAZE \177 1983",
+ "3D MONSTER MAZE",
+ "\177 1983",
"Malcom E. Evans",
" ",
"PRESS A TO CONTINUE",
@@ -62,18 +65,11 @@ static void Splash(void)
sImage img;
int f;
- loadPCX(splashimg_bin,&img);
- image8to16(&img);
- dmaCopy(img.data8,BG_GFX,SCREEN_WIDTH*SCREEN_HEIGHT*2);
-
FB_Clear();
- for(f=0;f<SCREEN_HEIGHT;f++)
- {
- FB_HLine(0,SCREEN_WIDTH-1,f,FB_RGB(f/8,0,0));
- }
-
- FB_Box(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,FB_RGB(31,31,31));
+ loadPCX(splashimg_bin,&img);
+ image8to16(&img);
+ dmaCopy(img.data8,BG_GFX_SUB,SCREEN_WIDTH*SCREEN_HEIGHT*2);
for(f=0;text[f];f++)
{
@@ -91,22 +87,69 @@ static void Splash(void)
*/
int main(int argc, char *argv[])
{
+ int ch;
+ uint8 *ch_data;
+
powerON(POWER_ALL_2D);
- videoSetMode(MODE_5_2D | DISPLAY_BG2_ACTIVE);
+ /* Set up main text screen and grab the ROM character data
+ */
+ videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetBankA(VRAM_A_MAIN_BG_0x6000000);
- BG2_CR = BG_BMP16_256x256;
- BG2_XDX = 0x100;
- BG2_XDY = 0;
- BG2_YDX = 0;
- BG2_YDY = 0x100;
- BG2_CX = 0;
- BG2_CY = 0;
+ vramSetBankB(VRAM_B_MAIN_BG_0x6020000);
- videoSetModeSub(MODE_5_2D | DISPLAY_BG2_ACTIVE);
+ BG0_CR = BG_COLOR_256|BG_MAP_BASE(31)|BG_TILE_BASE(0);
+ BG0_X0 = 0;
+ BG0_Y0 = 0;
+
+ BG_PALETTE[0] = RGB15(31,31,31);
+ BG_PALETTE[1] = RGB15(0,0,0);
+ ch_data = (uint8*)BG_TILE_RAM(0);
+ for(ch=0;ch<64;ch++)
+ {
+ int r;
+
+ for(r=0;r<8;r++)
+ {
+ int b;
+ int rd;
+
+ rd=zx81_bin[0x1e00+ch*8+r];
+
+ for(b=7;b>=0;b--)
+ {
+ if (rd&(1<<b))
+ {
+ *ch_data = 1;
+ *(ch_data+4096) = 0;
+ }
+ else
+ {
+ *ch_data = 0;
+ *(ch_data+4096) = 1;
+ }
+
+ ch_data++;
+ }
+ }
+ }
+
+ {
+ uint16 *tiles;
+ tiles = (uint16*)BG_MAP_RAM(31);
+ for(ch=0;ch<128;ch++)
+ {
+ *(tiles+(ch%32)+(ch/32)*32)=ch;
+ }
+ }
+
+ /* Set up the sub-screen for rotation (basically for use as a framebuffer)
+ */
+ videoSetModeSub(MODE_5_2D | DISPLAY_BG2_ACTIVE);
vramSetBankC(VRAM_C_SUB_BG_0x6200000);
+
SUB_BG2_CR = BG_BMP16_256x256;
SUB_BG2_XDX = 0x100;
SUB_BG2_XDY = 0;