cool-bun-demo/main.c

115 lines
2.6 KiB
C

#include <stdio.h>
#include <clib/exec_protos.h>
#include <clib/graphics_protos.h>
#include <exec/exec.h>
#include <hardware/custom.h>
#include <hardware/dmabits.h>
#include "blitter.h"
#include "copper.h"
#include "screen.h"
#include "types.h"
#include "system.h"
extern struct Custom far custom;
void writeSomethingToScreen(struct ScreenSetup *screenSetup) {
*(screenSetup->memoryStart) = 255;
*(screenSetup->memoryStart + 8) = 0xAA;
*(screenSetup->memoryStart + 16) = 0xF0;
*(screenSetup->memoryStart + SCREEN_WIDTH * SCREEN_HEIGHT / 8 + 4) = 255;
}
int main(void) {
struct ScreenSetup screenSetup;
uint16_t *copperlist, *currentCopperlist;
int i, result;
color_t colors[16];
struct BlitDrawLineSetup setup;
struct BlitAreaDetails blitAreaDetails, sourceBlitCopyDetails;
unsigned char *polygonScratchArea;
colors[0] = 0x0200;
colors[1] = 0x0f00;
colors[2] = 0x0f0f;
colors[3] = 0x000f;
prepareScreen(&screenSetup, SCREEN_WIDTH, SCREEN_HEIGHT, 4);
allocateScreenMemory(&screenSetup);
blit_fillAreaDetailsFromScreenSetup(
&screenSetup,
&blitAreaDetails
);
blit_fillAreaDetailsFromScreenSetup(
&screenSetup,
&sourceBlitCopyDetails
);
polygonScratchArea = AllocMem(SCREEN_WIDTH * SCREEN_HEIGHT / 8, MEMF_CHIP | MEMF_CLEAR);
// blitter copy the first bitplane row down to the second
copperlist = prepareNewCopperlist();
takeOverSystem();
setCopperlist(copperlist);
setUpDisplay(&screenSetup);
currentCopperlist = addDisplayToCopperlist(copperlist, &screenSetup);
currentCopperlist = addColorsToCopperlist(currentCopperlist, colors, 16);
endCopperlist(currentCopperlist);
// blit a line to the scratch area
// blit the scratch area over
/*
blit_drawLine(&blitAreaDetails, &setup, 0, 0, 0, 40, 1);
blit_drawLine(&blitAreaDetails, &setup, 1, 0, 1, 40, 3);
blit_drawLine(&blitAreaDetails, &setup, 15, 0, 15, 40, 3);
*/
//blit_drawLine(&blitAreaDetails, &setup, 16, 10, 16, 40, 3);
//blit_drawLine(&blitAreaDetails, &setup, 50, 10, 50, 40, 1);
//blit_drawLine(&blitAreaDetails, &setup, 79, 80, 79, 120, 3);
blit_howDoesFWMandLWMWork(&blitAreaDetails);
WaitBlit();
/*
blit_copyOneToOne(
&blitAreaDetails,
&blitAreaDetails,
1, 0, 24, 16, 80, 80
);
*/
for (i = 0; i < 200; ++i) {
WaitTOF();
}
giveBackSystem();
freeScreenMemory(&screenSetup);
freeCopperlist(copperlist);
FreeMem(polygonScratchArea, SCREEN_WIDTH * SCREEN_HEIGHT / 8);
printf("Hello from C\n");
printf("%d %d\n", setup.dx, setup.dy);
printf("%d %d %d\n", setup.sud, setup.sul, setup.aul);
printf("%d %d\n", setup.accumulator, setup.sign);
return 0;
}