dgr2png: fix aux color rotate

This commit is contained in:
Vince Weaver 2023-05-08 00:04:54 -04:00
parent 47225c718e
commit b2727fd8e0
8 changed files with 79 additions and 4 deletions

View File

@ -0,0 +1,50 @@
include ../../../Makefile.inc
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
PNG_TO_DGR = ../../../utils/gr-utils/png2dgr
LINKER_SCRIPTS = ../../../linker_scripts
DOS33 = ../../../utils/dos33fs-utils/dos33
EMPTY_DISK = ../../../empty_disk/empty.dsk
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
all: dlores_plain.dsk
####
DLORES: dlores_plain.o
ld65 -o DLORES dlores_plain.o -C $(LINKER_SCRIPTS)/apple2_1000.inc
dlores_plain.o: dlores_plain.s ../dlores_main.s ../zx02_optim.s \
../zp.inc ../hardware.inc
ca65 -o dlores_plain.o dlores_plain.s -l dlores_plain.lst
####
HELLO: ../hello.bas
$(TOKENIZE) < ../hello.bas > HELLO
####
dlores_plain.dsk: HELLO DLORES\
myst.gr.main.zx02 myst.gr.aux.zx02\
channelwood.gr.main.zx02 channelwood.gr.aux.zx02\
selenetic.gr.main.zx02 selenetic.gr.aux.zx02\
sworg_dgr.gr.main.zx02 sworg_dgr.gr.aux.zx02\
dgr_test_bar.gr.main.zx02 dgr_test_bar.gr.aux.zx02
cp $(EMPTY_DISK) dlores_plain.dsk
$(DOS33) -y dlores_plain.dsk SAVE A HELLO
$(DOS33) -y dlores_plain.dsk BSAVE -a 0x1000 DLORES
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 myst.gr.main.zx02 MYST.MAIN.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 myst.gr.aux.zx02 MYST.AUX.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 channelwood.gr.main.zx02 CHANNEL.MAIN.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 channelwood.gr.aux.zx02 CHANNEL.AUX.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 selenetic.gr.main.zx02 SELEN.MAIN.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 selenetic.gr.aux.zx02 SELEN.AUX.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 sworg_dgr.gr.main.zx02 SWORG.MAIN.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 sworg_dgr.gr.aux.zx02 SWORG.AUX.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 dgr_test_bar.gr.main.zx02 TEST.MAIN.ZX02
$(DOS33) -y dlores_plain.dsk BSAVE -a 0xa000 dgr_test_bar.gr.aux.zx02 TEST.AUX.ZX02
####
clean:
rm -f *~ *.o *.lst

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,6 +1,8 @@
# label dos3.3 name prefix for png file
myst MYST myst
myst MYST myst '
chanelwood CHANNEL channelwood
selenetic SELEN selenetic
sworg SWORG sworg_dgr
sworg SWORG sworg_dgr '
test TEST dgr_test_bar
lady1 LADY1 lady1_dgr ' number1exile
lara1 LARA1 lara1_dgr ' number1exile

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -18,6 +18,25 @@ static int gr_offsets[24]={
0x450-0x400,0x4D0-0x400,0x550-0x400,0x5D0-0x400,0x650-0x400,0x6D0-0x400,0x750-0x400,0x7D0-0x400,
};
/* rotate left by 1 to unconvert */
static unsigned char aux_colors[]={
0, /* 0000 -> 0000 */
2, /* 0001 -> 0010 */
4, /* 0010 -> 0100 */
6, /* 0011 -> 0110 */
8, /* 0100 -> 1000 */
10, /* 0101 -> 1010 */
12, /* 0110 -> 1100 */
14, /* 0111 -> 1110 */
1, /* 1000 -> 0001 */
3, /* 1001 -> 0011 */
5, /* 1010 -> 0101 */
7, /* 1011 -> 0111 */
9, /* 1100 -> 1001 */
11, /* 1101 -> 1011 */
13, /* 1110 -> 1101 */
15, /* 1111 -> 1111 */
};
int main(int argc, char **argv) {
int fd;
@ -158,13 +177,17 @@ int main(int argc, char **argv) {
for(y=0;y<height/2;y++) {
for(x=0;x<40;x++) {
/* note the aux colors are rotated right by 1 */
color1=(aux_screen[gr_offsets[y]+x])&0xf;
row_pointers[y*2][x*2]=color1;
row_pointers[y*2][x*2]=aux_colors[color1];
color2=(main_screen[gr_offsets[y]+x])&0xf;
row_pointers[y*2][(x*2)+1]=color2;
color1=((aux_screen[gr_offsets[y]+x])>>4)&0xf;
row_pointers[(y*2)+1][x*2]=color1;
row_pointers[(y*2)+1][x*2]=aux_colors[color1];
color2=((main_screen[gr_offsets[y]+x])>>4)&0xf;
row_pointers[(y*2)+1][(x*2)+1]=color2;
}