In which John learns about the playfield hardware and sprite priorities
This commit is contained in:
parent
a73506a27b
commit
3a42da655b
7
bun.c
7
bun.c
|
@ -310,6 +310,13 @@ void calculateBunPositions(
|
|||
|
||||
bunPositions[current][0] = x;
|
||||
bunPositions[current][1] = y;
|
||||
|
||||
// for the blitter video
|
||||
/*
|
||||
if (frame == 0) {
|
||||
printf("%d,%d\n", bunPositions[current][0], bunPositions[current][1]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
69
main.c
69
main.c
|
@ -27,6 +27,9 @@ extern struct CIA far ciaa;
|
|||
#define SCRATCH_AREA_HEIGHT_ROWS (34)
|
||||
#define SCRATCH_AREA_MEMORY_SIZE (SCRATCH_AREA_WIDTH_BYTES * SCRATCH_AREA_HEIGHT_ROWS)
|
||||
|
||||
// change to 0 to not render sprites
|
||||
#define RENDER_SPRITES (1)
|
||||
|
||||
volatile short *dbg = (volatile short *)0x100;
|
||||
|
||||
unsigned char *scratchArea;
|
||||
|
@ -143,38 +146,47 @@ int main(void) {
|
|||
*(currentCopperlist++) = custom_color + 4;
|
||||
*(currentCopperlist++) = 0xfff;
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
spriteDataPointer = (uint32_t)&SpriteData;
|
||||
spriteDataPointer += ((256 + 2) * 4) * i;
|
||||
if (RENDER_SPRITES) {
|
||||
for (i = 0; i < 8; ++i) {
|
||||
spriteDataPointer = (uint32_t)&SpriteData;
|
||||
spriteDataPointer += ((256 + 2) * 4) * i;
|
||||
|
||||
*(currentCopperlist++) = custom_sprite + i * 4;
|
||||
*(currentCopperlist++) = (spriteDataPointer >> 16);
|
||||
*(currentCopperlist++) = custom_sprite + i * 4;
|
||||
*(currentCopperlist++) = (spriteDataPointer >> 16);
|
||||
|
||||
*(currentCopperlist++) = custom_sprite + 2 + i * 4;
|
||||
*(currentCopperlist++) = (spriteDataPointer & 0xffff);
|
||||
*(currentCopperlist++) = custom_sprite + 2 + i * 4;
|
||||
*(currentCopperlist++) = (spriteDataPointer & 0xffff);
|
||||
}
|
||||
} else {
|
||||
printf("Skipping render\n");
|
||||
currentCopperlist = setUpEmptySpritesInCopperlist(currentCopperlist);
|
||||
}
|
||||
|
||||
*(currentCopperlist++) = custom_color;
|
||||
*(currentCopperlist++) = 0x3a6;
|
||||
|
||||
for (y = 0; y < 256; ++y) {
|
||||
for (i = 0; i < 8; ++i) {
|
||||
// set sprite color
|
||||
*(currentCopperlist++) = custom_color + 32 + (
|
||||
// sprite color group
|
||||
(i / 2) * 4 +
|
||||
// 0 is transparent
|
||||
1 +
|
||||
i % 2
|
||||
) * 2;
|
||||
*(currentCopperlist++) = *(currentSpriteCopperlist++);
|
||||
if (RENDER_SPRITES) {
|
||||
for (i = 0; i < 8; ++i) {
|
||||
// set sprite color
|
||||
*(currentCopperlist++) = custom_color + 32 + (
|
||||
// sprite color group
|
||||
(i / 2) * 4 +
|
||||
// 0 is transparent
|
||||
1 +
|
||||
i % 2
|
||||
) * 2;
|
||||
*(currentCopperlist++) = *(currentSpriteCopperlist++);
|
||||
|
||||
// set sprite position
|
||||
*(currentCopperlist++) = custom_sprite_control + i * 8;
|
||||
*(currentCopperlist++) = *(currentSpriteCopperlist++);
|
||||
// set sprite position
|
||||
*(currentCopperlist++) = custom_sprite_control + i * 8;
|
||||
*(currentCopperlist++) = *(currentSpriteCopperlist++);
|
||||
|
||||
*(currentCopperlist++) = custom_sprite_control + i * 8 + 2;
|
||||
*(currentCopperlist++) = *(currentSpriteCopperlist++);
|
||||
*(currentCopperlist++) = custom_sprite_control + i * 8 + 2;
|
||||
*(currentCopperlist++) = *(currentSpriteCopperlist++);
|
||||
}
|
||||
} else {
|
||||
printf("Skipping render\n");
|
||||
}
|
||||
|
||||
for (i = 3; i < 8; ++i) {
|
||||
|
@ -188,6 +200,19 @@ int main(void) {
|
|||
|
||||
endCopperlist(currentCopperlist);
|
||||
|
||||
/*
|
||||
copperlist debugging
|
||||
for (i = 0; i < 20; ++i) {
|
||||
printf(
|
||||
"%x %x %x %x\n",
|
||||
*(copperlist + (i * 4)),
|
||||
*(copperlist + (i * 4) + 1),
|
||||
*(copperlist + (i * 4) + 2),
|
||||
*(copperlist + (i * 4) + 3)
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
takeOverSystem();
|
||||
|
||||
setCopperlist(copperlist);
|
||||
|
|
|
@ -360,7 +360,8 @@ _setUpDisplay:
|
|||
MOVE.W D0,bplcon0(A1)
|
||||
|
||||
MOVE.W #0,bplcon1(A1)
|
||||
MOVE.W #0,bplcon2(A1)
|
||||
; sprites always on top
|
||||
MOVE.W #$0020,bplcon2(A1)
|
||||
MOVE.W #0,bpl1mod(A1)
|
||||
MOVE.W #0,bpl2mod(A1)
|
||||
MOVE.W #$2c81,diwstrt(A1)
|
||||
|
|
Loading…
Reference in New Issue