diff --git a/010.blit_speed/1bitplanes-screenshot.png b/010.blit_speed/1bitplanes-screenshot.png new file mode 100644 index 0000000..5e9495e Binary files /dev/null and b/010.blit_speed/1bitplanes-screenshot.png differ diff --git a/010.blit_speed/2bitplanes-screenshot.png b/010.blit_speed/2bitplanes-screenshot.png new file mode 100644 index 0000000..43cf1e2 Binary files /dev/null and b/010.blit_speed/2bitplanes-screenshot.png differ diff --git a/010.blit_speed/3bitplanes-screenshot.png b/010.blit_speed/3bitplanes-screenshot.png new file mode 100644 index 0000000..7ca0117 Binary files /dev/null and b/010.blit_speed/3bitplanes-screenshot.png differ diff --git a/010.blit_speed/4bitplanes-screenshot.png b/010.blit_speed/4bitplanes-screenshot.png new file mode 100644 index 0000000..689db21 Binary files /dev/null and b/010.blit_speed/4bitplanes-screenshot.png differ diff --git a/010.blit_speed/5bitplanes-screenshot.png b/010.blit_speed/5bitplanes-screenshot.png new file mode 100644 index 0000000..9b04a2c Binary files /dev/null and b/010.blit_speed/5bitplanes-screenshot.png differ diff --git a/010.blit_speed/Makefile b/010.blit_speed/Makefile new file mode 100644 index 0000000..4092780 --- /dev/null +++ b/010.blit_speed/Makefile @@ -0,0 +1,24 @@ +NUM_COLORS=2 +MODULE=blit_speed.s +FLOPPY=bin/blit_speed.adf +IMAGEDATA=out/image-palette.s out/image.bin +IMAGEFILE=../assets/mission-beach.png +BOB_BASE=out/emoji +BOB_IMAGEDATA=$(BOB_BASE).bin $(BOB_BASE)-mask.bin +BOB_IMAGEFILE=../assets/emoji.png +EXTRA=$(IMAGEDATA) $(BOB_IMAGEDATA) blit.s init.s utils.s constants.i Makefile +SHARED_PALETTE_BASE=out/shared-palette +SHARED_PALETTE=$(SHARED_PALETTE_BASE).pal +VASM_EXTRA_ARGS=-DSCREEN_COLORS=$(NUM_COLORS) + +include ../shared/base.mk + +$(SHARED_PALETTE): $(IMAGEFILE) $(BOB_IMAGEFILE) Makefile + $(IMAGECON) --input $(IMAGEFILE),$(BOB_IMAGEFILE) --output $(SHARED_PALETTE_BASE) --colors $(NUM_COLORS) --quantize --output-palette + +$(IMAGEDATA): $(IMAGECON) $(IMAGEFILE) $(SHARED_PALETTE) Makefile + $(IMAGECON) --input $(IMAGEFILE) --output out/image --output-bitplanes --output-grey-palette-asm --output-palette-asm --use-palette $(SHARED_PALETTE) + +$(BOB_IMAGEDATA): $(IMAGECON) $(BOB_IMAGEFILE) $(SHARED_PALETTE) Makefile + $(IMAGECON) --input $(BOB_IMAGEFILE) --output $(BOB_BASE) --output-bitplanes --use-palette $(SHARED_PALETTE) + $(IMAGECON) --input $(BOB_IMAGEFILE) --output $(BOB_BASE) --colors $(NUM_COLORS) --output-mask --quantize diff --git a/010.blit_speed/README.md b/010.blit_speed/README.md new file mode 100644 index 0000000..7cdc183 --- /dev/null +++ b/010.blit_speed/README.md @@ -0,0 +1,53 @@ +how fast are my blits? +====================== + +Blitting a 5 bitplane 64x65 rectangle with the cookie cut (4 active DMA changes) function probably isn't going to be very fast. + +How fast is it ? + +I added a feature to [imagecon](../tools/imagecon) to generate a greyscale version of the palette. + +Then in the main loop I now: + * wait for the vertical blank + * set the greyscale palette + * do some blits + * set the color palette + + ``` +.mainLoop: + bsr waitVerticalBlank + bsr installGreyscalePalette + move.l #4,d0 ; blit the object 5 times each frame +.blitLoop: + bsr moveBlitterObject + dbra d0,.blitLoop + bsr.s installColorPalette + bra.s .mainLoop +``` + +So when the screen changes to color, that's how many scan lines we have used blitting stuff. + +There is a variable in the Makefile that sets the number of colors. This automatically creates the correct bitplane and palette data as well as reconfiguring the example. So now we can see what impact the number of bitplanes has on blit speed. + +So here we can see the results: + +5 bitplanes +![5 bitplanes](5bitplanes-screenshot.png?raw=true) + +At 5 bitplanes we don't have enough time to do 5 blits. + +4 bitplanes +![4 bitplanes](4bitplanes-screenshot.png?raw=true) + +3 bitplanes +![3 bitplanes](3bitplanes-screenshot.png?raw=true) + +2 bitplanes +![5 bitplanes](2bitplanes-screenshot.png?raw=true) + +1 bitplanes +![5 bitplanes](1bitplanes-screenshot.png?raw=true) + +[Download disk image](bin/blit_speed.adf?raw=true) + + diff --git a/010.blit_speed/bin/anim_blit.adf b/010.blit_speed/bin/anim_blit.adf new file mode 100644 index 0000000..18394a2 Binary files /dev/null and b/010.blit_speed/bin/anim_blit.adf differ diff --git a/010.blit_speed/blit.s b/010.blit_speed/blit.s new file mode 100644 index 0000000..a8f4f6d --- /dev/null +++ b/010.blit_speed/blit.s @@ -0,0 +1,143 @@ +;; BLTCON? configuration +;; http://amigadev.elowar.com/read/ADCD_2.1/Hardware_Manual_guide/node011C.html +;; blitter logic function minterm truth table +;; fill in D column for desired function +;; A(mask) B(bob) C(bg) D(dest) +;; - - - - +;; 0 0 0 0 +;; 0 0 1 1 +;; 0 1 0 0 +;; 0 1 1 1 +;; 1 0 0 0 +;; 1 0 1 0 +;; 1 1 0 1 +;; 1 1 1 1 +;; read D column from bottom up = 11001010 = $ca +;; this is used in the LF? bits + +BLIT_LF_MASK_MINTERM equ $ca +BLIT_DEST equ $100 +BLIT_SRCC equ $200 +BLIT_SRCB equ $400 +BLIT_SRCA equ $800 +BLIT_ASHIFTSHIFT equ 12 ;Bit index of ASH? bits + +BLIT_BOB_WIDTH64 equ 64+16 ; Must blit extra word to allow shifting +BLIT_BOB_HEIGHT64 equ 64 +BLIT_BOB_WIDTH64_BYTES equ BLIT_BOB_WIDTH64/8 +BLIT_BOB_WIDTH64_WORDS equ BLIT_BOB_WIDTH64/16 + +blitWait: + tst DMACONR(a6) ;for compatibility +.waitblit: + btst #6,DMACONR(a6) + bne.s .waitblit + rts + + ;; blitMaskedObject64 + ;; a3 - xpos + ;; a4 - ypos + ;; a0 - display + ;; a1 - object + ;; a2 - mask +blitMaskedObject64: + movem.l d0-a6,-(sp) + + move.l (a3),d0 + move.l (a4),d1 + bsr blitWait + + ;; d0 = XPOS + ;; d1 = YPOS + ;; d4 = XPOS_BYTES + + move.w d0,d4 ; d4 = XPOS + lsr.w #3,d4 ; d4 = XPOS_BYTES + + ;; this shift will give us the bits to shift (bits 0-3) in bits (12-15) of d0 + lsl.w #8,d0 ; BLIT_SOURCE_SHIFT<