This commit is contained in:
John Bintz 2024-06-13 12:30:39 -04:00
parent 686125592a
commit 048a1270bb
8 changed files with 14 additions and 81 deletions

View File

@ -9,7 +9,7 @@ require 'rmagick'
# [ ] turn the big color counts into three bitplames worth of data # [ ] turn the big color counts into three bitplames worth of data
# [ ] turn the little color counts into up to 8 sprites worth of data strips & color changes # [ ] turn the little color counts into up to 8 sprites worth of data strips & color changes
image = Magick::Image.read('topaz.png').first image = Magick::Image.read('topaz-narrow.png').first
rows = [] rows = []
@ -263,7 +263,7 @@ module Amiga
class Util class Util
TOTAL_HEIGHT = 256 TOTAL_HEIGHT = 256
TOP_OFFSET = 44 TOP_OFFSET = 44
LEFT_OFFSET = 128 LEFT_OFFSET = 128 + 64
SPRITE_HEIGHT = TOTAL_HEIGHT + TOP_OFFSET SPRITE_HEIGHT = TOTAL_HEIGHT + TOP_OFFSET

BIN
main

Binary file not shown.

91
main.c
View File

@ -40,16 +40,6 @@ uint16_t custom_color = (uint16_t)offsetof(Custom, color);
uint16_t custom_sprite = (uint16_t)offsetof(Custom, sprpt); uint16_t custom_sprite = (uint16_t)offsetof(Custom, sprpt);
uint16_t custom_sprite_control = (uint16_t)offsetof(Custom, spr); uint16_t custom_sprite_control = (uint16_t)offsetof(Custom, spr);
uint16_t spritePositionsEachLine[256][2];
void calculageSpritePositionsEachLine() {
int i;
for (i = 0; i < 255; ++i) {
}
}
#define SPRPOS(x, y) (((y & 0xff) << 8) + ((x & 0x1fe) >> 1)) #define SPRPOS(x, y) (((y & 0xff) << 8) + ((x & 0x1fe) >> 1))
#define SPRCTL(x, y, height) ( \ #define SPRCTL(x, y, height) ( \
((height & 0xff) << 8) + \ ((height & 0xff) << 8) + \
@ -64,6 +54,10 @@ extern uint16_t chip SpriteCopperlist[];
extern uint16_t chip SpriteData[]; extern uint16_t chip SpriteData[];
extern uint16_t chip MaskBitplane[]; extern uint16_t chip MaskBitplane[];
#define TOPAZ_WIDTH_PIXELS (160)
#define TOPAZ_WIDTH_BYTES (TOPAZ_WIDTH_PIXELS / 8)
#define TOPAZ_WIDTH_WORDS (TOPAZ_WIDTH_PIXELS / 16)
void renderTopaz(void) { void renderTopaz(void) {
int plane; int plane;
@ -71,7 +65,7 @@ void renderTopaz(void) {
uint8_t *bltbpt; uint8_t *bltbpt;
bltcon0 = 0xca + (1 << 8) + (1 << 9) + (1 << 10) + (1 << 11); bltcon0 = 0xca + (1 << 8) + (1 << 9) + (1 << 10) + (1 << 11);
bltcmod = screenSetup.byteWidth - 32; bltcmod = screenSetup.byteWidth - TOPAZ_WIDTH_BYTES;
bltbpt = TopazBitplanes; bltbpt = TopazBitplanes;
for (plane = 0; plane < 3; ++plane) { for (plane = 0; plane < 3; ++plane) {
@ -81,15 +75,15 @@ void renderTopaz(void) {
custom.bltalwm = 0xffff; custom.bltalwm = 0xffff;
custom.bltapt = MaskBitplane; custom.bltapt = MaskBitplane;
custom.bltbpt = bltbpt; custom.bltbpt = bltbpt;
custom.bltcpt = currentScreen.planes[plane]; custom.bltcpt = currentScreen.planes[plane] + 8;
custom.bltdpt = currentScreen.planes[plane]; custom.bltdpt = currentScreen.planes[plane] + 8;
custom.bltamod = 0; custom.bltamod = 0;
custom.bltbmod = 0; custom.bltbmod = 0;
custom.bltcmod = bltcmod; custom.bltcmod = bltcmod;
custom.bltdmod = bltcmod; custom.bltdmod = bltcmod;
custom.bltsize = 16 + (256 << 6); custom.bltsize = TOPAZ_WIDTH_WORDS + (256 << 6);
bltbpt += 32 * 256; bltbpt += TOPAZ_WIDTH_BYTES * 256;
WaitBlit(); WaitBlit();
} }
@ -102,13 +96,6 @@ int main(void) {
struct BunRenderer bunRenderer; struct BunRenderer bunRenderer;
color_t colors[8];
colors[0] = 0x09b8;
colors[1] = 0x0000;
colors[2] = 0x0fff;
colors[3] = 0x000f;
printf("setting up, i haven't crashed...yet.\n"); printf("setting up, i haven't crashed...yet.\n");
setupScreen(&screenSetup, SCREEN_WIDTH, SCREEN_HEIGHT, 3); setupScreen(&screenSetup, SCREEN_WIDTH, SCREEN_HEIGHT, 3);
@ -131,7 +118,6 @@ int main(void) {
&currentScreen, &currentScreen,
&copperlistBitplanePointers &copperlistBitplanePointers
); );
//currentCopperlist = setUpEmptySpritesInCopperlist(currentCopperlist);
currentCopperColors = CopperColors; currentCopperColors = CopperColors;
currentSpriteCopperlist = SpriteCopperlist; currentSpriteCopperlist = SpriteCopperlist;
@ -158,6 +144,7 @@ int main(void) {
for (y = 0; y < 256; ++y) { for (y = 0; y < 256; ++y) {
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
// set sprite color
*(currentCopperlist++) = custom_color + 32 + ( *(currentCopperlist++) = custom_color + 32 + (
// sprite color group // sprite color group
(i / 2) * 4 + (i / 2) * 4 +
@ -165,12 +152,9 @@ int main(void) {
1 + 1 +
i % 2 i % 2
) * 2; ) * 2;
*(currentCopperlist++) = *(currentSpriteCopperlist++); *(currentCopperlist++) = *(currentSpriteCopperlist++);
//*(currentCopperlist++) = 0xf0f;
//currentSpriteCopperlist++;
// set sprite position
*(currentCopperlist++) = custom_sprite_control + i * 8; *(currentCopperlist++) = custom_sprite_control + i * 8;
*(currentCopperlist++) = *(currentSpriteCopperlist++); *(currentCopperlist++) = *(currentSpriteCopperlist++);
@ -185,22 +169,6 @@ int main(void) {
*(currentCopperlist++) = 1 + ((31 + (256 / 4)) << 1) + ((44 + y) << 8); *(currentCopperlist++) = 1 + ((31 + (256 / 4)) << 1) + ((44 + y) << 8);
*(currentCopperlist++) = 0xFFFE; *(currentCopperlist++) = 0xFFFE;
/*
*(currentCopperlist++) = custom_color;
*(currentCopperlist++) = 0x9b8;
*/
/*
*(currentCopperlist++) = 1 + (1 << 1) + ((44 + y) << 8);
*(currentCopperlist++) = 0xFFFE;
*/
/*
*(currentCopperlist++) = 1 + ((31 + (320 / 4)) << 1) + ((44 + y) << 8);
*(currentCopperlist++) = 0xFFFE;
*(currentCopperlist++) = custom_color;
*(currentCopperlist++) = 0x000;
*/
} }
endCopperlist(currentCopperlist); endCopperlist(currentCopperlist);
@ -212,33 +180,10 @@ int main(void) {
clearCurrentBuns(&bunRenderer); clearCurrentBuns(&bunRenderer);
/*
for (plane = 0; plane < 2; ++plane) {
custom.bltcon0 = 0xc0 + (1 << 8);
custom.bltcon1 = 0;
custom.bltadat = 0x0000;
custom.bltafwm = 0xffff;
custom.bltalwm = 0xffff;
custom.bltdpt = currentScreen.planes[plane];
custom.bltdmod = 0;
custom.bltsize = screenSetup.byteWidth / 2 + (screenSetup.height << 6);
WaitBlit();
}
*/
renderBunFrame(i, &bunRenderer); renderBunFrame(i, &bunRenderer);
renderTopaz(); renderTopaz();
/*
*/
/*
*(SpriteData) = SPRPOS(250, 44);
*(SpriteData + 1) = SPRCTL(250, 44, 44 + 257);
*/
updateDisplayInCopperList( updateDisplayInCopperList(
&screenSetup, &screenSetup,
&currentScreen, &currentScreen,
@ -246,29 +191,17 @@ int main(void) {
); );
WaitTOF(); WaitTOF();
if ((ciaa.ciapra >> 6) != 3) break; if ((ciaa.ciapra >> 6) != 3) break;
i++; i++;
i %= FRAMES_FOR_SCREEN; i %= FRAMES_FOR_SCREEN;
} }
/*
for (i = 0; i < 200; ++i) {
WaitTOF();
}
*/
giveBackSystem(); giveBackSystem();
teardownScreen(&screenSetup); teardownScreen(&screenSetup);
/*
for (i = 0; i < 50; ++i) {
printf("%x %x\n", copperlist[i * 2], copperlist[i * 2 + 1]);
}
*/
freeCopperlist(copperlist); freeCopperlist(copperlist);
teardownBunRenderer(); teardownBunRenderer();

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
topaz-narrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB