More copper fun

This commit is contained in:
alpine9000 2016-03-13 12:33:20 +11:00
parent 75d6cfb996
commit 6b1fb40abb
9 changed files with 58 additions and 16 deletions

View File

@ -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

View File

@ -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
------

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

View File

@ -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

View File

@ -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

View File

@ -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()

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -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 $@