diff --git a/image_converter.rb b/image_converter.rb index f1594d0..79267d5 100755 --- a/image_converter.rb +++ b/image_converter.rb @@ -9,7 +9,7 @@ require 'rmagick' # [ ] 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 -image = Magick::Image.read('topaz.png').first +image = Magick::Image.read('topaz-narrow.png').first rows = [] @@ -263,7 +263,7 @@ module Amiga class Util TOTAL_HEIGHT = 256 TOP_OFFSET = 44 - LEFT_OFFSET = 128 + LEFT_OFFSET = 128 + 64 SPRITE_HEIGHT = TOTAL_HEIGHT + TOP_OFFSET diff --git a/main b/main index d6fc5e4..922be80 100755 Binary files a/main and b/main differ diff --git a/main.c b/main.c index 18351d5..2b970b1 100644 --- a/main.c +++ b/main.c @@ -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_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 SPRCTL(x, y, height) ( \ ((height & 0xff) << 8) + \ @@ -64,6 +54,10 @@ extern uint16_t chip SpriteCopperlist[]; extern uint16_t chip SpriteData[]; 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) { int plane; @@ -71,7 +65,7 @@ void renderTopaz(void) { uint8_t *bltbpt; bltcon0 = 0xca + (1 << 8) + (1 << 9) + (1 << 10) + (1 << 11); - bltcmod = screenSetup.byteWidth - 32; + bltcmod = screenSetup.byteWidth - TOPAZ_WIDTH_BYTES; bltbpt = TopazBitplanes; for (plane = 0; plane < 3; ++plane) { @@ -81,15 +75,15 @@ void renderTopaz(void) { custom.bltalwm = 0xffff; custom.bltapt = MaskBitplane; custom.bltbpt = bltbpt; - custom.bltcpt = currentScreen.planes[plane]; - custom.bltdpt = currentScreen.planes[plane]; + custom.bltcpt = currentScreen.planes[plane] + 8; + custom.bltdpt = currentScreen.planes[plane] + 8; custom.bltamod = 0; custom.bltbmod = 0; custom.bltcmod = 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(); } @@ -102,13 +96,6 @@ int main(void) { 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"); setupScreen(&screenSetup, SCREEN_WIDTH, SCREEN_HEIGHT, 3); @@ -131,7 +118,6 @@ int main(void) { ¤tScreen, &copperlistBitplanePointers ); - //currentCopperlist = setUpEmptySpritesInCopperlist(currentCopperlist); currentCopperColors = CopperColors; currentSpriteCopperlist = SpriteCopperlist; @@ -158,6 +144,7 @@ int main(void) { 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 + @@ -165,12 +152,9 @@ int main(void) { 1 + i % 2 ) * 2; - *(currentCopperlist++) = *(currentSpriteCopperlist++); - //*(currentCopperlist++) = 0xf0f; - - //currentSpriteCopperlist++; + // set sprite position *(currentCopperlist++) = custom_sprite_control + i * 8; *(currentCopperlist++) = *(currentSpriteCopperlist++); @@ -185,22 +169,6 @@ int main(void) { *(currentCopperlist++) = 1 + ((31 + (256 / 4)) << 1) + ((44 + y) << 8); *(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); @@ -212,33 +180,10 @@ int main(void) { 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); renderTopaz(); - /* - */ - - - /* - *(SpriteData) = SPRPOS(250, 44); - *(SpriteData + 1) = SPRCTL(250, 44, 44 + 257); - */ - updateDisplayInCopperList( &screenSetup, ¤tScreen, @@ -246,29 +191,17 @@ int main(void) { ); WaitTOF(); - + if ((ciaa.ciapra >> 6) != 3) break; i++; i %= FRAMES_FOR_SCREEN; } - /* - for (i = 0; i < 200; ++i) { - WaitTOF(); - } - */ - giveBackSystem(); teardownScreen(&screenSetup); - /* - for (i = 0; i < 50; ++i) { - printf("%x %x\n", copperlist[i * 2], copperlist[i * 2 + 1]); - } -*/ - freeCopperlist(copperlist); teardownBunRenderer(); diff --git a/mask-bitplane b/mask-bitplane index 042d777..6f38225 100644 Binary files a/mask-bitplane and b/mask-bitplane differ diff --git a/sprite-copperlist b/sprite-copperlist index ece03cb..a620dbc 100644 Binary files a/sprite-copperlist and b/sprite-copperlist differ diff --git a/sprite-data b/sprite-data index 7ae3830..c74f698 100644 Binary files a/sprite-data and b/sprite-data differ diff --git a/topaz-bitplane b/topaz-bitplane index e5a7848..caeca80 100644 Binary files a/topaz-bitplane and b/topaz-bitplane differ diff --git a/topaz-narrow.png b/topaz-narrow.png new file mode 100644 index 0000000..ff118b5 Binary files /dev/null and b/topaz-narrow.png differ