1
0
mirror of https://frontier.innolan.net/github/AmigaExamples.git synced 2025-11-24 00:47:13 +00:00

Support non copper list palettes

This commit is contained in:
alpine9000
2016-03-03 17:16:30 +11:00
parent 0be40aec53
commit 3f0d6a2568
9 changed files with 104 additions and 9 deletions

View File

@ -1,6 +1,6 @@
MODULE=blit.s
FLOPPY=bin/blit.adf
IMAGEDATA=out/image-copper-list.s out/image.bin
IMAGEDATA=out/image-palette.s out/image.bin
IMAGEFILE=../assets/mission-beach.png
TC_IMAGEDATA=out/tc.bin out/tc-mask.bin
TC_IMAGEFILE=../assets/tc.png
@ -14,7 +14,7 @@ $(SHARED_PALETTE): $(IMAGEFILE) $(TC_IMAGEFILE)
$(IMAGECON) --input $(IMAGEFILE),$(TC_IMAGEFILE) --output $(SHARED_PALETTE_BASE) --colors 32 --quantize --output-palette
$(IMAGEDATA): $(IMAGECON) $(IMAGEFILE) $(SHARED_PALETTE)
$(IMAGECON) --input $(IMAGEFILE) --output out/image --output-bitplanes --output-copperlist --use-palette $(SHARED_PALETTE)
$(IMAGECON) --input $(IMAGEFILE) --output out/image --output-bitplanes --output-palette-asm --use-palette $(SHARED_PALETTE)
$(TC_IMAGEDATA): $(IMAGECON) $(TC_IMAGEFILE) $(SHARED_PALETTE)
$(IMAGECON) --input $(TC_IMAGEFILE) --output out/tc --output-bitplanes --output-mask --output-copperlist --use-palette $(SHARED_PALETTE)
$(IMAGECON) --input $(TC_IMAGEFILE) --output out/tc --output-bitplanes --output-mask --use-palette $(SHARED_PALETTE)

View File

@ -3,6 +3,7 @@ perform a basic blit
We make some changes to [001.simple_image](../001.simple_image):
1. The bitplane pointers are now reset using the copper.
2. The palette is now installed once and removed from the copper list.
2. Interrupt processing is disabled.
3. A6 is now used as the global base register for CUSTOM.

Binary file not shown.

View File

@ -20,6 +20,8 @@ entry:
move #$7ff,DMACON(a6) ; disable all dma
move #$7fff,INTENA(a6) ; disable all interrupts
include "out/image-palette.s"
if 0
;; reset color registers to white to prevent startup flicker
move.l #32,d0
lea COLOR00(a6),a0
@ -27,6 +29,7 @@ entry:
move.w #$FFF,(a0)
addq #2,a0
dbra d0,.loop
endif
;; set up playfield
move.w #(RASTER_Y_START<<8)|RASTER_X_START,DIWSTRT(a6)
@ -133,7 +136,6 @@ copper:
dc.w BPL5PTL,0
dc.w BPL5PTH,0
include "out/image-copper-list.s"
dc.l $fffffffe
bitplanes:

View File

@ -39,12 +39,13 @@ $(SHARED_PALETTE): $(IMAGECON)
$(IMAGECON) --input $(TEST_IMAGE),$(TEST_IMAGE2) --output $(SHARED_BASE) --colors 32 --quantize --output-palette
$(OUTPUT_BASE).bin: $(IMAGECON)
-rm -f $(OUTPUT_BASE).bin $(OUTPUT_BASE)-copper-list.s $(OUTPUT_BASE)-mask.bin
$(IMAGECON) --input $(TEST_IMAGE) --output $(OUTPUT_BASE) --output-mask --output-copperlist --output-bitplanes --colors 32 --quantize
-rm -f $(OUTPUT_BASE).bin $(OUTPUT_BASE)-copper-list.s $(OUTPUT_BASE)-palette.s $(OUTPUT_BASE)-mask.bin
$(IMAGECON) --input $(TEST_IMAGE) --output $(OUTPUT_BASE) --output-mask --output-copperlist --output-bitplanes --output-palette-asm --colors 32 --quantize
test: $(IMAGECON) $(OUTPUT_BASE).bin $(SHARED_PALETTE) $(USED_PALETTE)
diff $(OUTPUT_BASE).bin $(REFERENCE_BASE).bin
diff $(OUTPUT_BASE)-copper-list.s $(REFERENCE_BASE)-copper-list.s
diff $(OUTPUT_BASE)-palette.s $(REFERENCE_BASE)-palette.s
diff $(OUTPUT_BASE)-mask.bin $(REFERENCE_BASE)-mask.bin
diff $(SHARED_PALETTE) $(REFERENCE_SHARED_PALETTE)
diff $(SHARED_BASE).bin $(REFERENCE_SHARED_BASE).bin

View File

@ -12,6 +12,7 @@ usage
--colors <max colors>
--quantize
--output-palette
--output-palette-asm
--output-bitplanes
--output-mask
--output-copperlist
@ -23,8 +24,9 @@ The following files can be generated:
1. **&lt;output prefix>.bin** binary interleaved bitplane data
2. **&lt;output prefix>-copper-list.s** m68k assembler syntax copper list with no symbols
3. **&lt;output prefix>.pal** palette file listing the palette colors as hex
3. **&lt;output prefix>-mask.bin** binary interleaved bitplane mask
3. **&lt;output prefix>-palette.s** m68k assembler syntax code to install the color palette (preserves all registers)
4. **&lt;output prefix>.pal** palette file listing the palette colors as hex
5. **&lt;output prefix>-mask.bin** binary interleaved bitplane mask
options
-------
@ -60,6 +62,10 @@ Output the binary bitplane data for use as a blitter source mask
Generate a palette file of the final palette used. Output will be the output file with the ".pal" extension.
**--output-palette-asm**
Generate m68k assembler instructions to install the palette. No symbols are generated. Registers are preserved.
**--use-palette** &lt;palette file>
Specify a palette file to use that will override the image or quantized palette. Overrides the --colors and --quantize options.

View File

@ -19,6 +19,7 @@ imagecon_config_t config = {
.maxColors = MAX_PALETTE,
.outputPalette = 0,
.outputMask = 0,
.outputPaletteAsm = 0,
.outputBitplanes = 0,
.outputCopperList = 0,
.quantize = 0,
@ -38,6 +39,7 @@ usage()
" --output-bitplanes\n"\
" --output-copperlist\n"\
" --output-mask\n"\
" --output-palette-asm\n"\
" --output-palette\n"\
" --use-palette <palette file>\n"\
" --verbose\n", config.argv[0]);
@ -105,6 +107,7 @@ outputPalette(char* outFilename, imagecon_image_t* ic)
FILE* fp = 0;
FILE* paletteFP = 0;
FILE* paletteAsmFP = 0;
if (config.outputCopperList) {
fp = openFileWrite("%s-copper-list.s", outFilename);
@ -114,6 +117,11 @@ outputPalette(char* outFilename, imagecon_image_t* ic)
paletteFP = openFileWrite("%s.pal", outFilename);
}
if (config.outputPaletteAsm) {
paletteAsmFP = openFileWrite("%s-palette.s", outFilename);
fprintf(paletteAsmFP, "\tmovem.l d0-a6,-(sp)\n\tlea CUSTOM,a6\n");
}
if (config.verbose) {
printf("outputPalette:\n");
}
@ -125,6 +133,9 @@ outputPalette(char* outFilename, imagecon_image_t* ic)
if (paletteFP) {
fprintf(paletteFP, "%03x\n", ic->palette[i].r << 8 | ic->palette[i].g << 4 | ic->palette[i].b);
}
if (paletteAsmFP) {
fprintf(paletteAsmFP, "\tlea COLOR%02d(a6),a0\n\tmove.w #$%03x,(a0)\n", i, ic->palette[i].r << 8 | ic->palette[i].g << 4 | ic->palette[i].b);
}
if (fp) {
fprintf(fp, "\tdc.w $%x,$%x\n", 0x180+(i*2), ic->palette[i].r << 8 | ic->palette[i].g << 4 | ic->palette[i].b);
}
@ -134,6 +145,11 @@ outputPalette(char* outFilename, imagecon_image_t* ic)
fclose(paletteFP);
}
if (paletteAsmFP) {
fprintf(paletteAsmFP, "\tmovem.l (sp)+,d0-a6\n");
fclose(paletteFP);
}
if (fp) {
fclose(fp);
}
@ -461,6 +477,7 @@ main(int argc, char **argv)
{"output-copperlist", no_argument, &config.outputCopperList, 1},
{"output-bitplanes", no_argument, &config.outputBitplanes, 1},
{"output-palette", no_argument, &config.outputPalette, 1},
{"output-palette-asm", no_argument, &config.outputPaletteAsm, 1},
{"output-mask", no_argument, &config.outputMask, 1},
{"use-palette", required_argument, 0, 'p'},
{"output", required_argument, 0, 'o'},

