mirror of
https://github.com/dwsJason/xrick2gs.git
synced 2024-09-28 05:56:40 +00:00
Fixes for the Hall of Fame, Direct Export the Xrick Splash into a C1 so that B2S doesn't screw up the palette, now we can see the the compiled tiles render
This commit is contained in:
parent
5ecc2034c8
commit
19dfb38262
@ -28,20 +28,26 @@ iTileNo equ 7
|
|||||||
|
|
||||||
anop ; adjust the stack
|
anop ; adjust the stack
|
||||||
anop ; Copy the Return address
|
anop ; Copy the Return address
|
||||||
lda 1,s
|
|
||||||
sta iTileNo-2,s
|
|
||||||
lda 3,s
|
lda 3,s
|
||||||
sta iTileNo,s
|
sta iTileNo,s
|
||||||
|
lda 1,s
|
||||||
|
sta iTileNo-2,s
|
||||||
|
|
||||||
pla
|
pla
|
||||||
|
|
||||||
lda #$0101
|
lda #$0101
|
||||||
sta 1,s
|
sta 1,s
|
||||||
plb
|
plb
|
||||||
plb
|
plb
|
||||||
TILEBANK gequ *
|
TILEBANK2 entry
|
||||||
|
lda >$880005,x
|
||||||
|
sta >TILEBANK+1
|
||||||
|
|
||||||
|
TILEBANK entry
|
||||||
jsl >$880000
|
jsl >$880000
|
||||||
|
|
||||||
plb
|
plb
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
*-------------------------------------------------------------------------------
|
*-------------------------------------------------------------------------------
|
||||||
@ -53,6 +59,7 @@ iBank equ 4
|
|||||||
sep #$30
|
sep #$30
|
||||||
lda iBank,s
|
lda iBank,s
|
||||||
sta >TILEBANK+3
|
sta >TILEBANK+3
|
||||||
|
sta >TILEBANK2+3
|
||||||
rep #$30
|
rep #$30
|
||||||
lda 2,s
|
lda 2,s
|
||||||
sta iBank,s
|
sta iBank,s
|
||||||
|
@ -69,6 +69,67 @@ void savePixelsGS(MYBMP *pBitmap, const char* pFilename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
void savePixelsGSc1(MYBMP *pBitmap, const char* pFilename)
|
||||||
|
{
|
||||||
|
FILE* gsfile = fopen( pFilename, "wb" );
|
||||||
|
|
||||||
|
if (gsfile)
|
||||||
|
{
|
||||||
|
unsigned char* pPixels = pBitmap->map;
|
||||||
|
|
||||||
|
for (int y = 0; y < pBitmap->height; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < pBitmap->width; x+=2)
|
||||||
|
{
|
||||||
|
unsigned char* pPixel = pPixels + (y*pBitmap->width) + x;
|
||||||
|
|
||||||
|
unsigned char GS_PIXEL = 0;
|
||||||
|
GS_PIXEL = (pPixel[0] << 4) | (pPixel[1] & 0xF);
|
||||||
|
putc(GS_PIXEL, gsfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int idx = 0; idx < 256; ++idx)
|
||||||
|
{
|
||||||
|
putc(0, gsfile); // SCBs + Screen holes
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int palnum = 0; palnum < 16; ++palnum)
|
||||||
|
{
|
||||||
|
for (int idx = 0; idx < 16; idx++)
|
||||||
|
{
|
||||||
|
u16 pixel = 0;
|
||||||
|
|
||||||
|
u16 red = pBitmap->palette[ (idx * 3)+0 ];
|
||||||
|
u16 green = pBitmap->palette[ (idx * 3)+1 ];
|
||||||
|
u16 blue = pBitmap->palette[ (idx * 3)+2 ];
|
||||||
|
|
||||||
|
red>>=4;
|
||||||
|
green>>=4;
|
||||||
|
blue>>=4;
|
||||||
|
|
||||||
|
pixel |= red << 8;
|
||||||
|
pixel |= green << 4;
|
||||||
|
pixel |= blue;
|
||||||
|
|
||||||
|
putc(pixel & 0xff, gsfile);
|
||||||
|
putc(pixel >> 8, gsfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(gsfile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr,"\nERROR Unable to create output file: %s\n", pFilename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save the RawBMP Data as a PNG
|
// Save the RawBMP Data as a PNG
|
||||||
//
|
//
|
||||||
@ -412,6 +473,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
pBitmap = loadPic( pic_splash, 320, 200 );
|
pBitmap = loadPic( pic_splash, 320, 200 );
|
||||||
savePng(pBitmap, "splash.png");
|
savePng(pBitmap, "splash.png");
|
||||||
|
savePixelsGSc1(pBitmap, "splash.c1");
|
||||||
|
|
||||||
pBitmap = loadImage( IMG_SPLASH );
|
pBitmap = loadImage( IMG_SPLASH );
|
||||||
savePng(pBitmap, "img_splash.png");
|
savePng(pBitmap, "img_splash.png");
|
||||||
|
25
data.bat
25
data.bat
@ -6,32 +6,11 @@ rem
|
|||||||
|
|
||||||
echo Y |del data.lib
|
echo Y |del data.lib
|
||||||
|
|
||||||
if exist "bmp" (
|
|
||||||
echo Y |del bmp\*
|
|
||||||
rmdir bmp
|
|
||||||
)
|
|
||||||
|
|
||||||
rem
|
|
||||||
rem bmp directory if it doesn't exist
|
|
||||||
rem
|
|
||||||
if not exist "bmp" (
|
|
||||||
mkdir bmp
|
|
||||||
)
|
|
||||||
|
|
||||||
rem
|
|
||||||
rem convert all the pngs to bmp
|
|
||||||
rem
|
|
||||||
png2bmp -D bmp data\pics\*.png
|
|
||||||
rem
|
|
||||||
rem for now just convert the splash screen, to GS format
|
|
||||||
rem
|
|
||||||
b2s bmp\splash.bmp
|
|
||||||
b2s bmp\img_splash16.bmp
|
|
||||||
rem
|
rem
|
||||||
rem Compress the title page
|
rem Compress the title page
|
||||||
rem
|
rem
|
||||||
lz4 -c2 bmp\splash.SHR#C10000 data\splash.lz4
|
lz4 -c2 data\pics\splash.c1 data\splash.lz4
|
||||||
lz4 -c2 bmp\img_splash16.SHR#C10000 data\img_splash16.lz4
|
lz4 -c2 data\pics\img_splash.c1 data\img_splash16.lz4
|
||||||
rem
|
rem
|
||||||
rem Hall of Fame
|
rem Hall of Fame
|
||||||
rem
|
rem
|
||||||
|
BIN
data/pics/img_splash.c1
Normal file
BIN
data/pics/img_splash.c1
Normal file
Binary file not shown.
BIN
data/pics/splash.c1
Normal file
BIN
data/pics/splash.c1
Normal file
Binary file not shown.
@ -88,7 +88,7 @@ extern void sys_sleep(int);
|
|||||||
*/
|
*/
|
||||||
#define SYSVID_ZOOM 2
|
#define SYSVID_ZOOM 2
|
||||||
#define SYSVID_MAXZOOM 4
|
#define SYSVID_MAXZOOM 4
|
||||||
#ifdef GS
|
#ifdef IIGS
|
||||||
#define SYSVID_WIDTH 160
|
#define SYSVID_WIDTH 160
|
||||||
#else
|
#else
|
||||||
#define SYSVID_WIDTH 320
|
#define SYSVID_WIDTH 320
|
||||||
@ -180,7 +180,7 @@ extern volatile unsigned long* tick;
|
|||||||
|
|
||||||
// GS Rendering Stuff
|
// GS Rendering Stuff
|
||||||
extern void SetTileBank(short bank);
|
extern void SetTileBank(short bank);
|
||||||
extern void DrawTile(short offset, short tileNo);
|
extern void DrawTile(int offset, int tileNo);
|
||||||
|
|
||||||
// ADB Support Code
|
// ADB Support Code
|
||||||
extern char KeyArray[128];
|
extern char KeyArray[128];
|
||||||
|
@ -111,7 +111,7 @@ static U8 *fb; /* frame buffer pointer */
|
|||||||
void
|
void
|
||||||
draw_setfb(U16 x, U16 y)
|
draw_setfb(U16 x, U16 y)
|
||||||
{
|
{
|
||||||
#ifdef GSGFX
|
#ifdef IIGS
|
||||||
fb = sysvid_fb + (x>>1) + (y * SYSVID_WIDTH);
|
fb = sysvid_fb + (x>>1) + (y * SYSVID_WIDTH);
|
||||||
#else
|
#else
|
||||||
fb = sysvid_fb + x + y * SYSVID_WIDTH;
|
fb = sysvid_fb + x + y * SYSVID_WIDTH;
|
||||||
@ -242,7 +242,10 @@ draw_tile(U8 tileNumber)
|
|||||||
|
|
||||||
int tileNo = (draw_tilesBank*256)+tileNumber;
|
int tileNo = (draw_tilesBank*256)+tileNumber;
|
||||||
|
|
||||||
DrawTile((short)fb,tileNo);
|
//printf("fb=%04x tileNo=%04x\n", (int)fb, tileNo);
|
||||||
|
//sys_sleep(1000); // Wait 1 second
|
||||||
|
|
||||||
|
DrawTile(((int)fb),tileNo);
|
||||||
|
|
||||||
fb += 4; /* next tile */
|
fb += 4; /* next tile */
|
||||||
#else
|
#else
|
||||||
|
15
src/sysvid.c
15
src/sysvid.c
@ -226,8 +226,8 @@ sysvid_init(void)
|
|||||||
{
|
{
|
||||||
#ifdef IIGS
|
#ifdef IIGS
|
||||||
handle hndl; // "generic memory handle"
|
handle hndl; // "generic memory handle"
|
||||||
void* directPageHandle;
|
U32* directPageHandle;
|
||||||
void* tilesPageHandle;
|
U32* tilesPageHandle;
|
||||||
|
|
||||||
// PushLong #0 ;/* Ask Shadowing Screen ($8000 bytes from $01/2000)*/
|
// PushLong #0 ;/* Ask Shadowing Screen ($8000 bytes from $01/2000)*/
|
||||||
// PushLong #$8000
|
// PushLong #$8000
|
||||||
@ -270,7 +270,7 @@ sysvid_init(void)
|
|||||||
|
|
||||||
// Allocate Some Direct Page memory
|
// Allocate Some Direct Page memory
|
||||||
printf("Allocate Direct Page space 512 bytes\n");
|
printf("Allocate Direct Page space 512 bytes\n");
|
||||||
directPageHandle = NewHandle( 0x200, userid(), 0xC005, 0 );
|
directPageHandle = (U32*)NewHandle( 0x200, userid(), 0xC005, 0 );
|
||||||
if (toolerror())
|
if (toolerror())
|
||||||
{
|
{
|
||||||
printf("Unable to allocate 512 bytes Direct Page\n");
|
printf("Unable to allocate 512 bytes Direct Page\n");
|
||||||
@ -282,7 +282,7 @@ sysvid_init(void)
|
|||||||
|
|
||||||
//BlitFieldHndl = NewHandle(0x10000, userid(), 0xC014, 0);
|
//BlitFieldHndl = NewHandle(0x10000, userid(), 0xC014, 0);
|
||||||
printf("Allocate Bank for 8x8 Tiles\n");
|
printf("Allocate Bank for 8x8 Tiles\n");
|
||||||
tilesPageHandle = NewHandle(0x10000, userid(), 0xC014, 0);
|
tilesPageHandle = (U32*)NewHandle(0x10000, userid(), 0xC014, 0);
|
||||||
if (toolerror())
|
if (toolerror())
|
||||||
{
|
{
|
||||||
printf("Unable to allocate 64k Tiles Bank\n");
|
printf("Unable to allocate 64k Tiles Bank\n");
|
||||||
@ -291,13 +291,14 @@ sysvid_init(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
printf("SUCCESS\n");
|
printf("SUCCESS\n");
|
||||||
SetTileBank(((U8*)*tilesPageHandle)[2]);
|
SetTileBank((*tilesPageHandle)>>16);
|
||||||
|
|
||||||
LZ4_Unpack((char*)*tilesPageHandle, &tiles_lz4);
|
LZ4_Unpack((char*)*tilesPageHandle, &tiles_lz4);
|
||||||
|
|
||||||
sysvid_fb = (U8*)0x12000;
|
sysvid_fb = (U8*)0x12000;
|
||||||
|
|
||||||
// SHR ON
|
// SHR ON
|
||||||
//*VIDEO_REGISTER|=0xC0;
|
*VIDEO_REGISTER|=0xC0;
|
||||||
|
|
||||||
// ENABLE Shadowing of SHR
|
// ENABLE Shadowing of SHR
|
||||||
*SHADOW_REGISTER&=~0x08; // Shadow Enable
|
*SHADOW_REGISTER&=~0x08; // Shadow Enable
|
||||||
@ -505,7 +506,7 @@ sysvid_clear(void)
|
|||||||
#ifndef IIGS
|
#ifndef IIGS
|
||||||
memset(sysvid_fb, 0, SYSVID_WIDTH * SYSVID_HEIGHT);
|
memset(sysvid_fb, 0, SYSVID_WIDTH * SYSVID_HEIGHT);
|
||||||
#else
|
#else
|
||||||
size_t length = SYSVID_WIDTH /2 * SYSVID_HEIGHT;
|
size_t length = SYSVID_WIDTH * SYSVID_HEIGHT;
|
||||||
//printf("sysvid_clear: target = %08p\n", sysvid_fb);
|
//printf("sysvid_clear: target = %08p\n", sysvid_fb);
|
||||||
//printf("sysvid_clear: length = %08p\n", length);
|
//printf("sysvid_clear: length = %08p\n", length);
|
||||||
//sys_sleep(10000);
|
//sys_sleep(10000);
|
||||||
|
Loading…
Reference in New Issue
Block a user