diff --git a/bun.c b/bun.c index 20ed093..52b05e6 100644 --- a/bun.c +++ b/bun.c @@ -39,9 +39,7 @@ #define BUN_WAVE_LENGTH (FRAMES_FOR_SCREEN / 2) // linked as raw bytes in assembler -extern unsigned char far coolbun[]; - -unsigned char *coolbunArea = 0; +extern unsigned char chip coolbun[]; #define BLTCON0( \ minterm, aChan, bChan, cChan, dChan, shift \ @@ -51,19 +49,9 @@ unsigned char *coolbunArea = 0; extern struct Custom far custom; void setupBun(void) { - unsigned char *currentCoolBunArea, *currentCoolBun; - - coolbunArea = AllocMem(COOL_BUN_MEMORY_SIZE, MEMF_CHIP | MEMF_CLEAR); - currentCoolBunArea = coolbunArea; - currentCoolBun = coolbun; - - CopyMem(coolbun, coolbunArea, COOL_BUN_MEMORY_SIZE); } void teardownBun(void) { - if (coolbunArea) { - FreeMem(coolbunArea, COOL_BUN_MEMORY_SIZE); - } } #define BLITTER_ASCENDING (0) @@ -361,9 +349,9 @@ void precalculeBunRenderInfo(void) { int plane; for (plane = 0; plane < 2; ++plane) { - coolbunPlaneStarts[BUN_OFF_LEFT_SIDE][plane] = coolbunArea + plane * COOL_BUN_PLANE_SIZE; - coolbunPlaneStarts[BUN_ANYWHERE][plane] = coolbunArea + plane * COOL_BUN_PLANE_SIZE; - coolbunPlaneStarts[BUN_OFF_RIGHT_SIDE][plane] = coolbunArea + 2 + + coolbunPlaneStarts[BUN_OFF_LEFT_SIDE][plane] = coolbun + plane * COOL_BUN_PLANE_SIZE; + coolbunPlaneStarts[BUN_ANYWHERE][plane] = coolbun + plane * COOL_BUN_PLANE_SIZE; + coolbunPlaneStarts[BUN_OFF_RIGHT_SIDE][plane] = coolbun + 2 + COOL_BUN_LAST_ROW_BYTES + plane * COOL_BUN_PLANE_SIZE; } diff --git a/images.s b/images.s index ffbad83..a9be48c 100644 --- a/images.s +++ b/images.s @@ -5,12 +5,11 @@ XDEF _SpriteData XDEF _MaskBitplane + SECTION Topaz,Data_C _coolbun: INCBIN "images/bun small.raw" CNOP 0,4 - - SECTION Topaz,Data_C _TopazBitplanes: INCBIN "topaz-bitplane" diff --git a/main b/main index 922be80..660f09c 100755 Binary files a/main and b/main differ diff --git a/main.c b/main.c index 2b970b1..5be08e9 100644 --- a/main.c +++ b/main.c @@ -96,7 +96,27 @@ int main(void) { struct BunRenderer bunRenderer; - printf("setting up, i haven't crashed...yet.\n"); + printf("\nCool bun blitter, copper, and sprite demo by John Bintz\n"); + printf("\n"); + printf("This is my first real go at writing graphics code for the Amiga.\n"); + printf("It's a combination of C (SAS/C) and Assembler (DevPac), with a Ruby\n"); + printf("script to do some image processing. The screen only uses three\n"); + printf("bitplanes -- one color is the background, two colors are the flying\n"); + printf("cool bun logo white and black, and the remaining 5 colors are used\n"); + printf("by the Topaz smiling art. The Ruby script will process the PNG file\n"); + printf("and figure out the best 5 colors (plus b&w) for that line of the\n"); + printf("image, setting the colors via copperlist for that line.\n"); + printf("It also builds the clipping mask for the blitter.\n\n"); + + printf("And, I'm also using sprites to add more colors to the Topaz art.\n"); + printf("The Ruby script will figure out what small areas of each line weren't\n"); + printf("covered by the bitplane colors and use the 8 available sprites,\n"); + printf("changing the colors on each line via copper, to fill in the gaps.\n"); + printf("Cool buns are animated via blitter rather than sprites, but I\n"); + printf("managed to get it to run at a decent speed regardless.\n"); + + printf("\nEnjoy, and thanks for watching!\n"); + printf("John (theindustriousrabbit.com)\n\n"); setupScreen(&screenSetup, SCREEN_WIDTH, SCREEN_HEIGHT, 3); setupInitialCurrentScreen(&screenSetup, ¤tScreen); @@ -107,11 +127,6 @@ int main(void) { copperlist = prepareNewCopperlist(); - takeOverSystem(); - - setCopperlist(copperlist); - setUpDisplay((uint32_t)screenSetup.bitplanes); - currentCopperlist = addDisplayToCopperlist( copperlist, &screenSetup, @@ -173,6 +188,11 @@ int main(void) { endCopperlist(currentCopperlist); + takeOverSystem(); + + setCopperlist(copperlist); + setUpDisplay((uint32_t)screenSetup.bitplanes); + i = 0; while (1) { @@ -190,7 +210,7 @@ int main(void) { copperlistBitplanePointers ); - WaitTOF(); + WaitBOF(250); if ((ciaa.ciapra >> 6) != 3) break;