View File

@ -6,6 +6,7 @@ typedef struct {
int maxColors;
int outputPalette;
int outputPaletteAsm;
int outputMask;
int outputBitplanes;
int outputCopperList;

View File

@ -0,0 +1,67 @@
movem.l d0-a6,-(sp)
lea CUSTOM,a6
lea COLOR00(a6),a0
move.w #$36b,(a0)
lea COLOR01(a6),a0
move.w #$48b,(a0)
lea COLOR02(a6),a0
move.w #$363,(a0)
lea COLOR03(a6),a0
move.w #$ffd,(a0)
lea COLOR04(a6),a0
move.w #$111,(a0)
lea COLOR05(a6),a0
move.w #$443,(a0)
lea COLOR06(a6),a0
move.w #$fec,(a0)
lea COLOR07(a6),a0
move.w #$37b,(a0)
lea COLOR08(a6),a0
move.w #$222,(a0)
lea COLOR09(a6),a0
move.w #$332,(a0)
lea COLOR10(a6),a0
move.w #$574,(a0)
lea COLOR11(a6),a0
move.w #$eda,(a0)
lea COLOR12(a6),a0
move.w #$554,(a0)
lea COLOR13(a6),a0
move.w #$ca5,(a0)
lea COLOR14(a6),a0
move.w #$59c,(a0)
lea COLOR15(a6),a0
move.w #$684,(a0)
lea COLOR16(a6),a0
move.w #$a95,(a0)
lea COLOR17(a6),a0
move.w #$bde,(a0)
lea COLOR18(a6),a0
move.w #$aba,(a0)
lea COLOR19(a6),a0
move.w #$dc9,(a0)
lea COLOR20(a6),a0
move.w #$9bc,(a0)
lea COLOR21(a6),a0
move.w #$aa8,(a0)
lea COLOR22(a6),a0
move.w #$8a9,(a0)
lea COLOR23(a6),a0
move.w #$def,(a0)
lea COLOR24(a6),a0
move.w #$897,(a0)
lea COLOR25(a6),a0
move.w #$bcc,(a0)
lea COLOR26(a6),a0
move.w #$fff,(a0)
lea COLOR27(a6),a0
move.w #$765,(a0)
lea COLOR28(a6),a0
move.w #$db6,(a0)
lea COLOR29(a6),a0
move.w #$486,(a0)
lea COLOR30(a6),a0
move.w #$6ad,(a0)
lea COLOR31(a6),a0
move.w #$8a4,(a0)
movem.l (sp)+,d0-a6