2024-09-22 12:12:37 +00:00
|
|
|
/**
|
|
|
|
* What do we need
|
|
|
|
* * [ ] screen setup
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <hardware/custom.h>
|
2024-09-26 21:32:04 +00:00
|
|
|
#include <hardware/cia.h>
|
|
|
|
|
|
|
|
#include <clib/graphics_protos.h>
|
2024-09-22 12:12:37 +00:00
|
|
|
|
|
|
|
#include "system/system.h"
|
|
|
|
#include "system/copper.h"
|
2024-09-26 21:32:04 +00:00
|
|
|
#include "system/blitter.h"
|
2024-09-22 12:12:37 +00:00
|
|
|
|
|
|
|
#include "screen.h"
|
|
|
|
|
|
|
|
extern struct Custom far custom;
|
2024-09-26 21:32:04 +00:00
|
|
|
extern struct CIA far ciaa;
|
2024-09-22 12:12:37 +00:00
|
|
|
|
|
|
|
uint16_t custom_color = (uint16_t)offsetof(Custom, color);
|
|
|
|
uint16_t custom_sprite = (uint16_t)offsetof(Custom, sprpt);
|
|
|
|
uint16_t custom_sprite_control = (uint16_t)offsetof(Custom, spr);
|
|
|
|
|
2024-09-26 21:32:04 +00:00
|
|
|
extern unsigned char chip coolbun[];
|
|
|
|
|
2024-09-22 12:12:37 +00:00
|
|
|
int main(void) {
|
|
|
|
struct ScreenDefinition screenDefinition;
|
|
|
|
struct ActiveScreenBufferDetails activeScreenBufferDetails;
|
|
|
|
uint16_t *copperlist, *currentCopperlist;
|
|
|
|
void *copperlistBitplanePointers[8][2];
|
2024-09-26 21:32:04 +00:00
|
|
|
int i, plane;
|
2024-09-22 12:12:37 +00:00
|
|
|
|
|
|
|
allocateDoubleBufferedScreenMemory(
|
|
|
|
&screenDefinition,
|
|
|
|
&activeScreenBufferDetails,
|
|
|
|
320,
|
|
|
|
256,
|
|
|
|
2
|
|
|
|
);
|
|
|
|
|
|
|
|
copperlist = prepareNewCopperlist(300);
|
|
|
|
|
|
|
|
currentCopperlist = addDisplayToCopperlist(
|
|
|
|
copperlist,
|
|
|
|
&screenDefinition,
|
|
|
|
&activeScreenBufferDetails,
|
|
|
|
&copperlistBitplanePointers
|
|
|
|
);
|
|
|
|
|
|
|
|
COPPERLIST_MOVE(currentCopperlist, custom_color, 0x3a6);
|
|
|
|
COPPERLIST_MOVE(currentCopperlist, custom_color + 2, 0x000);
|
|
|
|
COPPERLIST_MOVE(currentCopperlist, custom_color + 4, 0xfff);
|
2024-09-26 21:32:04 +00:00
|
|
|
currentCopperlist = setUpEmptySpritesInCopperlist(currentCopperlist);
|
2024-09-22 12:12:37 +00:00
|
|
|
|
|
|
|
endCopperlist(currentCopperlist);
|
|
|
|
|
|
|
|
takeOverSystem();
|
|
|
|
|
|
|
|
setCopperlist(copperlist);
|
|
|
|
setUpDisplay((uint32_t)screenDefinition.bitplanes);
|
|
|
|
|
2024-09-26 21:32:04 +00:00
|
|
|
// Render a bun at 32x50
|
|
|
|
|
|
|
|
for (plane = 0; plane < 2; ++plane) {
|
|
|
|
custom.bltcon0 = BLTCON0(0xf0, 1, 0, 0, 1, 0);
|
|
|
|
custom.bltcon1 = BLTCON1(BLITTER_ASCENDING, 0);
|
|
|
|
|
|
|
|
custom.bltapt = coolbun + (plane * 4 * 32);
|
|
|
|
custom.bltdpt = activeScreenBufferDetails.planes[plane] + (50 * 320 / 8) + 32 / 8;
|
|
|
|
custom.bltafwm = 0xffff;
|
|
|
|
custom.bltalwm = 0xffff;
|
|
|
|
|
|
|
|
custom.bltamod = 0;
|
|
|
|
custom.bltdmod = 40 - 4;
|
|
|
|
|
|
|
|
custom.bltsize = 2 + (32 << 6);
|
|
|
|
|
|
|
|
WaitBlit();
|
|
|
|
}
|
2024-09-22 12:12:37 +00:00
|
|
|
|
2024-09-26 21:32:04 +00:00
|
|
|
while (1) {
|
|
|
|
if ((ciaa.ciapra >> 6) != 3) break;
|
2024-09-22 12:12:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
giveBackSystem();
|
|
|
|
|
|
|
|
freeCopperlist(copperlist);
|
|
|
|
|
|
|
|
teardownScreen(&screenDefinition);
|
|
|
|
}
|