some text stuff, pending cleanup

This commit is contained in:
John Bintz 2024-06-14 09:16:01 -04:00
parent 048a1270bb
commit 22a0359536
4 changed files with 32 additions and 25 deletions

20
bun.c
View File

@ -39,9 +39,7 @@
#define BUN_WAVE_LENGTH (FRAMES_FOR_SCREEN / 2) #define BUN_WAVE_LENGTH (FRAMES_FOR_SCREEN / 2)
// linked as raw bytes in assembler // linked as raw bytes in assembler
extern unsigned char far coolbun[]; extern unsigned char chip coolbun[];
unsigned char *coolbunArea = 0;
#define BLTCON0( \ #define BLTCON0( \
minterm, aChan, bChan, cChan, dChan, shift \ minterm, aChan, bChan, cChan, dChan, shift \
@ -51,19 +49,9 @@ unsigned char *coolbunArea = 0;
extern struct Custom far custom; extern struct Custom far custom;
void setupBun(void) { 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) { void teardownBun(void) {
if (coolbunArea) {
FreeMem(coolbunArea, COOL_BUN_MEMORY_SIZE);
}
} }
#define BLITTER_ASCENDING (0) #define BLITTER_ASCENDING (0)
@ -361,9 +349,9 @@ void precalculeBunRenderInfo(void) {
int plane; int plane;
for (plane = 0; plane < 2; ++plane) { for (plane = 0; plane < 2; ++plane) {
coolbunPlaneStarts[BUN_OFF_LEFT_SIDE][plane] = coolbunArea + plane * COOL_BUN_PLANE_SIZE; coolbunPlaneStarts[BUN_OFF_LEFT_SIDE][plane] = coolbun + plane * COOL_BUN_PLANE_SIZE;
coolbunPlaneStarts[BUN_ANYWHERE][plane] = coolbunArea + plane * COOL_BUN_PLANE_SIZE; coolbunPlaneStarts[BUN_ANYWHERE][plane] = coolbun + plane * COOL_BUN_PLANE_SIZE;
coolbunPlaneStarts[BUN_OFF_RIGHT_SIDE][plane] = coolbunArea + 2 + coolbunPlaneStarts[BUN_OFF_RIGHT_SIDE][plane] = coolbun + 2 +
COOL_BUN_LAST_ROW_BYTES + COOL_BUN_LAST_ROW_BYTES +
plane * COOL_BUN_PLANE_SIZE; plane * COOL_BUN_PLANE_SIZE;
} }

View File

@ -5,12 +5,11 @@
XDEF _SpriteData XDEF _SpriteData
XDEF _MaskBitplane XDEF _MaskBitplane
SECTION Topaz,Data_C
_coolbun: _coolbun:
INCBIN "images/bun small.raw" INCBIN "images/bun small.raw"
CNOP 0,4 CNOP 0,4
SECTION Topaz,Data_C
_TopazBitplanes: _TopazBitplanes:
INCBIN "topaz-bitplane" INCBIN "topaz-bitplane"

BIN
main

Binary file not shown.

34
main.c
View File

@ -96,7 +96,27 @@ int main(void) {
struct BunRenderer bunRenderer; 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); setupScreen(&screenSetup, SCREEN_WIDTH, SCREEN_HEIGHT, 3);
setupInitialCurrentScreen(&screenSetup, &currentScreen); setupInitialCurrentScreen(&screenSetup, &currentScreen);
@ -107,11 +127,6 @@ int main(void) {
copperlist = prepareNewCopperlist(); copperlist = prepareNewCopperlist();
takeOverSystem();
setCopperlist(copperlist);
setUpDisplay((uint32_t)screenSetup.bitplanes);
currentCopperlist = addDisplayToCopperlist( currentCopperlist = addDisplayToCopperlist(
copperlist, copperlist,
&screenSetup, &screenSetup,
@ -173,6 +188,11 @@ int main(void) {
endCopperlist(currentCopperlist); endCopperlist(currentCopperlist);
takeOverSystem();
setCopperlist(copperlist);
setUpDisplay((uint32_t)screenSetup.bitplanes);
i = 0; i = 0;
while (1) { while (1) {
@ -190,7 +210,7 @@ int main(void) {
copperlistBitplanePointers copperlistBitplanePointers
); );
WaitTOF(); WaitBOF(250);
if ((ciaa.ciapra >> 6) != 3) break; if ((ciaa.ciapra >> 6) != 3) break;