diff --git a/016.copper_fun/Makefile b/016.copper_fun/Makefile index a45df89..2c178fb 100644 --- a/016.copper_fun/Makefile +++ b/016.copper_fun/Makefile @@ -3,13 +3,24 @@ EXTRA=out/copper-new.s LIBS=`GraphicsMagick-config --ldflags --libs` MODULE=copper_fun.s BASE_ADDRESS=10000 +GIF_FILE=assets/test.gif +RUN_SCRIPT=$(A500_RUN_SCRIPT) +FRAMERATE=10 +VASM_EXTRA_ARGS=-DFRAMERATE=$(FRAMERATE) +IMAGE_MAGIK_CONVERT=/opt/ImageMagick/bin/convert include ../shared/base.mk -out/copper-new.s: assets/test.gif out/copper_fun_generate +out/copper-new.s: $(GIF_FILE) out/copper_fun_generate convert.sh rm -f out/*.png - /opt/ImageMagick/bin/convert assets/test.gif out/%05d.png + $(IMAGE_MAGIK_CONVERT) $(GIF_FILE) out/%05d.png ./convert.sh > out/copper-new.s out/copper_fun_generate: copper_fun_generate.c Makefile gcc $(HOST_CFLAGS) `GraphicsMagick-config --cppflags` copper_fun_generate.c -o out/copper_fun_generate $(LIBS) +video: GIF_FILE:=assets/video.gif +video: all + +vgo: RUN_SCRIPT:=$(A600_RUN_SCRIPT) +vgo: video go + diff --git a/016.copper_fun/README.md b/016.copper_fun/README.md index ca17a35..ae83cf7 100644 --- a/016.copper_fun/README.md +++ b/016.copper_fun/README.md @@ -1,9 +1,31 @@ copper fun ========== -screenshot ----------- -![Screenshot](screenshot.png?raw=true) +In this example I extract a series of PNG files from an animated gif using ImageMagik convert (You will need to install ImageMagik to try this one). + +Next a shell script [convert.sh](convert.sh) calls a C program [copper_fun_generate.c](copper_fun_generate.c) that resizes the PNG to 52x276 pixels, then converts this into a copper list that changes the color at the corresponding beam position to try and re-create the image. + +Finally in the asm code [copper_fun.s] we cycle through the copper lists to make an animation. + +Obviously this is the lease efficent way to generate a super low res animation, however it's way fun :-) + +There are two configurations: + + 1. A pattern that will run an 512mb chip ram + ``` + # make +``` + 2. A video that needs 1bm chip ram + + ``` + # make video +``` + +screenshots +----------- +![Screenshot](screenshots/screenshot.png?raw=true) + +![Screenshot](screenshots/video.png?raw=true) try it ------ diff --git a/016.copper_fun/assets/video.gif b/016.copper_fun/assets/video.gif new file mode 100644 index 0000000..6817fe4 Binary files /dev/null and b/016.copper_fun/assets/video.gif differ diff --git a/016.copper_fun/convert.sh b/016.copper_fun/convert.sh index e0b0195..99e2d45 100755 --- a/016.copper_fun/convert.sh +++ b/016.copper_fun/convert.sh @@ -1,11 +1,16 @@ +#!/bin/bash ODD=1 +COUNTER=1 for I in out/*.png; do if [ $ODD = 0 ] ; then - echo `echo $I | sed -e 's/\///' -e 's/\.png//'`":" - ./out/copper_fun_generate $I + if [ $COUNTER -lt 16 ] ; then + ((COUNTER++)) + echo `echo $I | sed -e 's/\///' -e 's/\.png//'`":" + ./out/copper_fun_generate $I #mv -f resized.png $I.resized.png - echo " dc.l \$fffffffe" - ODD=1 + echo " dc.l \$fffffffe" + ODD=1 + fi else ODD=0 diff --git a/016.copper_fun/copper_fun.s b/016.copper_fun/copper_fun.s index 18c40d7..bbee43c 100644 --- a/016.copper_fun/copper_fun.s +++ b/016.copper_fun/copper_fun.s @@ -31,10 +31,8 @@ entry: move.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES,BPL1MOD(a6) ;; install copper list, then enable dma and selected interrupts - if 0 lea copper(pc),a0 move.l a0,COP1LC(a6) - endif move.w COPJMP1(a6),d0 move.w #(DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6) move.w #(INTF_SETCLR|INTF_INTEN|INTF_EXTER),INTENA(a6) @@ -47,7 +45,7 @@ entry: move.l a1,(a0) move.l counter,d0 - cmpi.l #2,counter + cmpi.l #FRAMERATE/2,counter bne .ok move.l #0,counter move.l copperptr,a0 diff --git a/016.copper_fun/copper_fun_generate.c b/016.copper_fun/copper_fun_generate.c index e1ba1a9..d2fb425 100644 --- a/016.copper_fun/copper_fun_generate.c +++ b/016.copper_fun/copper_fun_generate.c @@ -23,7 +23,7 @@ typedef struct { } image_t; image_t image = {0}; -config_t config = {.blur = 1.0, .debug=0}; +config_t config = {.blur = 0.75, .debug=0}; static void cleanup() diff --git a/016.copper_fun/screenshot.png b/016.copper_fun/screenshots/screenshot.png similarity index 100% rename from 016.copper_fun/screenshot.png rename to 016.copper_fun/screenshots/screenshot.png diff --git a/016.copper_fun/screenshots/video.png b/016.copper_fun/screenshots/video.png new file mode 100644 index 0000000..4c2c051 Binary files /dev/null and b/016.copper_fun/screenshots/video.png differ diff --git a/shared/base.mk b/shared/base.mk index 3f95c27..fe02e62 100644 --- a/shared/base.mk +++ b/shared/base.mk @@ -6,11 +6,16 @@ IMAGECONDIR=../tools/imagecon IMAGECON=$(IMAGECONDIR)/out/imagecon RESIZEDIR=../tools/resize RESIZE=$(RESIZEDIR)/out/resize - +A500_RUN_SCRIPT=~/Google\ Drive/Amiga/amiga500.sh +A600_RUN_SCRIPT=~/Google\ Drive/Amiga/amiga600.sh ifndef BASE_ADDRESS BASE_ADDRESS=70000 endif +ifndef RUN_SCRIPT +RUN_SCRIPT=$(A500_RUN_SCRIPT) +endif + all: bin out $(MAKEADF) $(FLOPPY) gdrive: all @@ -20,7 +25,7 @@ test: all cp $(FLOPPY) ~/Projects/amiga/test.adf go: test - ~/Google\ Drive/Amiga/amiga500.sh + $(RUN_SCRIPT) list: m68k-amigaos-objdump -b binary --disassemble-all out/bootblock.bin -m m68k > out/bootblock.txt @@ -31,7 +36,6 @@ bin: out: mkdir out - ic: make -C $(IMAGECONDIR) @@ -46,6 +50,8 @@ $(MAKEADF): $(FLOPPY): out/bootblock.bin $(MAKEADF) out/bootblock.bin > $(FLOPPY) + @ls -lh out/bootblock.bin + @ls -lh $(FLOPPY) out/bootblock.bin: out/bootblock.o vlink -brawbin1 $< -o $@