mirror of
https://github.com/datajerk/c2d.git
synced 2025-01-30 04:34:30 +00:00
included cc65 build, macos universal builds, refactored
This commit is contained in:
parent
e690a1c022
commit
e0d9e2a3ca
57
Makefile
57
Makefile
@ -8,32 +8,63 @@ windows: bin/c2d.exe bin/text2page.exe bin/page2text.exe
|
||||
|
||||
dist: all windows
|
||||
|
||||
c2d.h: c2d.h.0 asm/loader.s asm/bar.s makeheader
|
||||
cc65-sources-2.13.3.tar.bz2:
|
||||
curl -sLO https://github.com/mrdudz/cc65-old/raw/master/cc65-sources-2.13.3.tar.bz2
|
||||
|
||||
cc65-2.13.3/bin/cl65: cc65-sources-2.13.3.tar.bz2
|
||||
tar zxf cc65-sources-2.13.3.tar.bz2
|
||||
(cd cc65-2.13.3; /usr/bin/sed 's!/usr/local!'${PWD}'/cc65-2.13.3!' <make/gcc.mak >Makefile; make -j4 bins || make bins && make install || true)
|
||||
|
||||
c2d.h: c2d.h.0 asm/loader.s asm/bar.s makeheader cc65-2.13.3/bin/cl65
|
||||
./makeheader
|
||||
|
||||
bin/c2d: c2d.c c2d.h
|
||||
gcc -Wall -Wno-missing-braces -I. -O3 -o $@ $< -lm
|
||||
bin/c2d_arm: c2d.c c2d.h
|
||||
gcc -Wall -Wno-missing-braces -I. -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||
|
||||
bin/text2page_arm: text2page.c
|
||||
gcc -Wall -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||
|
||||
bin/page2text_arm: page2text.c
|
||||
gcc -Wall -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||
|
||||
bin/mandelbrotgr_arm: mandelbrotgr.c
|
||||
gcc -Wall -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||
|
||||
bin/c2d_x86: c2d.c c2d.h
|
||||
gcc -Wall -Wno-missing-braces -I. -O3 -target x86_64-apple-macos10.12 -o $@ $< -lm
|
||||
|
||||
bin/text2page_x86: text2page.c
|
||||
gcc -Wall -O3 -target -x86_64-apple-macos10.12 -o $@ $< -lm
|
||||
|
||||
bin/page2text_x86: page2text.c
|
||||
gcc -Wall -O3 -target x86_64-apple-macos10.12 -o $@ $< -lm
|
||||
|
||||
bin/mandelbrotgr_x86: mandelbrotgr.c
|
||||
gcc -Wall -O3 -target x86_64-apple-macos10.12 -o $@ $< -lm
|
||||
|
||||
bin/c2d: bin/c2d_x86 bin/c2d_arm
|
||||
lipo -create -output $@ $<
|
||||
|
||||
bin/text2page: bin/text2page_x86 bin/text2page_arm
|
||||
lipo -create -output $@ $<
|
||||
|
||||
bin/page2text: bin/page2text_x86 bin/page2text_arm
|
||||
lipo -create -output $@ $<
|
||||
|
||||
bin/mandelbrotgr: bin/mandelbrotgr_x86 bin/mandelbrotgr_arm
|
||||
lipo -create -output $@ $<
|
||||
|
||||
bin/c2d.exe: c2d.c c2d.h
|
||||
$(WIN32GCC) -Wall -Wno-missing-braces -I. -O3 -o $@ $<
|
||||
|
||||
bin/text2page: text2page.c
|
||||
gcc -Wall -O3 -o $@ $< -lm
|
||||
|
||||
bin/text2page.exe: text2page.c
|
||||
$(WIN32GCC) -Wall -O3 -o $@ $<
|
||||
|
||||
bin/page2text: page2text.c
|
||||
gcc -Wall -O3 -o $@ $< -lm
|
||||
|
||||
bin/page2text.exe: page2text.c
|
||||
$(WIN32GCC) -Wall -O3 -o $@ $<
|
||||
|
||||
bin/mandelbrotgr: mandelbrotgr.c
|
||||
gcc -Wall -O3 -o $@ $< -lm
|
||||
|
||||
clean:
|
||||
rm -f bin/* *.dsk c2d.h c2d.h.1
|
||||
rm -rf bin/* *.dsk c2d.h c2d.h.1 cc65-sources-2.13.3.tar.bz2 cc65-2.13.3
|
||||
(cd asm; make clean)
|
||||
|
||||
gameserverclient.text: Makefile
|
||||
|
12
asm/Makefile
12
asm/Makefile
@ -1,9 +1,6 @@
|
||||
|
||||
CL = cl65
|
||||
CL_FLAGS = -t none --listing --list-bytes 100
|
||||
#CL_FLAGS = -t apple1 -C apple1-16k.cfg --listing --list-bytes 100
|
||||
CC = cl65
|
||||
CC_FLAGS = --static-locals -t apple1 -C apple1-16k.cfg
|
||||
C2T = c2t
|
||||
|
||||
ASRC = $(shell echo *.s)
|
||||
AOBJ = $(ASRC:%.s=%.o)
|
||||
@ -18,10 +15,3 @@ clean:
|
||||
|
||||
%: %.s
|
||||
$(CL) $(CL_FLAGS) $<
|
||||
|
||||
%: %.c
|
||||
$(CC) $(CC_FLAGS) $<
|
||||
|
||||
%.mon: %
|
||||
$(C2T) $< $@
|
||||
|
||||
|
BIN
bin/c2d.exe
BIN
bin/c2d.exe
Binary file not shown.
BIN
bin/page2text
BIN
bin/page2text
Binary file not shown.
Binary file not shown.
BIN
bin/text2page
BIN
bin/text2page
Binary file not shown.
Binary file not shown.
3
c2d.c
3
c2d.c
@ -336,7 +336,8 @@ char *getext(char *filename)
|
||||
if (sp == strlen(filename) || sp == 0)
|
||||
return (NULL);
|
||||
|
||||
if ((rval = (char *) malloc(sp * sizeof(char))) == NULL); //do error code
|
||||
if ((rval = (char *) malloc(sp * sizeof(char))) == NULL)
|
||||
; //do error code
|
||||
|
||||
rval[sp] = '\0';
|
||||
for (i = 0; i < sp + i; i++)
|
||||
|
90
c2d.h
90
c2d.h
@ -9171,31 +9171,24 @@ gr:
|
||||
end:
|
||||
*/
|
||||
unsigned char loadercode[] = {
|
||||
0xAD,0xBE,0x0C,0xF0,0x08,0xA9,0x00,0x8D,
|
||||
0x50,0xC0,0x8D,0x53,0xC0,0xA2,0x00,0xBD,
|
||||
0x00,0x08,0x9D,0x00,0x04,0xBD,0x80,0x08,
|
||||
0x9D,0x80,0x04,0xBD,0x00,0x09,0x9D,0x00,
|
||||
0x05,0xBD,0x80,0x09,0x9D,0x80,0x05,0xBD,
|
||||
0x00,0x0A,0x9D,0x00,0x06,0xBD,0x80,0x0A,
|
||||
0x9D,0x80,0x06,0xBD,0x00,0x0B,0x9D,0x00,
|
||||
0x07,0xBD,0x80,0x0B,0x9D,0x80,0x07,0xE8,
|
||||
0xE0,0x78,0xD0,0xCB,0xA9,0x01,0xA0,0x0C,
|
||||
0x99,0xE8,0xB7,0xA9,0x00,0xA0,0x08,0x99,
|
||||
0xE8,0xB7,0xA9,0x02,0x85,0x04,0xA2,0x00,
|
||||
0xBD,0x64,0x0C,0x9D,0x00,0x03,0xE8,0x10,
|
||||
0xF7,0x4C,0x00,0x03,0xAD,0x57,0x03,0x85,
|
||||
0x02,0xAE,0x55,0x03,0xCA,0xCA,0x86,0x00,
|
||||
0xA5,0x04,0xA0,0x04,0x99,0xE8,0xB7,0xA5,
|
||||
0x00,0xD0,0x05,0xAD,0x56,0x03,0x10,0x02,
|
||||
0xA9,0x0F,0x85,0x03,0xA5,0x03,0xA0,0x05,
|
||||
0x99,0xE8,0xB7,0xA5,0x02,0x18,0x65,0x03,
|
||||
0xA0,0x09,0x99,0xE8,0xB7,0xA0,0xE8,0xA9,
|
||||
0xB7,0x20,0xB5,0xB7,0xB0,0x18,0xA9,0x00,
|
||||
0x85,0x48,0xC6,0x03,0x10,0xDE,0xA5,0x02,
|
||||
0x18,0x69,0x10,0x85,0x02,0xE6,0x04,0xC6,
|
||||
0x00,0x10,0xBD,0x6C,0x58,0x03,0x4C,0x69,
|
||||
0xFF
|
||||
0xad, 0xbe, 0x0c, 0xf0, 0x08, 0xa9, 0x00, 0x8d, 0x50, 0xc0, 0x8d, 0x53,
|
||||
0xc0, 0xa2, 0x00, 0xbd, 0x00, 0x08, 0x9d, 0x00, 0x04, 0xbd, 0x80, 0x08,
|
||||
0x9d, 0x80, 0x04, 0xbd, 0x00, 0x09, 0x9d, 0x00, 0x05, 0xbd, 0x80, 0x09,
|
||||
0x9d, 0x80, 0x05, 0xbd, 0x00, 0x0a, 0x9d, 0x00, 0x06, 0xbd, 0x80, 0x0a,
|
||||
0x9d, 0x80, 0x06, 0xbd, 0x00, 0x0b, 0x9d, 0x00, 0x07, 0xbd, 0x80, 0x0b,
|
||||
0x9d, 0x80, 0x07, 0xe8, 0xe0, 0x78, 0xd0, 0xcb, 0xa9, 0x01, 0xa0, 0x0c,
|
||||
0x99, 0xe8, 0xb7, 0xa9, 0x00, 0xa0, 0x08, 0x99, 0xe8, 0xb7, 0xa9, 0x02,
|
||||
0x85, 0x04, 0xa2, 0x00, 0xbd, 0x64, 0x0c, 0x9d, 0x00, 0x03, 0xe8, 0x10,
|
||||
0xf7, 0x4c, 0x00, 0x03, 0xad, 0x57, 0x03, 0x85, 0x02, 0xae, 0x55, 0x03,
|
||||
0xca, 0xca, 0x86, 0x00, 0xa5, 0x04, 0xa0, 0x04, 0x99, 0xe8, 0xb7, 0xa5,
|
||||
0x00, 0xd0, 0x05, 0xad, 0x56, 0x03, 0x10, 0x02, 0xa9, 0x0f, 0x85, 0x03,
|
||||
0xa5, 0x03, 0xa0, 0x05, 0x99, 0xe8, 0xb7, 0xa5, 0x02, 0x18, 0x65, 0x03,
|
||||
0xa0, 0x09, 0x99, 0xe8, 0xb7, 0xa0, 0xe8, 0xa9, 0xb7, 0x20, 0xb5, 0xb7,
|
||||
0xb0, 0x18, 0xa9, 0x00, 0x85, 0x48, 0xc6, 0x03, 0x10, 0xde, 0xa5, 0x02,
|
||||
0x18, 0x69, 0x10, 0x85, 0x02, 0xe6, 0x04, 0xc6, 0x00, 0x10, 0xbd, 0x6c,
|
||||
0x58, 0x03, 0x4c, 0x69, 0xff
|
||||
};
|
||||
unsigned int loadercode_len = 185;
|
||||
/*
|
||||
;bar.s
|
||||
;
|
||||
@ -9405,33 +9398,24 @@ bar:
|
||||
end:
|
||||
*/
|
||||
unsigned char barcode[] = {
|
||||
0xAD,0xE7,0x0C,0xF0,0x08,0xA9,0x00,0x8D,
|
||||
0x50,0xC0,0x8D,0x53,0xC0,0xA2,0x00,0xBD,
|
||||
0x00,0x08,0x9D,0x00,0x04,0xBD,0x80,0x08,
|
||||
0x9D,0x80,0x04,0xBD,0x00,0x09,0x9D,0x00,
|
||||
0x05,0xBD,0x80,0x09,0x9D,0x80,0x05,0xBD,
|
||||
0x00,0x0A,0x9D,0x00,0x06,0xBD,0x80,0x0A,
|
||||
0x9D,0x80,0x06,0xBD,0x00,0x0B,0x9D,0x00,
|
||||
0x07,0xBD,0x80,0x0B,0x9D,0x80,0x07,0xE8,
|
||||
0xE0,0x78,0xD0,0xCB,0xA9,0x00,0x85,0x05,
|
||||
0x85,0x06,0xA9,0x01,0xA0,0x0C,0x99,0xE8,
|
||||
0xB7,0xA9,0x00,0xA0,0x08,0x99,0xE8,0xB7,
|
||||
0xA9,0x02,0x85,0x04,0xA2,0x00,0xBD,0x6C,
|
||||
0x0C,0x9D,0x00,0x03,0xE8,0xE0,0xD0,0xD0,
|
||||
0xF5,0x4C,0x00,0x03,0xAD,0x78,0x03,0x85,
|
||||
0x02,0xAE,0x76,0x03,0xCA,0xCA,0x86,0x00,
|
||||
0xA5,0x04,0xA0,0x04,0x99,0xE8,0xB7,0xA5,
|
||||
0x00,0xD0,0x05,0xAD,0x77,0x03,0x10,0x02,
|
||||
0xA9,0x0F,0x85,0x03,0xA5,0x03,0xA0,0x05,
|
||||
0x99,0xE8,0xB7,0xA5,0x02,0x18,0x65,0x03,
|
||||
0xA0,0x09,0x99,0xE8,0xB7,0xA0,0xE8,0xA9,
|
||||
0xB7,0x20,0xB5,0xB7,0xB0,0x39,0xA9,0x00,
|
||||
0x85,0x48,0xE6,0x05,0xA6,0x06,0xBD,0x7F,
|
||||
0x03,0xC5,0x05,0xD0,0x16,0xA5,0x06,0x18,
|
||||
0x6D,0x7D,0x03,0x8D,0x5B,0x03,0xAD,0x7E,
|
||||
0x03,0x8D,0x5C,0x03,0xA9,0x20,0x8D,0x00,
|
||||
0x04,0xE6,0x06,0xC6,0x03,0x10,0xBD,0xA5,
|
||||
0x02,0x18,0x69,0x10,0x85,0x02,0xE6,0x04,
|
||||
0xC6,0x00,0x10,0x9C,0x6C,0x79,0x03,0x4C,
|
||||
0x69,0xFF
|
||||
0xad, 0xe7, 0x0c, 0xf0, 0x08, 0xa9, 0x00, 0x8d, 0x50, 0xc0, 0x8d, 0x53,
|
||||
0xc0, 0xa2, 0x00, 0xbd, 0x00, 0x08, 0x9d, 0x00, 0x04, 0xbd, 0x80, 0x08,
|
||||
0x9d, 0x80, 0x04, 0xbd, 0x00, 0x09, 0x9d, 0x00, 0x05, 0xbd, 0x80, 0x09,
|
||||
0x9d, 0x80, 0x05, 0xbd, 0x00, 0x0a, 0x9d, 0x00, 0x06, 0xbd, 0x80, 0x0a,
|
||||
0x9d, 0x80, 0x06, 0xbd, 0x00, 0x0b, 0x9d, 0x00, 0x07, 0xbd, 0x80, 0x0b,
|
||||
0x9d, 0x80, 0x07, 0xe8, 0xe0, 0x78, 0xd0, 0xcb, 0xa9, 0x00, 0x85, 0x05,
|
||||
0x85, 0x06, 0xa9, 0x01, 0xa0, 0x0c, 0x99, 0xe8, 0xb7, 0xa9, 0x00, 0xa0,
|
||||
0x08, 0x99, 0xe8, 0xb7, 0xa9, 0x02, 0x85, 0x04, 0xa2, 0x00, 0xbd, 0x6c,
|
||||
0x0c, 0x9d, 0x00, 0x03, 0xe8, 0xe0, 0xd0, 0xd0, 0xf5, 0x4c, 0x00, 0x03,
|
||||
0xad, 0x78, 0x03, 0x85, 0x02, 0xae, 0x76, 0x03, 0xca, 0xca, 0x86, 0x00,
|
||||
0xa5, 0x04, 0xa0, 0x04, 0x99, 0xe8, 0xb7, 0xa5, 0x00, 0xd0, 0x05, 0xad,
|
||||
0x77, 0x03, 0x10, 0x02, 0xa9, 0x0f, 0x85, 0x03, 0xa5, 0x03, 0xa0, 0x05,
|
||||
0x99, 0xe8, 0xb7, 0xa5, 0x02, 0x18, 0x65, 0x03, 0xa0, 0x09, 0x99, 0xe8,
|
||||
0xb7, 0xa0, 0xe8, 0xa9, 0xb7, 0x20, 0xb5, 0xb7, 0xb0, 0x39, 0xa9, 0x00,
|
||||
0x85, 0x48, 0xe6, 0x05, 0xa6, 0x06, 0xbd, 0x7f, 0x03, 0xc5, 0x05, 0xd0,
|
||||
0x16, 0xa5, 0x06, 0x18, 0x6d, 0x7d, 0x03, 0x8d, 0x5b, 0x03, 0xad, 0x7e,
|
||||
0x03, 0x8d, 0x5c, 0x03, 0xa9, 0x20, 0x8d, 0x00, 0x04, 0xe6, 0x06, 0xc6,
|
||||
0x03, 0x10, 0xbd, 0xa5, 0x02, 0x18, 0x69, 0x10, 0x85, 0x02, 0xe6, 0x04,
|
||||
0xc6, 0x00, 0x10, 0x9c, 0x6c, 0x79, 0x03, 0x4c, 0x69, 0xff
|
||||
};
|
||||
unsigned int barcode_len = 226;
|
||||
|
45
makeheader
45
makeheader
@ -1,44 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
header()
|
||||
{
|
||||
FILE=$1
|
||||
VAR=$2
|
||||
EOL=$3
|
||||
BYTES=$(hexdump -v $FILE | sed 's/^.......//' | wc -w | awk '{print $1}');
|
||||
|
||||
echo "/*"
|
||||
expand ${FILE}.s
|
||||
echo "*/"
|
||||
|
||||
printf "unsigned char $VAR[] = {\n\t"
|
||||
|
||||
for i in $(hexdump -v $FILE | sed 's/^.......//');
|
||||
do
|
||||
printf "0x%02X" 0x$i
|
||||
BYTES=$((BYTES - 1))
|
||||
if ((BYTES != 0))
|
||||
then
|
||||
printf ","
|
||||
fi
|
||||
EOL=$((EOL - 1))
|
||||
if ((EOL == 0))
|
||||
then
|
||||
EOL=8
|
||||
printf "\n\t"
|
||||
fi
|
||||
done
|
||||
|
||||
printf "\n};\n"
|
||||
}
|
||||
|
||||
cd asm
|
||||
make clean
|
||||
make
|
||||
PATH=../cc65-2.13.3/bin:$PATH make
|
||||
|
||||
(
|
||||
header loader loadercode 8
|
||||
header bar barcode 8
|
||||
echo "/*"
|
||||
expand loader.s
|
||||
echo "*/"
|
||||
/usr/bin/xxd -i loader | sed 's/loader/loadercode/'
|
||||
|
||||
echo "/*"
|
||||
expand bar.s
|
||||
echo "*/"
|
||||
/usr/bin/xxd -i bar | sed 's/bar/barcode/'
|
||||
) > ../c2d.h.1
|
||||
|
||||
cd ..
|
||||
|
Loading…
x
Reference in New Issue
Block a user