diff --git a/.travis.yml b/.travis.yml index ed09c6d..d9fe045 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ -dist: trusty +# Not using Travis anymore but keeping this for now. + +dist: bionic language: c sudo: false branches: @@ -7,8 +9,12 @@ branches: - /^\d+\.\d+(\.\d+)?(-\S*)?$/ addons: apt: + update: true packages: - texinfo + - openjdk-8-jdk-headless + - dos2unix + - g++ cache: directories: - build @@ -20,7 +26,7 @@ jobs: - make clean - stage: Setup toolchain script: - - make toolchain_clean + - make toolchain_clean - cd toolchain && make setup - stage: Build bintutils script: @@ -47,7 +53,7 @@ jobs: - make sgdk_samples - stage: release to github if: tag IS present - script: + script: - echo "Deploying to github..." - VER=$TRAVIS_TAG make release deploy: diff --git a/Dockerfile b/Dockerfile index ae8f258..487bf90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,45 @@ -FROM ubuntu:14.04 +FROM ubuntu:bionic as build -WORKDIR /tmp +ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y build-essential wget unzip unrar-free texinfo git && apt-get clean +ENV GENDEV /opt/gendev -RUN bash -c "git clone https://github.com/kubilus1/gendev.git && cd gendev && make && rm -rf /tmp/*" +RUN apt-get update && \ + apt-get install -y \ + build-essential \ + wget \ + unzip \ + unrar-free \ + texinfo \ + git \ + openjdk-8-jdk-headless && \ + apt-get clean -CMD /bin/bash +# To download gcc 6.3 with wget. We must provide a password with '@' in. +#RUN echo ftp_user=anonymous > ~/.wgetrc +#RUN echo ftp_password=dfdf@dfdf.com >> ~/.wgetrc + +#RUN bash -c "git clone https://github.com/kubilus1/gendev.git && cd gendev && make && rm -rf /tmp/*" +WORKDIR /work +COPY tools /work/tools/ +COPY Makefile /work/ +COPY sgdk /work/sgdk/ +COPY toolchain /work/toolchain/ +RUN make +RUN make install + +FROM ubuntu:bionic +RUN apt-get update && \ + apt-get install -y \ + openjdk-8-jre-headless \ + build-essential \ + make && \ + apt-get clean + +ENV GENDEV /opt/gendev +COPY --from=build /opt/gendev $GENDEV +ENV PATH $GENDEV/bin:$PATH + +WORKDIR /src + +ENTRYPOINT make -f $GENDEV/sgdk/mkfiles/makefile.gen diff --git a/Makefile b/Makefile index 170554d..324be8f 100644 --- a/Makefile +++ b/Makefile @@ -38,22 +38,24 @@ toolchain_build: toolchain_clean: cd toolchain && $(MAKE) toolchain_clean -tools_build: +tools_build: cd tools && $(MAKE) tools_build -tools_clean: +tools_clean: cd tools && $(MAKE) tools_clean sgdk_samples: cd sgdk && $(MAKE) sample_clean samples -install: +$(GENDEV): if [ -w /opt ]; then \ mkdir -p $(GENDEV); \ else \ $(SUDO) mkdir -p $@; \ $(SUDO) chown $(ORIG_USER):$(ORIG_USER) $@; \ fi + +install: $(GENDEV) echo "export GENDEV=$(GENDEV)" > ~/.gendev echo "export PATH=\$$GENDEV/bin:\$$PATH" >> ~/.gendev #$(SUDO) chmod 777 $@ @@ -80,7 +82,7 @@ dist/gendev_$(VER)_all.deb: pkg_build cd dist && dpkg-deb -Zxz -z9 --build $(TOPDIR)/pkg_build . sgdk_build: - cd sgdk && GENDEV=$(BUILDDIR) $(MAKE) install + cd sgdk && GENDEV=$(BUILDDIR) $(MAKE) install sgdk_clean: - cd sgdk && $(MAKE) clean @@ -97,4 +99,3 @@ clean: tools_clean toolchain_clean sgdk_clean ######################################################### ######################################################### ######################################################### - diff --git a/README.md b/README.md index 9191da3..df0ee0f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ BASIC INSTRUCTIONS The quickest way to get going would be to simply install one of the release packages for this project. Both a 'txz' and 'deb' package are provided. +To run SGDK or in our case, Gendev, you need following packages: + - texinfo + - openjdk-8-jdk + USAGE ===== @@ -51,19 +55,26 @@ PROJECT STRUCTURE TOOLCHAIN BUILDING ================== -The toolchain is now setup with Travis-CI for continuous integration. This +The toolchain is now setup with CircleCI for continuous integration. This should ease porting and allow better validation of incoming patches. -You may decide to build the full toolchain by making sure you have the texinfo -package installed, and then: +You may decide to build the full toolchain by making sure you have the following +package installed: + - git + - build-essential + - texinfo + - curl + - wget + - unzip +and then: ``` $ cd gendev $ make ``` ... and wait about 45 minutes or so. -The .travis-ci.yml script is a good place to look to see how the individual +The .circleci/config.yml script is a good place to look to see how the individual build stages are executed. @@ -85,7 +96,7 @@ maintain. I am attempting to: -1. Not necessarilly require building everything +1. Not necessarilly require building everything 2. Shorten the build time 3. Hook up with continuous integration tools 4. Reduce the footprint @@ -98,8 +109,8 @@ NOTES: * The 32x stuff is currently deprecated. I may create steps to build this toolchain again in the future. -* All testing is done on 64bit Ubuntu installations, specifically Zesty and - Trusty. Your mileage may vary with other distros. +* All testing is done on 64bit Ubuntu installations, specifically Bionic. + Your mileage may vary with other distros. * [FreeBSD instructions](doc/FreeBSD.md) * This project is still way too messy, and hopefully I have time to cleanup cruft bit by bit. diff --git a/examples/3d_example/Makefile b/examples/3d_example/Makefile deleted file mode 100644 index 98d0547..0000000 --- a/examples/3d_example/Makefile +++ /dev/null @@ -1,204 +0,0 @@ -GENDEV?=/opt/toolchains/gen/ -GCC_VER?=6.3.0 - -MAKE?=make -LIB?=lib -GENGCC_BIN=$(GENDEV)/bin -GENBIN=$(GENDEV)/bin - -CC = $(GENGCC_BIN)/m68k-elf-gcc -AS = $(GENGCC_BIN)/m68k-elf-as -AR = $(GENGCC_BIN)/m68k-elf-ar -LD = $(GENGCC_BIN)/m68k-elf-ld -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJC = $(GENGCC_BIN)/m68k-elf-objcopy -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp -XGMTOOL= $(GENBIN)/xgmtool -PCMTORAW = $(GENBIN)/pcmtoraw -WAVTORAW = $(GENBIN)/wavtoraw -SIZEBND = $(GENBIN)/sizebnd -ASMZ80 = $(GENBIN)/zasm - -RM = rm -f -NM = nm -NM2WCH = nm2wch -MKISOFS = mkisofs - -SCD_LOADER = scd/LukeProjectCD - -OPTION = -INCS = -I. -I$(GENDEV)/m68k-elf/include -I$(GENDEV)/sgdk/inc -Isrc -Ires -I$(GENDEV)/sgdk/res -CCFLAGS = $(OPTION) -m68000 -Wall -O2 -c -fomit-frame-pointer -HWCCFLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer -Z80FLAGS = -vb2 -ASFLAGS = -m68000 --register-prefix-optional -#LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/4.8.2 -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lc -lgcc -lnosys -lm -LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/* -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lnosys -LINKFLAGS = -T $(GENDEV)/sgdk/md.ld -Map=output.map -nostdlib -L$(GENDEV)/sgdk/lib -SCDLINKFLAGS = -T scd/mdcd.ld -nostdlib -ARCHIVES = $(GENDEV)/sgdk/lib/libmd.a - - -# Are we AMD64? -#LBITS := $(shell getconf LONG_BIT) -#ifeq ($(LBITS), 64) -#ARCHIVES += $(GENDEV)/m68k-elf/lib64/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#else -#ARCHIVES += $(GENDEV)/m68k-elf/lib/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#endif - -ARCHIVES += $(GENDEV)/$(LIB)/gcc/m68k-elf/$(GCC_VER)/libgcc.a - -RESOURCES= -BOOT_RESOURCES= - -BOOTSS=$(wildcard boot/*.s) -BOOTSS+=$(wildcard src/boot/*.s) -BOOT_RESOURCES+=$(BOOTSS:.s=.o) - -SCDBOOTSS=$(wildcard scd/*.s) -SCDBOOTSS+=$(wildcard src/scd/*.s) -SCDBOOT_RESOURCES=$(SCDBOOTSS:.s=.o) - -#BMPS=$(wildcard res/*.bmp) -#VGMS=$(wildcard res/*.vgm) -#RAWS=$(wildcard res/*.raw) -#PCMS=$(wildcard res/*.pcm) -#MVSS=$(wildcard res/*.mvs) -#TFDS=$(wildcard res/*.tfd) -#WAVS=$(wildcard res/*.wav) -RESS=$(wildcard res/*.res) -#WAVPCMS=$(wildcard res/*.wavpcm) -#BMPS+=$(wildcard *.bmp) -#VGMS+=$(wildcard *.vgm) -#RAWS+=$(wildcard *.raw) -#PCMS+=$(wildcard *.pcm) -#MVSS+=$(wildcard *.mvs) -#TFDS+=$(wildcard *.tfd) -#WAVS+=$(wildcard *.wav) -RESS+=$(wildcard *.res) -#WAVPCMS+=$(wildcard *.wavpcm) - -#RESOURCES+=$(BMPS:.bmp=.o) -#RESOURCES+=$(VGMS:.vgm=.o) -#RESOURCES+=$(RAWS:.raw=.o) -#RESOURCES+=$(PCMS:.pcm=.o) -#RESOURCES+=$(MVSS:.mvs=.o) -#RESOURCES+=$(TFDS:.tfd=.o) -#RESOURCES+=$(WAVS:.wav=.o) -#RESOURCES+=$(WAVPCMS:.wavpcm=.o) -RESOURCES+=$(RESS:.res=.o) - -CS=$(wildcard src/*.c) -SS=$(wildcard src/*.s) -S80S=$(wildcard src/*.s80) -CS+=$(wildcard *.c) -SS+=$(wildcard *.s) -S80S+=$(wildcard *.s80) -RESOURCES+=$(CS:.c=.o) -RESOURCES+=$(SS:.s=.o) -RESOURCES+=$(S80S:.s80=.o) - -OBJS = $(RESOURCES) - -all: out.bin - -boot/sega.o: boot/rom_head.bin - $(AS) $(ASFLAGS) boot/sega.s -o $@ - -scd/segacd.o: - $(AS) $(ASFLAGS) scd/segacd.s -o $@ - - -out.iso: out.elf_scd - # - # Create a sega cd image. Limited to 256K or smaller Roms - # - $(NM) -n -S -t x out.elf_scd > out.nm - $(OBJC) -O binary out.elf_scd out.bin - $(SIZEBND) out.bin -sizealign 131072 - $(OBJC) -O binary out.elf_scd $(SCD_LOADER)/_filesystem/M_INIT.PRG - $(SIZEBND) $(SCD_LOADER)/_filesystem/M_INIT.PRG -sizealign 131072 - $(MKISOFS) -iso-level 1 -o $(SCD_LOADER)/filesystem.img -pad $(SCD_LOADER)/_filesystem - tail -c +32769 $(SCD_LOADER)/filesystem.img > $(SCD_LOADER)/filesystem.bin - $(RM) -f $(SCD_LOADER)/filesystem.img - cd $(SCD_LOADER) && $(AS) $(ASFLAGS) -M -ahlsm=listing.asm main-us-as.asm -o out.iso - tail -c +53 $(SCD_LOADER)/out.iso > out.iso - $(RM) -f $(SCD_LOADER)/filesystem.bin - -%.bin: %.elf - $(OBJC) -O binary $< temp.bin - dd if=temp.bin of=$@ bs=8K conv=sync - -%.elf: $(OBJS) $(BOOT_RESOURCES) - $(LD) -o $@ $(LINKFLAGS) $(BOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.elf_scd: $(OBJS) $(SCDBOOT_RESOURCES) - $(LD) -o $@ $(SCDLINKFLAGS) $(SCDBOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.o80: %.s80 - $(ASMZ80) $(Z80FLAGS) -o $@ $< - -%.c: %.o80 - $(BINTOS) $< - -%.o: %.c - $(CC) $(CCFLAGS) $(INCS) -c $< -o $@ - -%.o: %.s - $(AS) $(ASFLAGS) $< -o $@ - -%.s: %.bmp - bintos -bmp $< - -%.rawpcm: %.pcm - $(PCMTORAW) $< $@ - -%.raw: %.wav - $(WAVTORAW) $< $@ 16000 - -%.pcm: %.wavpcm - $(WAVTORAW) $< $@ 22050 - -#%.tfc: %.tfd -# $(TFMCOM) $< - -#%.o80: %.s80 -# $(ASMZ80) $(FLAGSZ80) $< $@ out.lst - -%.s: %.tfd - $(BINTOS) -align 32768 $< - -%.s: %.mvs - $(BINTOS) -align 256 $< - -%.s: %.esf - $(BINTOS) -align 32768 $< - -%.s: %.eif - $(BINTOS) -align 256 $< - -%.s: %.vgm - $(BINTOS) -align 256 $< - -%.s: %.raw - $(BINTOS) -align 256 -sizealign 256 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.res - $(RESCOMP) $< $@ - -boot/rom_head.bin: boot/rom_head.o - $(LD) $(LINKFLAGS) --oformat binary -o $@ $< - - -clean: - $(RM) $(RESOURCES) - $(RM) *.o *.bin *.elf *.elf_scd *.map *.iso - $(RM) boot/*.o boot/*.bin diff --git a/examples/3d_example_2/Makefile b/examples/3d_example_2/Makefile deleted file mode 100644 index 3c3f601..0000000 --- a/examples/3d_example_2/Makefile +++ /dev/null @@ -1,204 +0,0 @@ -GENDEV?=/opt/toolchains/gen/ -GCC_VER?=4.8.2 - -MAKE?=make -LIB?=lib -GENGCC_BIN=$(GENDEV)/m68k-elf/bin -GENBIN=$(GENDEV)/bin - -CC = $(GENGCC_BIN)/m68k-elf-gcc -AS = $(GENGCC_BIN)/m68k-elf-as -AR = $(GENGCC_BIN)/m68k-elf-ar -LD = $(GENGCC_BIN)/m68k-elf-ld -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJC = $(GENGCC_BIN)/m68k-elf-objcopy -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp -XGMTOOL= $(GENBIN)/xgmtool -PCMTORAW = $(GENBIN)/pcmtoraw -WAVTORAW = $(GENBIN)/wavtoraw -SIZEBND = $(GENBIN)/sizebnd -ASMZ80 = $(GENBIN)/zasm - -RM = rm -f -NM = nm -NM2WCH = nm2wch -MKISOFS = mkisofs - -SCD_LOADER = scd/LukeProjectCD - -OPTION = -INCS = -I. -I$(GENDEV)/m68k-elf/include -I$(GENDEV)/m68k-elf/m68k-elf/include -Isrc -Ires -CCFLAGS = $(OPTION) -m68000 -Wall -O2 -c -fomit-frame-pointer -HWCCFLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer -Z80FLAGS = -vb2 -ASFLAGS = -m68000 --register-prefix-optional -#LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/4.8.2 -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lc -lgcc -lnosys -lm -LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/* -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lnosys -LINKFLAGS = -T $(GENDEV)/ldscripts/sgdk.ld -nostdlib -SCDLINKFLAGS = -T scd/mdcd.ld -nostdlib -ARCHIVES = $(GENDEV)/m68k-elf/lib/libmd.a - - -# Are we AMD64? -#LBITS := $(shell getconf LONG_BIT) -#ifeq ($(LBITS), 64) -#ARCHIVES += $(GENDEV)/m68k-elf/lib64/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#else -#ARCHIVES += $(GENDEV)/m68k-elf/lib/gcc/m68k-elf/$(GCC_VER)/libgcc.a -#endif - -ARCHIVES += $(GENDEV)/m68k-elf/$(LIB)/gcc/m68k-elf/$(GCC_VER)/libgcc.a - -RESOURCES= -BOOT_RESOURCES= - -BOOTSS=$(wildcard boot/*.s) -BOOTSS+=$(wildcard src/boot/*.s) -BOOT_RESOURCES+=$(BOOTSS:.s=.o) - -SCDBOOTSS=$(wildcard scd/*.s) -SCDBOOTSS+=$(wildcard src/scd/*.s) -SCDBOOT_RESOURCES=$(SCDBOOTSS:.s=.o) - -#BMPS=$(wildcard res/*.bmp) -#VGMS=$(wildcard res/*.vgm) -#RAWS=$(wildcard res/*.raw) -#PCMS=$(wildcard res/*.pcm) -#MVSS=$(wildcard res/*.mvs) -#TFDS=$(wildcard res/*.tfd) -#WAVS=$(wildcard res/*.wav) -RESS=$(wildcard res/*.res) -#WAVPCMS=$(wildcard res/*.wavpcm) -#BMPS+=$(wildcard *.bmp) -#VGMS+=$(wildcard *.vgm) -#RAWS+=$(wildcard *.raw) -#PCMS+=$(wildcard *.pcm) -#MVSS+=$(wildcard *.mvs) -#TFDS+=$(wildcard *.tfd) -#WAVS+=$(wildcard *.wav) -RESS+=$(wildcard *.res) -#WAVPCMS+=$(wildcard *.wavpcm) - -#RESOURCES+=$(BMPS:.bmp=.o) -#RESOURCES+=$(VGMS:.vgm=.o) -#RESOURCES+=$(RAWS:.raw=.o) -#RESOURCES+=$(PCMS:.pcm=.o) -#RESOURCES+=$(MVSS:.mvs=.o) -#RESOURCES+=$(TFDS:.tfd=.o) -#RESOURCES+=$(WAVS:.wav=.o) -#RESOURCES+=$(WAVPCMS:.wavpcm=.o) -RESOURCES+=$(RESS:.res=.o) - -CS=$(wildcard src/*.c) -SS=$(wildcard src/*.s) -S80S=$(wildcard src/*.s80) -CS+=$(wildcard *.c) -SS+=$(wildcard *.s) -S80S+=$(wildcard *.s80) -RESOURCES+=$(CS:.c=.o) -RESOURCES+=$(SS:.s=.o) -RESOURCES+=$(S80S:.s80=.o) - -OBJS = $(RESOURCES) - -all: out.bin - -boot/sega.o: boot/rom_head.bin - $(AS) $(ASFLAGS) boot/sega.s -o $@ - -scd/segacd.o: - $(AS) $(ASFLAGS) scd/segacd.s -o $@ - - -out.iso: out.elf_scd - # - # Create a sega cd image. Limited to 256K or smaller Roms - # - $(NM) -n -S -t x out.elf_scd > out.nm - $(OBJC) -O binary out.elf_scd out.bin - $(SIZEBND) out.bin -sizealign 131072 - $(OBJC) -O binary out.elf_scd $(SCD_LOADER)/_filesystem/M_INIT.PRG - $(SIZEBND) $(SCD_LOADER)/_filesystem/M_INIT.PRG -sizealign 131072 - $(MKISOFS) -iso-level 1 -o $(SCD_LOADER)/filesystem.img -pad $(SCD_LOADER)/_filesystem - tail -c +32769 $(SCD_LOADER)/filesystem.img > $(SCD_LOADER)/filesystem.bin - $(RM) -f $(SCD_LOADER)/filesystem.img - cd $(SCD_LOADER) && $(AS) $(ASFLAGS) -M -ahlsm=listing.asm main-us-as.asm -o out.iso - tail -c +53 $(SCD_LOADER)/out.iso > out.iso - $(RM) -f $(SCD_LOADER)/filesystem.bin - -%.bin: %.elf - $(OBJC) -O binary $< temp.bin - dd if=temp.bin of=$@ bs=8K conv=sync - -%.elf: $(OBJS) $(BOOT_RESOURCES) - $(CC) -o $@ $(LINKFLAGS) $(BOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.elf_scd: $(OBJS) $(SCDBOOT_RESOURCES) - $(CC) -o $@ $(SCDLINKFLAGS) $(SCDBOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS) - -%.o80: %.s80 - $(ASMZ80) $(Z80FLAGS) -o $@ $< - -%.c: %.o80 - $(BINTOS) $< - -%.o: %.c - $(CC) $(CCFLAGS) $(INCS) -c $< -o $@ - -%.o: %.s - $(AS) $(ASFLAGS) $< -o $@ - -%.s: %.bmp - bintos -bmp $< - -%.rawpcm: %.pcm - $(PCMTORAW) $< $@ - -%.raw: %.wav - $(WAVTORAW) $< $@ 16000 - -%.pcm: %.wavpcm - $(WAVTORAW) $< $@ 22050 - -#%.tfc: %.tfd -# $(TFMCOM) $< - -#%.o80: %.s80 -# $(ASMZ80) $(FLAGSZ80) $< $@ out.lst - -%.s: %.tfd - $(BINTOS) -align 32768 $< - -%.s: %.mvs - $(BINTOS) -align 256 $< - -%.s: %.esf - $(BINTOS) -align 32768 $< - -%.s: %.eif - $(BINTOS) -align 256 $< - -%.s: %.vgm - $(BINTOS) -align 256 $< - -%.s: %.raw - $(BINTOS) -align 256 -sizealign 256 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.rawpcm - $(BINTOS) -align 128 -sizealign 128 -nullfill 136 $< - -%.s: %.res - $(RESCOMP) $< $@ - -boot/rom_head.bin: boot/rom_head.o - $(LD) $(LINKFLAGS) --oformat binary -o $@ $< - - -clean: - $(RM) $(RESOURCES) - $(RM) *.o *.bin *.elf *.elf_scd *.map *.iso - $(RM) boot/*.o boot/*.bin diff --git a/examples/3d_example_2/main.c b/examples/3d_example_2/main.c index 128efee..f6dd445 100644 --- a/examples/3d_example_2/main.c +++ b/examples/3d_example_2/main.c @@ -2,7 +2,7 @@ #include "meshs.h" -#define MAX_POINTS 256 +#define MAX_POINTS 256 #define DEBUG 0 @@ -27,7 +27,7 @@ Transformation3D transformation; Vect3D_f16 rotstep; -Vect3D_f16 camvec = {FIX16(0),FIX16(0),FIX16(12)}; +Vect3D_f16 camvec = {FIX16(0),FIX16(0),FIX16(12)}; u16 flatDrawing; @@ -53,50 +53,50 @@ fix16 get_distance(Vect3D_f16 v1, Vect3D_f16 v2) { //fix16 distance_2 = fix16Sqrt((xd*xd + yd*yd + zd*zd)); //fix16 distance_2 = fix16Sqrt(xd*xd+yd*yd+zd*zd); - // Taxicab distance for now + // Taxicab distance for now #if 1 return (abs(v2.x-v1.x) + abs(v2.y-v1.y) + abs(v2.z-v1.z)); #endif } -u16 Partition_polymesh(polymesh **data, u16 p, u16 r) -{ - polymesh* x = data[p]; - u16 i = p - 1; - u16 j = r + 1; - - while (TRUE) - { - i++; - while ((i < r) && (data[i]->distance < x->distance)) i++; - j--; - while ((j > p) && (data[j]->distance > x->distance)) j--; - - if (i < j) - { - polymesh* tmp; - - tmp = data[i]; - data[i] = data[j]; - data[j] = tmp; - } - else - return j; - } -} - +u16 Partition_polymesh(polymesh **data, u16 p, u16 r) +{ + polymesh* x = data[p]; + u16 i = p - 1; + u16 j = r + 1; + + while (TRUE) + { + i++; + while ((i < r) && (data[i]->distance < x->distance)) i++; + j--; + while ((j > p) && (data[j]->distance > x->distance)) j--; + + if (i < j) + { + polymesh* tmp; + + tmp = data[i]; + data[i] = data[j]; + data[j] = tmp; + } + else + return j; + } +} + void sort_polymeshs(polymesh** data, u16 p, u16 r) { - if (p < r) - { - u16 q = Partition_polymesh(data, p, r); - sort_polymeshs(data, p, q); - sort_polymeshs(data, q + 1, r); - } + if (p < r) + { + u16 q = Partition_polymesh(data, p, r); + sort_polymeshs(data, p, q); + sort_polymeshs(data, q + 1, r); + } } void render(polymesh** poly_list, u8 list_len, Transformation3D* transform) { Vect3D_f16 v1; -#if DEBUG +#if DEBUG Vect2D_s16 cpts_2D[10]; #endif u8 i; @@ -112,7 +112,7 @@ void render(polymesh** poly_list, u8 list_len, Transformation3D* transform) { } M3D_transform(transform, stars_3D, stars_t3D, NUM_STARS); - M3D_project_s16(stars_t3D, stars_t2D, NUM_STARS); + M3D_project_s16(stars_t3D, stars_t2D, NUM_STARS); BMP_setPixels_V2D(stars_t2D, 15, NUM_STARS); #if DEBUG @@ -149,7 +149,7 @@ void render(polymesh** poly_list, u8 list_len, Transformation3D* transform) { m.pt1.y-=20; BMP_drawLine(&m); - + m.pt1 = cpts_2D[i]; m.pt2 = cpts_2D[i]; @@ -178,7 +178,7 @@ int main() JOY_setEventHandler(handleJoyEvent); //BMP_init(TRUE, PAL1, FALSE); - BMP_init(FALSE, PAL0, FALSE); + BMP_init(TRUE, PLAN_A, PAL1, FALSE); //BGR ? @@ -208,11 +208,11 @@ int main() flatDrawing = 1; rotstep.y = FIX16(0.2); - + light_mask[0] = 0x00; - light_mask[1] = 0x10; + light_mask[1] = 0x10; light_mask[2] = 0x20; - + int i; for(i=0;ix) + fix16Mul(transformation.lightInv.y, norm->y) + fix16Mul(transformation.lightInv.z, norm->z); col = *base_col + pal_offset; - + if (dp > 0) { light += (dp >> (FIX16_FRAC_BITS - 1)); if (light >= 3) { @@ -309,7 +309,7 @@ void drawPoints(u8 col, polymesh inpoly) } else { col = light_mask[light] | col; } - } else { + } else { col = light_mask[0] | col; } @@ -323,7 +323,7 @@ void drawPoints(u8 col, polymesh inpoly) #endif } else { #if DEBUG - BMP_drawText("CULLED", 10, i); + BMP_drawText("CULLED", 10, i); #endif } base_col++; @@ -338,7 +338,7 @@ void drawPoints(u8 col, polymesh inpoly) l.col = col; line_ind = inpoly.line_ind; - + // Number of lines i = inpoly.num_edges; diff --git a/pkg/DEBIAN/control b/pkg/DEBIAN/control index 81a189c..9bddf11 100644 --- a/pkg/DEBIAN/control +++ b/pkg/DEBIAN/control @@ -3,7 +3,7 @@ Version: ##VER## Section: devel Priority: optional Maintainer: Matt Kubilus (mattkubilus) -Depends: texinfo +Depends: texinfo, openjdk-8-jre, make Architecture: all Homepage: https://github.com/kubilus1/gendev Description: Sega Genesis development on *nix. diff --git a/sgdk/.gitattributes b/sgdk/.gitattributes new file mode 100644 index 0000000..1f8138b --- /dev/null +++ b/sgdk/.gitattributes @@ -0,0 +1 @@ +* -crlf diff --git a/sgdk/Makefile b/sgdk/Makefile index 62c6929..233b812 100644 --- a/sgdk/Makefile +++ b/sgdk/Makefile @@ -4,47 +4,33 @@ GENGCC_BIN=$(GENDEV)/bin SGDKDIR=$(CURDIR)/SGDK SAMPLESDIR=$(SGDKDIR)/sample -SGDKVER=1.34 +SGDKVER=v1.40 SGDKINSTALLDIR=$(GENDEV)/sgdk$(SGDKVER) - -all: tools $(SGDKDIR) $(SGDKDIR)/libmd.a +all: tools $(SGDKDIR) $(SGDKDIR)/libmd.a tools: $(SGDKDIR) cd $(SGDKDIR)/tools/bintos/src && \ gcc -o bintos bintos.c && cp bintos $(GENDEV)/bin/. - cd $(SGDKDIR)/tools/pcmtoraw/src && \ - gcc -o pcmtoraw pcmtoraw.c && cp pcmtoraw $(GENDEV)/bin/. cd $(SGDKDIR)/tools/sizebnd/src && \ gcc -o sizebnd sizebnd.c && cp sizebnd $(GENDEV)/bin/. - cd $(SGDKDIR)/tools/wavtoraw/src && \ - gcc -o wavtoraw wavtoraw.c -lm && cp wavtoraw $(GENDEV)/bin/. cd $(SGDKDIR)/tools/xgmtool && \ $(MAKE) -f ../../../files/Makefile.xgmtool && cp out/xgmtool $(GENDEV)/bin/. - cd $(SGDKDIR)/tools/rescomp && \ - $(MAKE) -f ../../../files/Makefile.rescomp && cp out/rescomp $(GENDEV)/bin/. - #patch -u -p0 < ../../../files/rescomp.diff && \ - # - cp $(SGDKDIR)/bin/lz4w.jar $(GENDEV)/bin/. + cp $(SGDKDIR)/bin/*.jar $(GENDEV)/bin/. -patch: - cd $(SGDKDIR) && git diff * > ../files/sgdk_$(SGDKVER).diff +patch: $(SGDKDIR) + cd $(SGDKDIR) && git diff . > ../files/sgdk_$(SGDKVER).diff -prep: - cd $(SGDKDIR) && patch -u -p1 < ../files/sgdk_$(SGDKVER).diff +prep: $(SGDKDIR) + cd $(SGDKDIR) && patch -u -p1 -l < ../files/sgdk_$(SGDKVER).diff $(SGDKDIR): git clone -b '$(SGDKVER)' --single-branch --depth 1 https://github.com/Stephane-D/SGDK.git - #git clone https://github.com/Stephane-D/SGDK.git - #cd $(SGDKDIR) && $ git checkout tags/$(SGDKVER) - cd $(SGDKDIR) && patch -u -p1 < ../files/sgdk_$(SGDKVER).diff - #cp files/makefile.vars $(SGDKDIR)/. - #git clone https://github.com/kubilus1/SGDK.git $(SGDKDIR) - #patch -u -p0 < files/sgdk.diff -$(SGDKDIR)/libmd.a: $(SGDKDIR) +$(SGDKDIR)/libmd.a: prep + cp -rf ../tools/files/applib/lib $(SGDKDIR)/tools/appack cd $(SGDKDIR) && ln -sf ../files/Makefile.sgdk_lib . - cd $(SGDKDIR) && $(MAKE) -f Makefile.sgdk_lib + cd $(SGDKDIR) && $(MAKE) -f Makefile.sgdk_lib $(SGDKINSTALLDIR): mkdir -p $@ @@ -58,9 +44,7 @@ install: tools $(SGDKDIR)/libmd.a $(SGDKINSTALLDIR) mkdir -p $(GENDEV)/sgdk/lib mkdir -p $(GENDEV)/sgdk/res mkdir -p $(GENDEV)/sgdk/mkfiles - #cd $(SGDKDIR) && $(MAKE) -f Makefile.sgdk_lib install cp $(SGDKDIR)/md.ld $(GENDEV)/sgdk/. - #cp -r ./skeleton $(GENDEV)/. cp $(SGDKDIR)/inc/* $(GENDEV)/sgdk/inc/. cp -r $(SGDKDIR)/src/boot $(GENDEV)/sgdk/src/. cp -r $(SGDKDIR)/res/* $(GENDEV)/sgdk/res/. @@ -68,6 +52,7 @@ install: tools $(SGDKDIR)/libmd.a $(SGDKINSTALLDIR) cp $(SGDKDIR)/libmd.a $(GENDEV)/sgdk/lib/. cp $(SGDKDIR)/makefile.gen $(GENDEV)/sgdk/mkfiles/. cp files/makefile.vars $(GENDEV)/sgdk/mkfiles/. + cp $(SGDKDIR)/tools/sizebnd/src/sizebnd $(GENDEV)/bin/ SAMPLES=$(wildcard $(SAMPLESDIR)/*/out) SAMPLEROMS=$(addsuffix /rom.bin,$(SAMPLES)) @@ -78,7 +63,7 @@ sample_clean: $(CLEANSAMPLES) @echo "Done cleaning samples" $(CLEANSAMPLES): - cd $@/.. && $(MAKE) -f $(GENDEV)/sgdk/mkfiles/makefile.gen clean + cd $@/.. && $(MAKE) -f $(SGDKDIR)/makefile.gen clean samples: $(SAMPLEROMS) @echo "All samples built" diff --git a/sgdk/files/Makefile.rescomp b/sgdk/files/Makefile.rescomp deleted file mode 100644 index edd573e..0000000 --- a/sgdk/files/Makefile.rescomp +++ /dev/null @@ -1,198 +0,0 @@ -#------------------------------------------------------------------------------# -# This makefile was generated by 'cbp2make' tool rev.147 # -#------------------------------------------------------------------------------# - - -WORKDIR = `pwd` - -CC = gcc -CXX = g++ -AR = ar -LD = g++ -WINDRES = windres - -INC = -CFLAGS = -Wall -RESINC = -LIBDIR = -LIB = -LDFLAGS = - -INC_DEBUG = $(INC) -CFLAGS_DEBUG = $(CFLAGS) -g -RESINC_DEBUG = $(RESINC) -RCFLAGS_DEBUG = $(RCFLAGS) -LIBDIR_DEBUG = $(LIBDIR) -LIB_DEBUG = $(LIB) -LDFLAGS_DEBUG = $(LDFLAGS) -OBJDIR_DEBUG = out -DEP_DEBUG = -OUT_DEBUG = out/rescomp - -INC_RELEASE = $(INC) -CFLAGS_RELEASE = $(CFLAGS) -O2 -RESINC_RELEASE = $(RESINC) -RCFLAGS_RELEASE = $(RCFLAGS) -LIBDIR_RELEASE = $(LIBDIR) -LIB_RELEASE = $(LIB) -LDFLAGS_RELEASE = $(LDFLAGS) -s -OBJDIR_RELEASE = out -DEP_RELEASE = -OUT_RELEASE = out/rescomp - -OBJ_DEBUG = $(OBJDIR_DEBUG)/src/snd_tools.o $(OBJDIR_DEBUG)/src/bin.o $(OBJDIR_DEBUG)/src/bitmap.o $(OBJDIR_DEBUG)/src/image.o $(OBJDIR_DEBUG)/src/img_tools.o $(OBJDIR_DEBUG)/src/libpng.o $(OBJDIR_DEBUG)/src/map.o $(OBJDIR_DEBUG)/src/palette.o $(OBJDIR_DEBUG)/src/pcm.o $(OBJDIR_DEBUG)/src/rescomp.o $(OBJDIR_DEBUG)/src/spr_tools.o $(OBJDIR_DEBUG)/src/sprite.o $(OBJDIR_DEBUG)/src/tfmmusic.o $(OBJDIR_DEBUG)/src/tile_tools.o $(OBJDIR_DEBUG)/src/tileset.o $(OBJDIR_DEBUG)/src/tools.o $(OBJDIR_DEBUG)/src/vgmmusic.o $(OBJDIR_DEBUG)/src/wav.o $(OBJDIR_DEBUG)/src/xgmmusic.o - -OBJ_RELEASE = $(OBJDIR_RELEASE)/src/snd_tools.o $(OBJDIR_RELEASE)/src/bin.o $(OBJDIR_RELEASE)/src/bitmap.o $(OBJDIR_RELEASE)/src/image.o $(OBJDIR_RELEASE)/src/img_tools.o $(OBJDIR_RELEASE)/src/libpng.o $(OBJDIR_RELEASE)/src/map.o $(OBJDIR_RELEASE)/src/palette.o $(OBJDIR_RELEASE)/src/pcm.o $(OBJDIR_RELEASE)/src/rescomp.o $(OBJDIR_RELEASE)/src/spr_tools.o $(OBJDIR_RELEASE)/src/sprite.o $(OBJDIR_RELEASE)/src/tfmmusic.o $(OBJDIR_RELEASE)/src/tile_tools.o $(OBJDIR_RELEASE)/src/tileset.o $(OBJDIR_RELEASE)/src/tools.o $(OBJDIR_RELEASE)/src/vgmmusic.o $(OBJDIR_RELEASE)/src/wav.o $(OBJDIR_RELEASE)/src/xgmmusic.o - -all: debug release - -clean: clean_debug clean_release - -before_debug: - test -d out || mkdir -p out - test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src - -after_debug: - -debug: before_debug out_debug after_debug - -out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG) - $(LD) $(LIBDIR_DEBUG) -o $(OUT_DEBUG) $(OBJ_DEBUG) $(LDFLAGS_DEBUG) $(LIB_DEBUG) - -$(OBJDIR_DEBUG)/src/snd_tools.o: src/snd_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/snd_tools.c -o $(OBJDIR_DEBUG)/src/snd_tools.o - -$(OBJDIR_DEBUG)/src/bin.o: src/bin.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/bin.c -o $(OBJDIR_DEBUG)/src/bin.o - -$(OBJDIR_DEBUG)/src/bitmap.o: src/bitmap.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/bitmap.c -o $(OBJDIR_DEBUG)/src/bitmap.o - -$(OBJDIR_DEBUG)/src/image.o: src/image.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/image.c -o $(OBJDIR_DEBUG)/src/image.o - -$(OBJDIR_DEBUG)/src/img_tools.o: src/img_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/img_tools.c -o $(OBJDIR_DEBUG)/src/img_tools.o - -$(OBJDIR_DEBUG)/src/libpng.o: src/libpng.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/libpng.c -o $(OBJDIR_DEBUG)/src/libpng.o - -$(OBJDIR_DEBUG)/src/map.o: src/map.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/map.c -o $(OBJDIR_DEBUG)/src/map.o - -$(OBJDIR_DEBUG)/src/palette.o: src/palette.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/palette.c -o $(OBJDIR_DEBUG)/src/palette.o - -$(OBJDIR_DEBUG)/src/pcm.o: src/pcm.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/pcm.c -o $(OBJDIR_DEBUG)/src/pcm.o - -$(OBJDIR_DEBUG)/src/rescomp.o: src/rescomp.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/rescomp.c -o $(OBJDIR_DEBUG)/src/rescomp.o - -$(OBJDIR_DEBUG)/src/spr_tools.o: src/spr_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/spr_tools.c -o $(OBJDIR_DEBUG)/src/spr_tools.o - -$(OBJDIR_DEBUG)/src/sprite.o: src/sprite.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/sprite.c -o $(OBJDIR_DEBUG)/src/sprite.o - -$(OBJDIR_DEBUG)/src/tfmmusic.o: src/tfmmusic.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tfmmusic.c -o $(OBJDIR_DEBUG)/src/tfmmusic.o - -$(OBJDIR_DEBUG)/src/tile_tools.o: src/tile_tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tile_tools.c -o $(OBJDIR_DEBUG)/src/tile_tools.o - -$(OBJDIR_DEBUG)/src/tileset.o: src/tileset.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tileset.c -o $(OBJDIR_DEBUG)/src/tileset.o - -$(OBJDIR_DEBUG)/src/tools.o: src/tools.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/tools.c -o $(OBJDIR_DEBUG)/src/tools.o - -$(OBJDIR_DEBUG)/src/vgmmusic.o: src/vgmmusic.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/vgmmusic.c -o $(OBJDIR_DEBUG)/src/vgmmusic.o - -$(OBJDIR_DEBUG)/src/wav.o: src/wav.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/wav.c -o $(OBJDIR_DEBUG)/src/wav.o - -$(OBJDIR_DEBUG)/src/xgmmusic.o: src/xgmmusic.c - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/xgmmusic.c -o $(OBJDIR_DEBUG)/src/xgmmusic.o - -clean_debug: - rm -f $(OBJ_DEBUG) $(OUT_DEBUG) - rm -rf out - rm -rf $(OBJDIR_DEBUG)/src - -before_release: - test -d out || mkdir -p out - test -d $(OBJDIR_RELEASE)/src || mkdir -p $(OBJDIR_RELEASE)/src - -after_release: - -release: before_release out_release after_release - -out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE) - $(LD) $(LIBDIR_RELEASE) -o $(OUT_RELEASE) $(OBJ_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE) - -$(OBJDIR_RELEASE)/src/snd_tools.o: src/snd_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/snd_tools.c -o $(OBJDIR_RELEASE)/src/snd_tools.o - -$(OBJDIR_RELEASE)/src/bin.o: src/bin.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/bin.c -o $(OBJDIR_RELEASE)/src/bin.o - -$(OBJDIR_RELEASE)/src/bitmap.o: src/bitmap.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/bitmap.c -o $(OBJDIR_RELEASE)/src/bitmap.o - -$(OBJDIR_RELEASE)/src/image.o: src/image.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/image.c -o $(OBJDIR_RELEASE)/src/image.o - -$(OBJDIR_RELEASE)/src/img_tools.o: src/img_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/img_tools.c -o $(OBJDIR_RELEASE)/src/img_tools.o - -$(OBJDIR_RELEASE)/src/libpng.o: src/libpng.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/libpng.c -o $(OBJDIR_RELEASE)/src/libpng.o - -$(OBJDIR_RELEASE)/src/map.o: src/map.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/map.c -o $(OBJDIR_RELEASE)/src/map.o - -$(OBJDIR_RELEASE)/src/palette.o: src/palette.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/palette.c -o $(OBJDIR_RELEASE)/src/palette.o - -$(OBJDIR_RELEASE)/src/pcm.o: src/pcm.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/pcm.c -o $(OBJDIR_RELEASE)/src/pcm.o - -$(OBJDIR_RELEASE)/src/rescomp.o: src/rescomp.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/rescomp.c -o $(OBJDIR_RELEASE)/src/rescomp.o - -$(OBJDIR_RELEASE)/src/spr_tools.o: src/spr_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/spr_tools.c -o $(OBJDIR_RELEASE)/src/spr_tools.o - -$(OBJDIR_RELEASE)/src/sprite.o: src/sprite.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/sprite.c -o $(OBJDIR_RELEASE)/src/sprite.o - -$(OBJDIR_RELEASE)/src/tfmmusic.o: src/tfmmusic.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tfmmusic.c -o $(OBJDIR_RELEASE)/src/tfmmusic.o - -$(OBJDIR_RELEASE)/src/tile_tools.o: src/tile_tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tile_tools.c -o $(OBJDIR_RELEASE)/src/tile_tools.o - -$(OBJDIR_RELEASE)/src/tileset.o: src/tileset.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tileset.c -o $(OBJDIR_RELEASE)/src/tileset.o - -$(OBJDIR_RELEASE)/src/tools.o: src/tools.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tools.c -o $(OBJDIR_RELEASE)/src/tools.o - -$(OBJDIR_RELEASE)/src/vgmmusic.o: src/vgmmusic.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/vgmmusic.c -o $(OBJDIR_RELEASE)/src/vgmmusic.o - -$(OBJDIR_RELEASE)/src/wav.o: src/wav.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/wav.c -o $(OBJDIR_RELEASE)/src/wav.o - -$(OBJDIR_RELEASE)/src/xgmmusic.o: src/xgmmusic.c - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/xgmmusic.c -o $(OBJDIR_RELEASE)/src/xgmmusic.o - -clean_release: - rm -f $(OBJ_RELEASE) $(OUT_RELEASE) - rm -rf out - rm -rf $(OBJDIR_RELEASE)/src - -.PHONY: before_debug after_debug clean_debug before_release after_release clean_release - diff --git a/sgdk/files/Makefile.sgdk_lib b/sgdk/files/Makefile.sgdk_lib index a4bdf15..031fec2 100644 --- a/sgdk/files/Makefile.sgdk_lib +++ b/sgdk/files/Makefile.sgdk_lib @@ -3,16 +3,16 @@ MAKE?=make GENGCC_BIN=$(GENDEV)/bin GENBIN=$(GENDEV)/bin -CC = $(GENGCC_BIN)/m68k-elf-gcc -AR = $(GENGCC_BIN)/m68k-elf-ar -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJC = $(GENGCC_BIN)/m68k-elf-objcopy -RM = rm -f -ASMZ80 = $(GENBIN)/sjasm -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp +CC = $(GENGCC_BIN)/m68k-elf-gcc +AR = $(GENGCC_BIN)/m68k-elf-ar +RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib +OBJC = $(GENGCC_BIN)/m68k-elf-objcopy +RM = rm -f +ASMZ80 = $(GENBIN)/sjasm +BINTOS = $(GENBIN)/bintos +RESCOMP= java -jar ./bin/rescomp.jar -OPTION= -Dnologo_ +OPTION= -Dnologo_ CS=$(wildcard src/*.c) SS=$(wildcard src/*.s) @@ -24,41 +24,46 @@ RESOURCES+=$(CS:.c=.o) RESOURCES+=$(SS:.s=.o) RESOURCES+=$(S80S:.s80=.o) - libmd.a_OBJS=$(RESOURCES) INCS = -Iinc -Ires -FLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer $(INCS) -FLAGSZ80 = -isrc -iinc +FLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer $(INCS) +FLAGSZ80 = -isrc -iinc + +all: appack $(libmd.a_OBJS) libmd.a -all: $(libmd.a_OBJS) libmd.a +appack: + echo -n "osBits="> tools/appack/makefile.vars + getconf LONG_BIT >> tools/appack/makefile.vars + cd tools/appack/ && make -f makefile.elf + cp tools/appack/appack bin/ -%.a: $(libmd.a_OBJS) - $(RM) $@ - $(AR) cru $@ $($@_OBJS) - $(RANLIB) $@ +%.a: $(libmd.a_OBJS) + $(RM) $@ + $(AR) cru $@ $($@_OBJS) + $(RANLIB) $@ -%.o80: %.s80 - $(ASMZ80) $(FLAGSZ80) $< $@ out.lst +%.o80: %.s80 + $(ASMZ80) $(FLAGSZ80) $< $@ out.lst -%.s: %.o80 - $(BINTOS) $< +%.s: %.o80 + $(BINTOS) $< -%.o: %.c - $(CC) $(FLAGS) -c $< -o $@ +%.o: %.c + $(CC) $(FLAGS) -c $< -o $@ -%.o: %.s - $(CC) $(FLAGS) -c $< -o $@ +%.o: %.s + $(CC) $(FLAGS) -c $< -o $@ %.s: %.res $(RESCOMP) $< $@ -clean: - #$(RM) -f z80_drv1.c z80_drv2.c +clean: + #$(RM) -f z80_drv1.c z80_drv2.c $(RM) $(RESOURCES) - $(RM) -rf *.o *.a *.o80 *.log *.lst + $(RM) -rf *.o *.a *.o80 *.log *.lst -install: all - cp inc/*.h $(GENDEV)/m68k-elf/include - cp res/*.h $(GENDEV)/m68k-elf/include - cp libmd.a $(GENDEV)/m68k-elf/lib +install: all + cp inc/*.h $(GENDEV)/m68k-elf/include + cp res/*.h $(GENDEV)/m68k-elf/include + cp libmd.a $(GENDEV)/m68k-elf/lib diff --git a/sgdk/files/makefile.vars b/sgdk/files/makefile.vars index 670ca5e..65a3383 100644 --- a/sgdk/files/makefile.vars +++ b/sgdk/files/makefile.vars @@ -1,9 +1,21 @@ +############################################################################### +# Gendev specific vars PATH := $(GENDEV)/bin:$(PATH) GENGCC_BIN= $(GENDEV)/bin GENBIN= $(GENDEV)/bin GDK= $(GENDEV)/sgdk + +AS = $(GENGCC_BIN)/m68k-elf-as +AR = $(GENGCC_BIN)/m68k-elf-ar +RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib +NM2WCH = nm2wch +MKISOFS = mkisofs + +############################################################################### +# SGDK overrid vars LIB= $(GENDEV)/sgdk/lib + LIBSRC= $(GENDEV)/sgdk/src LIBRES= $(GENDEV)/sgdk/res LIBINCLUDE= $(GENDEV)/sgdk/inc @@ -12,28 +24,18 @@ SRC= src RES= res INCLUDE= inc -#MACCER= $(BIN)/mac68k - -MKDIR= mkdir -ECHO= echo -CP= cp SHELL= sh - -CC = $(GENGCC_BIN)/m68k-elf-gcc -AS = $(GENGCC_BIN)/m68k-elf-as -AR = $(GENGCC_BIN)/m68k-elf-ar +RM = rm -f +CP= cp +CC = $(GENGCC_BIN)/m68k-elf-gcc LD = $(GENGCC_BIN)/m68k-elf-ld -RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib -OBJCPY = $(GENGCC_BIN)/m68k-elf-objcopy -BINTOS = $(GENBIN)/bintos -RESCOMP= $(GENBIN)/rescomp -XGMTOOL= $(GENBIN)/xgmtool -PCMTORAW = $(GENBIN)/pcmtoraw -WAVTORAW = $(GENBIN)/wavtoraw -SIZEBND = $(GENBIN)/sizebnd -ASMZ80 = $(GENBIN)/zasm - -RM = rm -f NM = nm -NM2WCH = nm2wch -MKISOFS = mkisofs +#JAVA= java +ECHO= echo +OBJCPY = $(GENGCC_BIN)/m68k-elf-objcopy +ASMZ80 = $(GENBIN)/zasm +#MACCER= $(BIN)/mac68k +SIZEBND= $(GENGCC_BIN)/sizebnd +BINTOS = $(GENBIN)/bintos +RESCOMP= $(JAVA) -jar $(GENBIN)/rescomp.jar +MKDIR= mkdir diff --git a/sgdk/files/sgdk_1.34.diff b/sgdk/files/sgdk_1.34.diff index f530a27..ab0efa4 100644 --- a/sgdk/files/sgdk_1.34.diff +++ b/sgdk/files/sgdk_1.34.diff @@ -3,14 +3,14 @@ index b9d7877..07d96af 100644 --- a/makefile.gen +++ b/makefile.gen @@ -24,6 +24,8 @@ BINTOS= $(BIN)/bintos - RESCOMP= $(BIN)/rescomp - MKDIR= $(BIN)/mkdir - -+include $(GENDEV)/sgdk/mkfiles/makefile.vars -+ - SRC_C= $(wildcard *.c) - SRC_C+= $(wildcard $(SRC)/*.c) - SRC_S= $(wildcard *.s) + RESCOMP= $(BIN)/rescomp + MKDIR= $(BIN)/mkdir + ++include $(GENDEV)/sgdk/mkfiles/makefile.vars ++ + SRC_C= $(wildcard *.c) + SRC_C+= $(wildcard $(SRC)/*.c) + SRC_S= $(wildcard *.s) diff --git a/res/libres.h b/res/libres.h index 1f6155d..f31e5b5 100644 --- a/res/libres.h @@ -54,49 +54,49 @@ index 24d748b..ab8eb69 100644 --- a/sample/sound/res/resources.res +++ b/sample/sound/res/resources.res @@ -7,7 +7,7 @@ XGM midnight "midnight.vgm" - VGM roadrash "roadrash.vgm" - VGM sonic1 "sonic1.vgm" - VGM bapcm_vgm "bad_apple_pcm.vgm" --TFM music_tfd "music_tfd.tfd" 1 -+#TFM music_tfd "music_tfd.tfd" 1 - BIN music_mvs "music_mvs.mvs" 256 - - WAV india_8k "india_8k.wav" 0 8000 + VGM roadrash "roadrash.vgm" + VGM sonic1 "sonic1.vgm" + VGM bapcm_vgm "bad_apple_pcm.vgm" +-TFM music_tfd "music_tfd.tfd" 1 ++#TFM music_tfd "music_tfd.tfd" 1 + BIN music_mvs "music_mvs.mvs" 256 + + WAV india_8k "india_8k.wav" 0 8000 diff --git a/sample/sound/src/main.c b/sample/sound/src/main.c index 117e891..498160b 100644 --- a/sample/sound/src/main.c +++ b/sample/sound/src/main.c @@ -568,19 +568,6 @@ static void joyEvent(u16 joy, u16 changed, u16 state) - break; - } - -- case Z80_DRIVER_TFM: -- { -- if (changed & state & BUTTON_A) -- { -- SND_startPlay_TFM(music_tfd); -- } -- if (changed & state & BUTTON_START) -- { -- SND_stopPlay_TFM(); -- } -- break; -- } -- - case Z80_DRIVER_VGM: - { - if (changed & state & BUTTON_X) + break; + } + +- case Z80_DRIVER_TFM: +- { +- if (changed & state & BUTTON_A) +- { +- SND_startPlay_TFM(music_tfd); +- } +- if (changed & state & BUTTON_START) +- { +- SND_stopPlay_TFM(); +- } +- break; +- } +- + case Z80_DRIVER_VGM: + { + if (changed & state & BUTTON_X) diff --git a/src/z80_drv1.h b/src/z80_drv1.h index 06adade..a2da7b8 100644 --- a/src/z80_drv1.h +++ b/src/z80_drv1.h @@ -1,6 +1,6 @@ --#ifndef _Z80_DRV1_H_ --#define _Z80_DRV1_H_ -- --extern const u8 z80_drv1[0xB2B]; -- --#endif // _Z80_DRV1_H_ +-#ifndef _Z80_DRV1_H_ +-#define _Z80_DRV1_H_ +- +-extern const u8 z80_drv1[0xB2B]; +- +-#endif // _Z80_DRV1_H_ +#ifndef _Z80_DRV1_H_ +#define _Z80_DRV1_H_ + @@ -108,12 +108,12 @@ index 3598de1..7ef3aba 100644 --- a/src/z80_drv2.h +++ b/src/z80_drv2.h @@ -1,6 +1,6 @@ --#ifndef _Z80_DRV2_H_ --#define _Z80_DRV2_H_ -- --extern const u8 z80_drv2[0xE00]; -- --#endif // _Z80_DRV2_H_ +-#ifndef _Z80_DRV2_H_ +-#define _Z80_DRV2_H_ +- +-extern const u8 z80_drv2[0xE00]; +- +-#endif // _Z80_DRV2_H_ +#ifndef _Z80_DRV2_H_ +#define _Z80_DRV2_H_ + @@ -125,12 +125,12 @@ index 8b35866..94c8000 100644 --- a/src/z80_drv3.h +++ b/src/z80_drv3.h @@ -1,6 +1,6 @@ --#ifndef _Z80_DRV3_H_ --#define _Z80_DRV3_H_ -- --extern const u8 z80_drv3[0xA69]; -- --#endif // _Z80_DRV3_H_ +-#ifndef _Z80_DRV3_H_ +-#define _Z80_DRV3_H_ +- +-extern const u8 z80_drv3[0xA69]; +- +-#endif // _Z80_DRV3_H_ +#ifndef _Z80_DRV3_H_ +#define _Z80_DRV3_H_ + @@ -142,12 +142,12 @@ index 031a90f..661cbb0 100644 --- a/src/z80_mvs.h +++ b/src/z80_mvs.h @@ -1,6 +1,6 @@ --#ifndef _Z80_MVS_H_ --#define _Z80_MVS_H_ -- --extern const u8 z80_mvs[0xA5B]; -- --#endif // _Z80_MVS_H_ +-#ifndef _Z80_MVS_H_ +-#define _Z80_MVS_H_ +- +-extern const u8 z80_mvs[0xA5B]; +- +-#endif // _Z80_MVS_H_ +#ifndef _Z80_MVS_H_ +#define _Z80_MVS_H_ + @@ -159,12 +159,12 @@ index 31e35a0..fe6fed3 100644 --- a/src/z80_tfm.h +++ b/src/z80_tfm.h @@ -1,6 +1,6 @@ --#ifndef _Z80_TFM_H_ --#define _Z80_TFM_H_ -- --extern const u8 z80_tfm[0x69D]; -- --#endif // _Z80_TFM_H_ +-#ifndef _Z80_TFM_H_ +-#define _Z80_TFM_H_ +- +-extern const u8 z80_tfm[0x69D]; +- +-#endif // _Z80_TFM_H_ +#ifndef _Z80_TFM_H_ +#define _Z80_TFM_H_ + @@ -176,12 +176,12 @@ index 167307c..49364d2 100644 --- a/src/z80_xgm.h +++ b/src/z80_xgm.h @@ -1,6 +1,6 @@ --#ifndef _Z80_XGM_H_ --#define _Z80_XGM_H_ -- --extern const u8 z80_xgm[0x1700]; -- --#endif // _Z80_XGM_H_ +-#ifndef _Z80_XGM_H_ +-#define _Z80_XGM_H_ +- +-extern const u8 z80_xgm[0x1700]; +- +-#endif // _Z80_XGM_H_ +#ifndef _Z80_XGM_H_ +#define _Z80_XGM_H_ + @@ -193,27 +193,27 @@ index 320fd16..20ef97e 100644 --- a/tools/rescomp/inc/tools.h +++ b/tools/rescomp/inc/tools.h @@ -1,6 +1,11 @@ - #ifndef _TOOLS_H_ - #define _TOOLS_H_ - -+#if __linux -+#define stricmp strcasecmp -+#define strnicmp strncasecmp -+#define strupr toupper -+#endif - - #define FALSE 0 - #define TRUE 1 + #ifndef _TOOLS_H_ + #define _TOOLS_H_ + ++#if __linux ++#define stricmp strcasecmp ++#define strnicmp strncasecmp ++#define strupr toupper ++#endif + + #define FALSE 0 + #define TRUE 1 diff --git a/tools/rescomp/src/tools.c b/tools/rescomp/src/tools.c index 8160f36..c94dbcf 100644 --- a/tools/rescomp/src/tools.c +++ b/tools/rescomp/src/tools.c @@ -797,7 +797,7 @@ static int appack(char* fin, char* fout) - strcat(cmd, "\" \""); - strcat(cmd, fout); - strcat(cmd, "\""); -- strcat(cmd, " -s"); -+ //strcat(cmd, " -s"); - - printf("Executing %s\n", cmd); - + strcat(cmd, "\" \""); + strcat(cmd, fout); + strcat(cmd, "\""); +- strcat(cmd, " -s"); ++ //strcat(cmd, " -s"); + + printf("Executing %s\n", cmd); + diff --git a/sgdk/files/sgdk_v1.40.diff b/sgdk/files/sgdk_v1.40.diff new file mode 100644 index 0000000..224d274 --- /dev/null +++ b/sgdk/files/sgdk_v1.40.diff @@ -0,0 +1,44 @@ +diff --git a/makefile.gen b/makefile.gen +index f12594d..d240b3f 100644 +--- a/makefile.gen ++++ b/makefile.gen +@@ -25,6 +25,8 @@ BINTOS= $(BIN)/bintos + RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar + MKDIR= $(BIN)/mkdir + ++include $(GENDEV)/sgdk/mkfiles/makefile.vars ++ + SRC_C= $(wildcard *.c) + SRC_C+= $(wildcard $(SRC)/*.c) + SRC_S= $(wildcard *.s) +diff --git a/sample/xgmplayer/src/main.c b/sample/xgmplayer/src/main.c +index 5623e70..f23590b 100644 +--- a/sample/xgmplayer/src/main.c ++++ b/sample/xgmplayer/src/main.c +@@ -285,7 +285,7 @@ int main() + initBGScroll(); + + // init Sprite engine +- SPR_initEx(20, 80, 64); ++ SPR_initEx(0, 0); + + // prepare sprites for panning + YMPanSprites[0] = SPR_addSprite(&left_right, 32 + 0, 203, TILE_ATTR(PAL0, TRUE, FALSE, FALSE)); +diff --git a/tools/appack/makefile.elf b/tools/appack/makefile.elf +index 63864f9..2826b2f 100644 +--- a/tools/appack/makefile.elf ++++ b/tools/appack/makefile.elf +@@ -12,7 +12,12 @@ objects = appack.o + + cflags = -Wall -O2 -s + ldflags = $(cflags) +-incdir = ../lib/elf ++include ./makefile.vars ++ifeq ($(osBits), 32) ++ incdir = ./lib/elf ++else ++ incdir = ./lib/elf64 ++endif + libs = $(incdir)/aplib.a + + .PHONY: all clean