├── .circleci └── config.yml ├── .gitignore ├── .travis.yml ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── _config.yml ├── doc └── FreeBSD.md ├── examples ├── 3d_example │ ├── boot │ │ ├── rom_head.c │ │ └── sega.s │ ├── dd2.obj │ ├── essai3D.cbp │ ├── main.c │ ├── meshs.h │ ├── polygon.h │ ├── polymesh.h │ ├── space_ship2.mtl │ └── space_ship2.obj └── 3d_example_2 │ ├── boot │ ├── rom_head.bin │ ├── rom_head.c │ └── sega.s │ ├── dd2.obj │ ├── essai3D.cbp │ ├── main.c │ ├── meshs.h │ ├── out.bin │ ├── polygon.h │ ├── polymesh.h │ ├── space_ship2.mtl │ └── space_ship2.obj ├── extras ├── obj2mesh │ ├── dd2.obj │ └── obj2mesh.py ├── scripts │ ├── spriteit.sh │ └── timez80 │ │ ├── timez80.py │ │ └── z80.csv ├── sound_drvr │ ├── client │ │ ├── non_sgdk │ │ │ ├── Makefile │ │ │ ├── crt0.s │ │ │ ├── font.c │ │ │ ├── hw_md.h │ │ │ ├── hw_md.s │ │ │ ├── main.c │ │ │ ├── test.c │ │ │ ├── vgm_client.c │ │ │ └── vgm_client.h │ │ ├── sgdk │ │ │ ├── Makefile │ │ │ ├── main.c │ │ │ ├── rom_head.c │ │ │ ├── sega.s │ │ │ ├── vgm_client.c │ │ │ └── vgm_client.h │ │ └── sgdk_sfx │ │ │ ├── Makefile │ │ │ ├── boot │ │ │ ├── rom_head.c │ │ │ └── sega.s │ │ │ ├── main.c │ │ │ ├── vgm_client.c │ │ │ ├── vgm_client.h │ │ │ └── vgm_demo.bin │ ├── driver │ │ ├── Makefile │ │ ├── crt0.s │ │ ├── optimiza.tion │ │ ├── vgm_drv.bin │ │ └── vgm_drv.c │ └── huh.h ├── tiled_tools │ └── tiled2c.py └── vgm_tool │ └── vgm_upg.py ├── gen_gcc ├── makefile-gen └── makefile-gen-no-m68k-c++ ├── logdoer.sh ├── pkg └── DEBIAN │ └── control ├── sgdk ├── .gitattributes ├── Makefile ├── extra_incs │ ├── gfx.h │ ├── sprite.h │ └── tilemap.h ├── extra_libs │ ├── gfx.c │ ├── sprite.c │ └── tilemap.c ├── mkfiles │ ├── Makefile.rom │ ├── Makefile.sgdk_lib │ ├── Makefile.xgmtool │ └── makefile.vars ├── patches │ ├── rescomp.diff │ ├── sgdk_1.34.diff │ ├── sgdk_v1.40.diff │ ├── sgdk_v1.41.diff │ ├── sgdk_v1.51.diff │ ├── sgdk_v1.62.diff │ └── z80_drvrs.diff └── skeleton │ ├── Makefile │ ├── boot │ ├── rom_head.c │ └── sega.s │ └── scd │ ├── LukeProjectCD │ ├── _boot │ │ ├── _inc │ │ │ └── cdbios.asm │ │ ├── ip-eu.asm │ │ ├── ip-jp.asm │ │ ├── ip-us-as.asm │ │ ├── ip-us.asm │ │ ├── security │ │ │ ├── eur.bin │ │ │ ├── jap.bin │ │ │ └── usa.bin │ │ ├── sp-as.asm │ │ └── sp.asm │ ├── main-eu.asm │ ├── main-jp.asm │ ├── main-us-as.asm │ └── main-us.asm │ ├── mdcd.ld │ └── segacd.s ├── toolchain ├── Makefile ├── files │ ├── binutils-2.34.tar.xz │ ├── gcc-9.3.0.tar.xz │ ├── gcc.patch │ ├── makefile-gen.diff │ ├── newlib-3.3.0.tar.gz │ └── vgm_cmp.diff └── ldscripts │ ├── mars-myth-sdram.ld │ ├── mars.ld │ ├── md-myth-psram.ld │ ├── md-myth-wram.ld │ ├── md-split-ram.ld │ └── md.ld └── tools ├── Makefile └── files ├── VGMTools_src.rar ├── applib ├── contrib │ ├── 16bit │ │ ├── deppack.nas │ │ ├── depptiny.nas │ │ ├── history.txt │ │ └── makeit.bat │ ├── PowerBuilder │ │ ├── example.txt │ │ ├── str_filetime.srs │ │ ├── str_netresource.srs │ │ ├── str_ofstruct.srs │ │ ├── str_overlapped.srs │ │ ├── str_security_attibutes.srs │ │ ├── uo_external_function_compression.sru │ │ └── uo_external_function_winapi.sru │ ├── VB6 │ │ └── maPLib.bas │ ├── ada │ │ ├── ACU_Dos │ │ │ ├── apacdemo.ali │ │ │ └── aplib.ali │ │ ├── ACU_Win │ │ │ ├── apacdemo.ali │ │ │ └── aplib.ali │ │ ├── aPLibAda.txt │ │ ├── apacdemo.adb │ │ ├── aplib.adb │ │ ├── aplib.ads │ │ ├── gnat.ago │ │ ├── mk_aonix.bat │ │ ├── mk_gndos.bat │ │ └── mk_gnwin.bat │ ├── bcb │ │ ├── MainFormUnit.cpp │ │ ├── MainFormUnit.ddp │ │ ├── MainFormUnit.dfm │ │ ├── MainFormUnit.h │ │ ├── README_ABOUT_APLIB_DLL.txt │ │ ├── apacksamplec.cpp │ │ ├── apacksamplec.h │ │ ├── aptest.bpr │ │ ├── aptest.cpp │ │ └── aptest.res │ ├── delphi │ │ ├── aplib.pas │ │ ├── aplibu.pas │ │ ├── aplibud.pas │ │ ├── aptest.dof │ │ ├── aptest.dpr │ │ ├── aptest.res │ │ ├── makefile │ │ ├── t_main.dfm │ │ └── t_main.pas │ ├── dotnet │ │ ├── IbsenSoftware │ │ │ └── aPLib │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ └── DllInterface.cs │ │ ├── appack.cs │ │ └── mk.bat │ ├── masm32 │ │ ├── ap.ico │ │ ├── aplib.inc │ │ ├── appack.asm │ │ ├── appack.inc │ │ ├── ctrls.asm │ │ ├── file0750.bmp │ │ ├── filedlgs.asm │ │ ├── makeit.bat │ │ ├── rsrc.rc │ │ ├── tbmacros.asm │ │ └── toolbar.asm │ ├── python │ │ └── aplib.py │ ├── tmt │ │ ├── aplibu.pas │ │ ├── appack.pas │ │ ├── apunpack.pas │ │ └── makeit.bat │ └── vpascal │ │ ├── aplib.def │ │ ├── aplibu.pas │ │ ├── aplibud.pas │ │ ├── appack.pas │ │ ├── apunpack.pas │ │ ├── descript.ion │ │ ├── make_exe.cmd │ │ ├── test_exe.cmd │ │ └── vpc.cfg ├── doc │ ├── aPLib-1.1.0.chm │ └── html │ │ ├── acknowledgements.html │ │ ├── ahob.css │ │ ├── changes.html │ │ ├── compression.html │ │ ├── decompression.html │ │ ├── general.html │ │ ├── index.html │ │ ├── license.html │ │ ├── mwcos.png │ │ ├── vcss.png │ │ └── xhtml10.png ├── example │ ├── appack.c │ ├── appack.exe │ ├── make_bcc.bat │ ├── make_dll.bat │ ├── make_pc.bat │ ├── make_vc.bat │ ├── make_wat.bat │ ├── makefile.cyg │ ├── makefile.elf │ └── makefile.mgw ├── lib │ ├── coff │ │ ├── aplib.h │ │ └── aplib.lib │ ├── coff64 │ │ ├── aplib.h │ │ └── aplib.lib │ ├── dll │ │ ├── aplib.dll │ │ ├── aplib.h │ │ └── aplib.lib │ ├── dll64 │ │ ├── aplib.dll │ │ ├── aplib.h │ │ └── aplib.lib │ ├── elf │ │ ├── aplib.a │ │ └── aplib.h │ ├── elf64 │ │ ├── aplib.a │ │ └── aplib.h │ └── omf │ │ ├── aplib.h │ │ └── aplib.lib ├── readme.txt └── src │ ├── 32bit │ ├── crc32.asm │ ├── depack.asm │ ├── depackf.asm │ ├── depacks.asm │ ├── scheck.asm │ ├── sdepack.asm │ ├── sgetsize.asm │ └── spack.asm │ ├── 64bit │ ├── crc32.asm │ ├── depack.asm │ ├── depackf.asm │ ├── depacks.asm │ ├── scheck.asm │ ├── sdepack.asm │ ├── sgetsize.asm │ └── spack.asm │ ├── depack.c │ ├── depack.h │ ├── depacks.c │ └── depacks.h ├── bin2c-1.0.zip ├── makefiles-ldscripts-2.zip ├── sixpack-13.zip ├── sjasm39g6.zip └── zasm-3.0.21-source-linux-2011-06-19.zip /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | - image: ubuntu:bionic 6 | 7 | environment: 8 | - DEBIAN_FRONTEND=noninteractive 9 | 10 | steps: 11 | - checkout 12 | - run: 13 | name: Setup prereqs 14 | command: | 15 | apt-get update 16 | apt-get install -y build-essential wget unzip unrar-free texinfo git openjdk-8-jdk-headless dos2unix 17 | - run: 18 | name: build toolchain 19 | command: make toolchain_build 20 | no_output_timeout: 30m 21 | - run: 22 | name: build tools 23 | command: make tools_build 24 | - run: 25 | name: build SGDK 26 | command: | 27 | export GENDEV=`pwd`/build 28 | make sgdk_build sgdk_install 29 | - run: 30 | name: build samples 31 | command: | 32 | export GENDEV=`pwd`/build 33 | make sgdk_samples 34 | - persist_to_workspace: 35 | root: build 36 | paths: 37 | - '*' 38 | # - gendev_*.txz 39 | # - gendev_*_all.deb 40 | 41 | release: 42 | docker: 43 | - image: ubuntu:bionic 44 | 45 | steps: 46 | - checkout 47 | - run: apt-get update && apt-get install ca-certificates -y 48 | - run: 49 | name: Setup prereqs 50 | command: | 51 | apt-get update 52 | apt-get install -y ca-certificates build-essential curl jq 53 | - attach_workspace: 54 | at: ./build 55 | - run: 56 | name: Create release 57 | command: VER=$CIRCLE_TAG make release 58 | - run: 59 | name: Upload release bins 60 | command: | 61 | REL_URL=$(curl -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/kubilus1/gendev/releases/tags/${CIRCLE_TAG} | jq -r '.upload_url' | sed -e 's/{?name,label}/?name=/g') 62 | for PKG in $(ls ./dist/*); do 63 | PKG_NAME=$(basename $PKG) 64 | curl -vvvv -XPOST --data-binary @${PKG} -H "Content-Type: application/octet-stream" -H "Authorization: token ${GITHUB_TOKEN}" ${REL_URL}${PKG_NAME} 65 | done 66 | 67 | workflows: 68 | version: 2 69 | build_n_release: 70 | jobs: 71 | - build: 72 | filters: 73 | tags: 74 | only: /^\d+\.\d+(\.\d+)?(-\S*)?$/ 75 | - release: 76 | requires: 77 | - build 78 | filters: 79 | tags: 80 | only: /^\d+\.\d+(\.\d+)?(-\S*)?$/ 81 | branches: 82 | ignore: /.*/ 83 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/*~ 2 | work 3 | sgdk/sgdk-read-only 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Not using Travis anymore but keeping this for now. 2 | 3 | dist: bionic 4 | language: c 5 | sudo: false 6 | branches: 7 | only: 8 | - master 9 | - /^\d+\.\d+(\.\d+)?(-\S*)?$/ 10 | addons: 11 | apt: 12 | update: true 13 | packages: 14 | - texinfo 15 | - openjdk-8-jdk-headless 16 | - dos2unix 17 | - g++ 18 | cache: 19 | directories: 20 | - build 21 | - toolchain/work 22 | jobs: 23 | include: 24 | - stage: clean 25 | script: 26 | - make clean 27 | - stage: Setup toolchain 28 | script: 29 | - make toolchain_clean 30 | - cd toolchain && make setup 31 | - stage: Build bintutils 32 | script: 33 | - cd toolchain && make build-binutils 34 | - stage: Build GCC pass 1 35 | script: 36 | - cd toolchain && make build-gcc-1 37 | - stage: Build newlib 38 | script: 39 | - cd toolchain && make build-newlib 40 | - stage: Build GCC pass 2 41 | script: 42 | - cd toolchain && make build-gcc-2 43 | - stage: Build ldscripts 44 | script: 45 | - cd toolchain && make build-ldscripts 46 | - stage: build tools 47 | script: 48 | - make tools_clean tools_build 49 | - stage: build sgdk 50 | script: 51 | - export GENDEV=`pwd`/build 52 | - make sgdk_clean sgdk_build 53 | - make sgdk_samples 54 | - stage: release to github 55 | if: tag IS present 56 | script: 57 | - echo "Deploying to github..." 58 | - VER=$TRAVIS_TAG make release 59 | deploy: 60 | provider: releases 61 | api_key: "$GITHUB_OAUTH_TOKEN" 62 | skip_cleanup: true 63 | file_glob: true 64 | file: 65 | - dist/gendev_*.txz 66 | - dist/gendev_*_all.deb 67 | on: 68 | tags: true 69 | repo: kubilus1/gendev 70 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:bionic as build 2 | 3 | ENV DEBIAN_FRONTEND noninteractive 4 | 5 | ENV GENDEV /opt/gendev 6 | 7 | RUN apt-get update && \ 8 | apt-get install -y \ 9 | build-essential \ 10 | wget \ 11 | unzip \ 12 | unrar-free \ 13 | texinfo \ 14 | git \ 15 | openjdk-8-jdk-headless && \ 16 | apt-get clean 17 | 18 | # To download gcc 6.3 with wget. We must provide a password with '@' in. 19 | #RUN echo ftp_user=anonymous > ~/.wgetrc 20 | #RUN echo ftp_password=dfdf@dfdf.com >> ~/.wgetrc 21 | 22 | #RUN bash -c "git clone https://github.com/kubilus1/gendev.git && cd gendev && make && rm -rf /tmp/*" 23 | WORKDIR /work 24 | COPY tools /work/tools/ 25 | COPY Makefile /work/ 26 | COPY sgdk /work/sgdk/ 27 | COPY toolchain /work/toolchain/ 28 | RUN make 29 | RUN make install 30 | 31 | FROM ubuntu:bionic 32 | RUN apt-get update && \ 33 | apt-get install -y \ 34 | openjdk-8-jre-headless \ 35 | build-essential \ 36 | make && \ 37 | apt-get clean 38 | 39 | ENV GENDEV /opt/gendev 40 | COPY --from=build /opt/gendev $GENDEV 41 | ENV PATH $GENDEV/bin:$PATH 42 | 43 | WORKDIR /src 44 | 45 | ENTRYPOINT make -f $GENDEV/sgdk/mkfiles/Makefile.rom 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, kubilus1 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # HINT: If makeinfo is missing on Ubuntu, install texinfo package. 3 | # 4 | 5 | SUDO?= sudo 6 | MGET?= wget 7 | MAKE?= make 8 | 9 | ORIG_USER:=$(shell whoami) 10 | 11 | BUILDDIR?=$(CURDIR)/build 12 | GENDEV?=/opt/gendev/ 13 | TOPDIR=$(CURDIR) 14 | 15 | VER?=dev 16 | 17 | PATH := $(BUILDDIR)/bin:$(PATH) 18 | 19 | build: toolchain_build tools_build sgdk_build 20 | echo "Done" 21 | 22 | docker_build: 23 | docker build -t gendev . 24 | 25 | $(BUILDDIR): 26 | mkdir -p $@ 27 | 28 | stepbystep: 29 | make clean 30 | make toolchain_clean 31 | cd toolchain && make setup 32 | cd toolchain && make build-binutils 33 | cd toolchain && make build-gcc-1 34 | cd toolchain && make build-newlib 35 | cd toolchain && make build-gcc-2 36 | cd toolchain && make build-ldscripts 37 | 38 | toolchain_build: 39 | cd toolchain && $(MAKE) toolchain_build 40 | 41 | toolchain_clean: 42 | cd toolchain && $(MAKE) toolchain_clean 43 | 44 | tools_build: 45 | cd tools && $(MAKE) tools_build 46 | 47 | tools_clean: 48 | cd tools && $(MAKE) tools_clean 49 | 50 | $(GENDEV): 51 | if [ -w /opt ]; then \ 52 | mkdir -p $(GENDEV); \ 53 | else \ 54 | $(SUDO) mkdir -p $@; \ 55 | $(SUDO) chown $(ORIG_USER):$(ORIG_USER) $@; \ 56 | fi 57 | 58 | install: $(GENDEV) 59 | echo "export GENDEV=$(GENDEV)" > ~/.gendev 60 | echo "export PATH=\$$GENDEV/bin:\$$PATH" >> ~/.gendev 61 | #$(SUDO) chmod 777 $@ 62 | cp -r $(BUILDDIR)/* $(GENDEV)/. 63 | 64 | release: deb txz 65 | echo "Release" 66 | 67 | dist: 68 | mkdir -p dist 69 | 70 | txz: dist/gendev_$(VER).txz 71 | dist/gendev_$(VER).txz: dist pkg_build 72 | tar -C pkg_build -cJf dist/gendev_$(VER).txz opt 73 | 74 | pkg_build: 75 | mkdir -p pkg_build/opt/gendev 76 | cp -r $(BUILDDIR)/* pkg_build/opt/gendev/. 77 | cp -r pkg/* pkg_build/. 78 | 79 | deb: dist dist/gendev_$(VER)_all.deb 80 | dist/gendev_$(VER)_all.deb: pkg_build 81 | sed -i 's/##VER##/$(VER)/g' pkg_build/DEBIAN/control 82 | cd dist && dpkg-deb -Zxz -z9 --build $(TOPDIR)/pkg_build . 83 | 84 | sgdk_build: 85 | cd sgdk && GENDEV=$(BUILDDIR) $(MAKE) 86 | 87 | sgdk_install: $(GENDEV) 88 | cd sgdk && $(MAKE) install 89 | 90 | sgdk_clean: 91 | - cd sgdk && $(MAKE) clean 92 | 93 | sgdk_samples: 94 | cd sgdk && $(MAKE) sample_clean samples 95 | 96 | clean: tools_clean toolchain_clean sgdk_clean 97 | -rm -rf $(BUILDDIR) 98 | -rm -rf pkg_build 99 | -rm -rf dist 100 | 101 | ######################################################### 102 | ######################################################### 103 | ######################################################### 104 | 105 | ######################################################### 106 | ######################################################### 107 | ######################################################### 108 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /doc/FreeBSD.md: -------------------------------------------------------------------------------- 1 | # Build **gendev** for FreeBSD 2 | 3 | ## Install Dependencies 4 | 5 | *Note: This guide is tested for FreeBSD 11.1-RELEASE* 6 | 7 | From the root shell, run the following commands: 8 | 9 | pkg install git gmake texinfo gcc openjdk-jre-7.151.01,1 wget 10 | 11 | Type 'y' and hit enter to proceed with installing the packages. 12 | 13 | Alternatively if you prefer to install from ports you can run the following [which will also install a much lower number of dependencies]: 14 | 15 | portmaster -d devel/git devel/gmake print/texinfo lang/gcc java/openjdk7-jre ftp/wget 16 | 17 | Type 'y' and hit enter to proceed with installing the packages. 18 | 19 | ## Build the toolchain 20 | 21 | Next, clone the repository and build the toolchain. [This may take some time to complete] 22 | 23 | git clone https://github.com/kubilus1/gendev.git 24 | cd gendev 25 | export MAKE=gmake [or 'setenv MAKE gmake' for csh] 26 | gmake 27 | 28 | The built toolchain and SGDK can now be installed. 29 | 30 | ## Install Gendev 31 | 32 | Gendev is installed to $GENDEV [/opt/gendev] by default. While generally not 100% in line with FreeBSD's hier policy, it doesn't cause any interference so I would recommend using this to maintain compatability. 33 | Make sure that this directory is writable by the user. 34 | 35 | Now install to $GENDEV 36 | 37 | gmake install 38 | 39 | ## Build some sample code [or your project!] 40 | 41 | You can test your new installation by building some sample code. This is also useful as a project template. 42 | 43 | export GENDEV=/opt/gendev [or 'setenv GENDEV /opt/gendev' for csh] 44 | cd ~/ (or some other directory) 45 | cp -r gendev/sgdk/SGDK/sample/cube_flat ./ 46 | cd cube_flat 47 | gmake -f $GENDEV/sgdk/mkfiles/makefile.gen clean all 48 | 49 | If everything builds correctly, you should end up with a file out/rom.bin with a size of 131072 bytes. You can run this file in an emulator of choice to confirm your builds are functioning correctly. 50 | -------------------------------------------------------------------------------- /examples/3d_example/boot/rom_head.c: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | 3 | __attribute__((externally_visible)) 4 | const struct 5 | { 6 | char console[16]; /* Console Name (16) */ 7 | char copyright[16]; /* Copyright Information (16) */ 8 | char title_local[48]; /* Domestic Name (48) */ 9 | char title_int[48]; /* Overseas Name (48) */ 10 | char serial[14]; /* Serial Number (2, 12) */ 11 | u16 checksum; /* Checksum (2) */ 12 | char IOSupport[16]; /* I/O Support (16) */ 13 | u32 rom_start; /* ROM Start Address (4) */ 14 | u32 rom_end; /* ROM End Address (4) */ 15 | u32 ram_start; /* Start of Backup RAM (4) */ 16 | u32 ram_end; /* End of Backup RAM (4) */ 17 | char sram_sig[2]; /* "RA" for save ram (2) */ 18 | u16 sram_type; /* 0xF820 for save ram on odd bytes (2) */ 19 | u32 sram_start; /* SRAM start address - normally 0x200001 (4) */ 20 | u32 sram_end; /* SRAM end address - start + 2*sram_size (4) */ 21 | char modem_support[12]; /* Modem Support (24) */ 22 | char notes[40]; /* Memo (40) */ 23 | char region[16]; /* Country Support (16) */ 24 | } rom_header = { 25 | "SEGA MEGA DRIVE ", 26 | "(C)FLEMTEAM 2013", 27 | "SAMPLE PROGRAM ", 28 | "SAMPLE PROGRAM ", 29 | "GM 00000000-00", 30 | 0x0000, 31 | "JD ", 32 | 0x00000000, 33 | 0x00100000, 34 | 0x00FF0000, 35 | 0x00FFFFFF, 36 | " ", 37 | 0x0000, 38 | 0x00200000, 39 | 0x002001FF, 40 | " ", 41 | "DEMONSTRATION PROGRAM ", 42 | "JUE " 43 | }; 44 | -------------------------------------------------------------------------------- /examples/3d_example/essai3D.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 77 | 78 | -------------------------------------------------------------------------------- /examples/3d_example/polygon.h: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | 3 | #ifndef _POLYGON_H_ 4 | #define _POLYGON_H_ 5 | 6 | typedef struct t_polygon { 7 | int num_verts; 8 | int num_faces; 9 | int num_edges; 10 | Vect3D_f16 centroid; 11 | Vect3D_f16* coords; 12 | u16* poly_ind; 13 | u16* line_ind; 14 | Vect3D_f16* face_norm; 15 | fix16 distance; 16 | } polygon; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /examples/3d_example/polymesh.h: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | 3 | #ifndef _POLYGON_H_ 4 | #define _POLYGON_H_ 5 | 6 | typedef struct t_polymesh { 7 | int num_verts; 8 | int num_faces; 9 | int num_edges; 10 | Vect3D_f16 centroid; 11 | Vect3D_f16* coords; 12 | u16* poly_ind; 13 | u16* line_ind; 14 | Vect3D_f16* face_norm; 15 | fix16 distance; 16 | u16* face_color; 17 | } polymesh; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /examples/3d_example/space_ship2.mtl: -------------------------------------------------------------------------------- 1 | # Exported from Wings 3D 1.4.1 2 | newmtl blue 3 | Ns 100.0 4 | d 1.0 5 | illum 2 6 | Kd 0.0 0.0 1.0 7 | Ka 1.0 1.0 1.0 8 | Ks 1.0 1.0 1.0 9 | Ke 0.0 0.0 0.0 10 | 11 | newmtl grey1 12 | Ns 100.0 13 | d 1.0 14 | illum 2 15 | Kd 0.5 0.5 0.5 16 | Ka 1.0 1.0 1.0 17 | Ks 1.0 1.0 1.0 18 | Ke 0.0 0.0 0.0 19 | 20 | newmtl red 21 | Ns 100.0 22 | d 1.0 23 | illum 2 24 | Kd 1.0 0.0 0.0 25 | Ka 1.0 1.0 1.0 26 | Ks 1.0 1.0 1.0 27 | Ke 0.0 0.0 0.0 28 | 29 | newmtl yellow 30 | Ns 100.0 31 | d 1.0 32 | illum 2 33 | Kd 1.0 1.0 0.0 34 | Ka 1.0 1.0 1.0 35 | Ks 1.0 1.0 1.0 36 | Ke 0.0 0.0 0.0 37 | 38 | -------------------------------------------------------------------------------- /examples/3d_example/space_ship2.obj: -------------------------------------------------------------------------------- 1 | # Exported from Wings 3D 1.5.4 2 | mtllib space_ship2.mtl 3 | o cube1 4 | #10 vertices, 14 faces 5 | v -1.99069816 4.9365365e-4 3.91964705 6 | v 2.14561428 1.6784224e-5 0.11294530 7 | v -2.57235656 -1.41421348 4.9365365e-4 8 | v -1.99069816 -4.9365365e-4 -4.00379902 9 | v 2.14561428 -1.6784224e-5 -0.15645187 10 | v 2.14561428 -4.8083258e-2 -2.0305916e-2 11 | v -2.70029721 -0.84230667 0.0000000e+0 12 | v -0.21337114 -0.73114837 -9.9061311e-3 13 | v -2.28152736 -0.70685991 1.96007035 14 | v -2.28152736 -0.70735356 -2.00165268 15 | vn -0.67181306 0.70191473 0.23660714 16 | vn 0.82952598 -0.44653576 0.33539898 17 | vn -0.51836421 -0.85515206 3.6737792e-3 18 | vn -0.89695068 0.31563367 -0.30960438 19 | vn 0.92418585 0.10272186 -0.36787054 20 | vn 0.64313338 -0.76574972 2.6109729e-3 21 | vn -0.99896346 -4.5480102e-2 1.8888569e-3 22 | vn 0.27861603 -0.96039801 2.9607002e-3 23 | vn -0.48306290 -0.79810890 0.36010058 24 | vn -0.48497881 -0.80002790 -0.35320095 25 | g cube1_blue 26 | usemtl blue 27 | s 1 28 | f 1//1 5//5 4//4 29 | f 1//1 7//7 9//9 30 | f 1//1 9//9 8//8 2//2 31 | f 2//2 5//5 1//1 32 | f 2//2 8//8 6//6 33 | f 3//3 7//7 10//10 34 | f 3//3 9//9 7//7 35 | f 4//4 10//10 7//7 36 | f 5//5 8//8 10//10 4//4 37 | f 6//6 8//8 5//5 38 | g cube1_grey1 39 | usemtl grey1 40 | s 1 41 | f 8//8 9//9 3//3 42 | f 10//10 8//8 3//3 43 | g cube1_red 44 | usemtl red 45 | s 1 46 | f 4//4 7//7 1//1 47 | g cube1_yellow 48 | usemtl yellow 49 | s 1 50 | f 2//2 6//6 5//5 51 | -------------------------------------------------------------------------------- /examples/3d_example_2/boot/rom_head.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/examples/3d_example_2/boot/rom_head.bin -------------------------------------------------------------------------------- /examples/3d_example_2/boot/rom_head.c: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | 3 | 4 | const struct 5 | { 6 | char console[16]; /* Console Name (16) */ 7 | char copyright[16]; /* Copyright Information (16) */ 8 | char title_local[48]; /* Domestic Name (48) */ 9 | char title_int[48]; /* Overseas Name (48) */ 10 | char serial[14]; /* Serial Number (2, 12) */ 11 | u16 checksum; /* Checksum (2) */ 12 | char IOSupport[16]; /* I/O Support (16) */ 13 | u32 rom_start; /* ROM Start Address (4) */ 14 | u32 rom_end; /* ROM End Address (4) */ 15 | u32 ram_start; /* Start of Backup RAM (4) */ 16 | u32 ram_end; /* End of Backup RAM (4) */ 17 | char sram_sig[2]; /* "RA" for save ram (2) */ 18 | u16 sram_type; /* 0xF820 for save ram on odd bytes (2) */ 19 | u32 sram_start; /* SRAM start address - normally 0x200001 (4) */ 20 | u32 sram_end; /* SRAM end address - start + 2*sram_size (4) */ 21 | char modem_support[12]; /* Modem Support (24) */ 22 | char notes[40]; /* Memo (40) */ 23 | char region[16]; /* Country Support (16) */ 24 | } rom_header = { 25 | "SEGA MEGA DRIVE ", 26 | "(C)FLEMTEAM 2013", 27 | "SAMPLE PROGRAM ", 28 | "SAMPLE PROGRAM ", 29 | "GM 00000000-00", 30 | 0x0000, 31 | "JD ", 32 | 0x00000000, 33 | 0x00100000, 34 | 0x00FF0000, 35 | 0x00FFFFFF, 36 | " ", 37 | 0x0000, 38 | 0x00200000, 39 | 0x002001FF, 40 | " ", 41 | "DEMONSTRATION PROGRAM ", 42 | "JUE " 43 | }; 44 | -------------------------------------------------------------------------------- /examples/3d_example_2/essai3D.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 77 | 78 | -------------------------------------------------------------------------------- /examples/3d_example_2/out.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/examples/3d_example_2/out.bin -------------------------------------------------------------------------------- /examples/3d_example_2/polygon.h: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | 3 | #ifndef _POLYGON_H_ 4 | #define _POLYGON_H_ 5 | 6 | typedef struct t_polygon { 7 | int num_verts; 8 | int num_faces; 9 | int num_edges; 10 | Vect3D_f16 centroid; 11 | Vect3D_f16* coords; 12 | u16* poly_ind; 13 | u16* line_ind; 14 | Vect3D_f16* face_norm; 15 | fix16 distance; 16 | } polygon; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /examples/3d_example_2/polymesh.h: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | 3 | #ifndef _POLYGON_H_ 4 | #define _POLYGON_H_ 5 | 6 | typedef struct t_polymesh { 7 | int num_verts; 8 | int num_faces; 9 | int num_edges; 10 | Vect3D_f16 centroid; 11 | Vect3D_f16* coords; 12 | u16* poly_ind; 13 | u16* line_ind; 14 | Vect3D_f16* face_norm; 15 | fix16 distance; 16 | u16* face_color; 17 | } polymesh; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /examples/3d_example_2/space_ship2.mtl: -------------------------------------------------------------------------------- 1 | # Exported from Wings 3D 1.4.1 2 | newmtl blue 3 | Ns 100.0 4 | d 1.0 5 | illum 2 6 | Kd 0.0 0.0 1.0 7 | Ka 1.0 1.0 1.0 8 | Ks 1.0 1.0 1.0 9 | Ke 0.0 0.0 0.0 10 | 11 | newmtl grey1 12 | Ns 100.0 13 | d 1.0 14 | illum 2 15 | Kd 0.5 0.5 0.5 16 | Ka 1.0 1.0 1.0 17 | Ks 1.0 1.0 1.0 18 | Ke 0.0 0.0 0.0 19 | 20 | newmtl red 21 | Ns 100.0 22 | d 1.0 23 | illum 2 24 | Kd 1.0 0.0 0.0 25 | Ka 1.0 1.0 1.0 26 | Ks 1.0 1.0 1.0 27 | Ke 0.0 0.0 0.0 28 | 29 | newmtl yellow 30 | Ns 100.0 31 | d 1.0 32 | illum 2 33 | Kd 1.0 1.0 0.0 34 | Ka 1.0 1.0 1.0 35 | Ks 1.0 1.0 1.0 36 | Ke 0.0 0.0 0.0 37 | 38 | -------------------------------------------------------------------------------- /examples/3d_example_2/space_ship2.obj: -------------------------------------------------------------------------------- 1 | # Exported from Wings 3D 1.5.4 2 | mtllib space_ship2.mtl 3 | o cube1 4 | #10 vertices, 14 faces 5 | v -1.99069816 4.9365365e-4 3.91964705 6 | v 2.14561428 1.6784224e-5 0.11294530 7 | v -2.57235656 -1.41421348 4.9365365e-4 8 | v -1.99069816 -4.9365365e-4 -4.00379902 9 | v 2.14561428 -1.6784224e-5 -0.15645187 10 | v 2.14561428 -4.8083258e-2 -2.0305916e-2 11 | v -2.70029721 -0.84230667 0.0000000e+0 12 | v -0.21337114 -0.73114837 -9.9061311e-3 13 | v -2.28152736 -0.70685991 1.96007035 14 | v -2.28152736 -0.70735356 -2.00165268 15 | vn -0.67181306 0.70191473 0.23660714 16 | vn 0.82952598 -0.44653576 0.33539898 17 | vn -0.51836421 -0.85515206 3.6737792e-3 18 | vn -0.89695068 0.31563367 -0.30960438 19 | vn 0.92418585 0.10272186 -0.36787054 20 | vn 0.64313338 -0.76574972 2.6109729e-3 21 | vn -0.99896346 -4.5480102e-2 1.8888569e-3 22 | vn 0.27861603 -0.96039801 2.9607002e-3 23 | vn -0.48306290 -0.79810890 0.36010058 24 | vn -0.48497881 -0.80002790 -0.35320095 25 | g cube1_blue 26 | usemtl blue 27 | s 1 28 | f 1//1 5//5 4//4 29 | f 1//1 7//7 9//9 30 | f 1//1 9//9 8//8 2//2 31 | f 2//2 5//5 1//1 32 | f 2//2 8//8 6//6 33 | f 3//3 7//7 10//10 34 | f 3//3 9//9 7//7 35 | f 4//4 10//10 7//7 36 | f 5//5 8//8 10//10 4//4 37 | f 6//6 8//8 5//5 38 | g cube1_grey1 39 | usemtl grey1 40 | s 1 41 | f 8//8 9//9 3//3 42 | f 10//10 8//8 3//3 43 | g cube1_red 44 | usemtl red 45 | s 1 46 | f 4//4 7//7 1//1 47 | g cube1_yellow 48 | usemtl yellow 49 | s 1 50 | f 2//2 6//6 5//5 51 | -------------------------------------------------------------------------------- /extras/scripts/spriteit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | IMAGE=${1:?"Missing parameter IMAGE"} 4 | WIDTH=${2:?"Missing parameter WIDTH"} 5 | HEIGHT=${3:?"Missing parameter HEIGHT"} 6 | NUMSPRITE=${4:?"Missing parameter NUMSPRITES"} 7 | 8 | TEMPDIR=$(mktemp -d) 9 | 10 | IMAGENAME=${IMAGE%.*} 11 | convert ${IMAGE} -crop 8x8 BMP3:${TEMPDIR}/${IMAGENAME}_%d.bmp 12 | 13 | CONCATLIST="" 14 | CURINDEX=0 15 | IMAGELEN=$(echo "${WIDTH} * ${NUMSPRITE} " | bc) 16 | for i in $(seq ${IMAGELEN}); do 17 | CURINDEX=$(echo "${i} - 1" | bc) 18 | for j in $(seq ${HEIGHT}); do 19 | CONCATLIST="${CONCATLIST} ${TEMPDIR}/${IMAGENAME}_${CURINDEX}.bmp" 20 | CURINDEX=$(echo "${CURINDEX} + ${WIDTH}*${NUMSPRITE}" | bc) 21 | done 22 | done 23 | 24 | montage -mode concatenate -tile ${IMAGELEN}x${HEIGHT} ${CONCATLIST} BMP3:${IMAGENAME}_sprite.bmp 25 | convert ${IMAGENAME}_sprite.bmp -remap ${IMAGE} BMP3:${IMAGENAME}_sprite.bmp 26 | rm -rf ${TEMPDIR} 27 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/non_sgdk/Makefile: -------------------------------------------------------------------------------- 1 | ifdef $(GENDEV) 2 | ROOTDIR = $(GENDEV) 3 | else 4 | ROOTDIR = /opt/toolchains/gen 5 | endif 6 | 7 | LDSCRIPTSDIR = $(ROOTDIR)/ldscripts 8 | 9 | LIBPATH = -L$(ROOTDIR)/m68k-elf/lib -L$(ROOTDIR)/m68k-elf/lib/gcc/m68k-elf/4.6.2 -L$(ROOTDIR)/m68k-elf/m68k-elf/lib 10 | INCPATH = -I. -I../include -I../../driver -I../../ -I$(ROOTDIR)/m68k-elf/include -I$(ROOTDIR)/m68k-elf/m68k-elf/include 11 | 12 | #MDCCFLAGS = -m68000 -Wall -Ofast -c -fomit-frame-pointer 13 | MDCCFLAGS = -m68000 -Wall -O1 -c -fomit-frame-pointer 14 | MDHWFLAGS = -m68000 -Wall -O1 -c -fomit-frame-pointer 15 | MDLDFLAGS = -T $(LDSCRIPTSDIR)/md.ld -Wl,-Map=output.map -nostdlib 16 | MDASFLAGS = -m68000 --register-prefix-optional 17 | 18 | MDPREFIX = $(ROOTDIR)/m68k-elf/bin/m68k-elf- 19 | MDCC = $(MDPREFIX)gcc 20 | MDAS = $(MDPREFIX)as 21 | MDLD = $(MDPREFIX)ld 22 | MDOBJC = $(MDPREFIX)objcopy 23 | 24 | ASMZ80 = zasm 25 | BINTOC = $(ROOTDIR)/bin/bin2c 26 | FLAGSZ80 = -vb2 27 | 28 | DD = dd 29 | RM = rm -f 30 | 31 | TARGET = z80vgm 32 | LIBS = $(LIBPATH) -lc -lgcc -lnosys 33 | OBJS = crt0.o vgm_client.o hw_md.o font.o main.o 34 | 35 | all: $(TARGET).bin 36 | 37 | $(TARGET).bin: $(TARGET).elf 38 | $(MDOBJC) -O binary $< temp.bin 39 | # Not sure why we need to always make this 3MB, for real HW? 40 | #$(DD) if=temp.bin of=$@ bs=3072K conv=sync 41 | cp temp.bin $@ 42 | 43 | $(TARGET).elf: $(OBJS) $(FILES) 44 | $(MDCC) $(MDLDFLAGS) $(OBJS) $(LIBS) $(FILES) -o $(TARGET).elf 45 | 46 | %.o80: %.s80 47 | $(ASMZ80) $(FLAGSZ80) -o $@ $< 48 | 49 | %.c: %.o80 50 | $(BINTOC) $< 51 | 52 | main.o: main.c 53 | $(MDCC) $(MDHWFLAGS) $(INCPATH) $< -o $@ 54 | 55 | %.o: %.c 56 | $(MDCC) $(MDCCFLAGS) $(INCPATH) $< -o $@ 57 | 58 | %.o: %.s 59 | $(MDAS) $(MDASFLAGS) $(INCPATH) $< -o $@ 60 | 61 | clean: 62 | $(RM) *.o *.o80 *.bin *.elf *.map *.log 63 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/non_sgdk/hw_md.h: -------------------------------------------------------------------------------- 1 | #ifndef _HW_MD_H 2 | #define _HW_MD_H 3 | 4 | #define SEGA_CTRL_BUTTONS 0x0FFF 5 | #define SEGA_CTRL_UP 0x0001 6 | #define SEGA_CTRL_DOWN 0x0002 7 | #define SEGA_CTRL_LEFT 0x0004 8 | #define SEGA_CTRL_RIGHT 0x0008 9 | #define SEGA_CTRL_B 0x0010 10 | #define SEGA_CTRL_C 0x0020 11 | #define SEGA_CTRL_A 0x0040 12 | #define SEGA_CTRL_START 0x0080 13 | #define SEGA_CTRL_Z 0x0100 14 | #define SEGA_CTRL_Y 0x0200 15 | #define SEGA_CTRL_X 0x0400 16 | #define SEGA_CTRL_MODE 0x0800 17 | 18 | #define SEGA_CTRL_TYPE 0xF000 19 | #define SEGA_CTRL_THREE 0x0000 20 | #define SEGA_CTRL_SIX 0x1000 21 | #define SEGA_CTRL_NONE 0xF000 22 | 23 | /* default text colors */ 24 | #define TEXT_WHITE 0x0000 25 | #define TEXT_GREEN 0x2000 26 | #define TEXT_RED 0x4000 27 | 28 | /* Z80 control flags */ 29 | #define Z80_BUS_REQUEST 0x0100 30 | #define Z80_BUS_RELEASE 0x0000 31 | #define Z80_ASSERT_RESET 0x0000 32 | #define Z80_CLEAR_RESET 0x0100 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | extern short set_sr(short new_sr); 39 | extern short get_pad(short pad); 40 | extern void clear_screen(void); 41 | extern void put_str(char *str, int color, int x, int y); 42 | extern void put_chr(char chr, int color, int x, int y); 43 | extern void delay(int count); 44 | 45 | extern void z80_busrequest(int flag); 46 | extern void z80_reset(int flag); 47 | extern void z80_memclr(void *dst, int len); 48 | extern void z80_memcpy(void *dst, void *src, int len); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/non_sgdk/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #include "hw_md.h" 9 | #include "vgm_client.h" 10 | 11 | #include "yfc2.h" 12 | #include "ghz.h" 13 | #include "rrrf.h" 14 | #include "rrpc.h" 15 | 16 | #define MAX_SONGS 4 17 | 18 | int main(void) 19 | { 20 | int song_addrs[MAX_SONGS]= { 21 | &ghz_vgm, 22 | &rrpc_vgm, 23 | &yfc2_vgm, 24 | &rrrf_vgm 25 | }; 26 | int song_idx = 0; 27 | short buttons = 0; 28 | short stopstart = 0; 29 | 30 | clear_screen(); 31 | put_str("Z80 VGM Music Driver", TEXT_WHITE, (40-16)/2, 2); 32 | 33 | // load Z80 driver 34 | load_driver(); 35 | 36 | load_song(song_addrs[song_idx]); 37 | start_it(); 38 | 39 | put_str("Push a button to change songs.", TEXT_GREEN, 2, 4); 40 | 41 | while(1) 42 | { 43 | delay(5); 44 | buttons = get_pad(0); 45 | if(buttons & (SEGA_CTRL_A | SEGA_CTRL_B | SEGA_CTRL_C)) 46 | { 47 | stop_it(); 48 | song_idx+=1; 49 | if(song_idx == MAX_SONGS) song_idx = 0; 50 | load_song(song_addrs[song_idx]); 51 | start_it(); 52 | } 53 | else if(buttons & SEGA_CTRL_START) 54 | { 55 | if(stopstart) 56 | { 57 | stopstart = 0; 58 | start_it(); 59 | put_str(" ", TEXT_WHITE, 2, 8); 60 | } 61 | else 62 | { 63 | stopstart = 1; 64 | stop_it(); 65 | put_str("Paused", TEXT_WHITE, 2, 8); 66 | } 67 | 68 | } 69 | } 70 | return 0; 71 | } 72 | 73 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/non_sgdk/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #include "hw_md.h" 9 | //#include "huh.h" 10 | #include "yfc2.h" 11 | #include "rrrf.h" 12 | #include "rrsn.h" 13 | #include "rrpc.h" 14 | 15 | #include "vgm_client.h" 16 | //#include "drumtest.h" 17 | #include "wtf.h" 18 | #include "ghz.h" 19 | #include "dt2.h" 20 | #include "shz.h" 21 | #include "pcmtest2.h" 22 | 23 | 24 | int main(void) 25 | { 26 | int song_addr; 27 | char buf[50]; 28 | clear_screen(); 29 | put_str("Z80 VGM Music Test", TEXT_WHITE, (40-16)/2, 2); 30 | 31 | // load Z80 driver 32 | load_driver(); 33 | delay(1); 34 | 35 | //song_addr = &yfc2_vgm; 36 | song_addr = &yfc2_vgm; 37 | 38 | load_song(song_addr); 39 | //load_song(&yfc2_zgm); 40 | start_it(); 41 | 42 | sprintf(buf, "Song Addr: 0x%X ", song_addr); 43 | put_str(buf, TEXT_GREEN, 2, 4); 44 | 45 | 46 | while(1) 47 | { 48 | delay(1); 49 | } 50 | 51 | while(1) 52 | { 53 | delay(10); 54 | z80_busrequest(Z80_BUS_REQUEST); 55 | uint8_t curaddr_l= *(uint8_t *)0xA01019; 56 | uint8_t curaddr_h = *(uint8_t *)0XA01020; 57 | uint8_t curinit = *(uint8_t *)0xA01003; 58 | uint8_t curplay = *(uint8_t *)0xA01004; 59 | uint8_t curoffset_l= *(uint8_t *)0xA01021; 60 | uint8_t curoffset_h = *(uint8_t *)0xA01022; 61 | uint16_t startaddr = *(uint16_t *)0xA01007; 62 | uint16_t curbank = *(uint16_t *)0xA0101d; 63 | z80_busrequest(Z80_BUS_RELEASE); 64 | 65 | sprintf(buf, "CURADDR: 0x%X %X", curaddr_h, curaddr_l); 66 | put_str(buf, TEXT_GREEN, 2, 5); 67 | 68 | sprintf(buf, "CURINIT: 0x%X ", curinit); 69 | put_str(buf, TEXT_GREEN, 2, 6); 70 | 71 | sprintf(buf, "CURPLAY: 0x%X ", curplay); 72 | put_str(buf, TEXT_GREEN, 2, 7); 73 | 74 | sprintf(buf, "CUROFFSET: 0x%X%X ", curoffset_h, curoffset_l); 75 | put_str(buf, TEXT_GREEN, 2, 8); 76 | 77 | sprintf(buf, "STARTADDR: 0x%X ", startaddr); 78 | put_str(buf, TEXT_GREEN, 2, 9); 79 | 80 | sprintf(buf, "CURBANK: 0x%X ", curbank); 81 | put_str(buf, TEXT_GREEN, 2, 10); 82 | 83 | } 84 | 85 | clear_screen(); 86 | return 0; 87 | } 88 | 89 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/non_sgdk/vgm_client.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "hw_md.h" 7 | #include "vgm_drv.h" 8 | 9 | #include "vgm_client.h" 10 | 11 | volatile unsigned int *addr_z80 = (unsigned int *)0xA00FFF; 12 | volatile uint8_t *init_z80 = (uint8_t *)0xA01003; 13 | volatile uint8_t *play_z80 = (uint8_t *)0xA01004; 14 | 15 | void load_driver(void) 16 | { 17 | // hold z80 bus - halt z80 18 | z80_busrequest(Z80_BUS_REQUEST); 19 | // clear z80 sram 20 | z80_memclr((void *)0xA00000, 0x2000); 21 | // copy driver to z80 sram 22 | z80_memcpy((void *)0xA00000, &vgm_drv_bin, (int)vgm_drv_bin_size); 23 | // reset z80 24 | z80_reset(Z80_ASSERT_RESET); 25 | // release z80 bus 26 | z80_busrequest(Z80_BUS_RELEASE); 27 | // finish z80 reset - start driver 28 | z80_reset(Z80_CLEAR_RESET); 29 | delay(2); 30 | } 31 | 32 | 33 | void load_song(unsigned int addr) 34 | { 35 | char *p = (char *)addr_z80; 36 | char *q = (char *)&addr; 37 | 38 | // First load the songs address 39 | z80_busrequest(Z80_BUS_REQUEST); 40 | p[0] = q[3]; 41 | p[1] = q[2]; 42 | p[2] = q[1]; 43 | p[3] = q[0]; 44 | z80_busrequest(Z80_BUS_RELEASE); 45 | 46 | // Pause and initialize 47 | z80_busrequest(Z80_BUS_REQUEST); 48 | *init_z80 = 0x01; 49 | *play_z80 = 0x00; 50 | z80_busrequest(Z80_BUS_RELEASE); 51 | 52 | } 53 | 54 | void start_it(void) 55 | { 56 | z80_busrequest(Z80_BUS_REQUEST); 57 | *play_z80 = 0x01; 58 | z80_busrequest(Z80_BUS_RELEASE); 59 | } 60 | 61 | void stop_it(void) 62 | { 63 | z80_busrequest(Z80_BUS_REQUEST); 64 | *play_z80 = 0x00; 65 | z80_busrequest(Z80_BUS_RELEASE); 66 | delay(2); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/non_sgdk/vgm_client.h: -------------------------------------------------------------------------------- 1 | #ifndef Z80VGM 2 | #define Z80VGM 3 | void load_driver(void); 4 | void load_song(unsigned int addr); 5 | void start_it(void); 6 | void stop_it(void); 7 | #endif 8 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk/Makefile: -------------------------------------------------------------------------------- 1 | CC = m68k-elf-gcc 2 | AS = m68k-elf-as 3 | OBJC = m68k-elf-objcopy 4 | LD = m68k-elf-ld 5 | RM = rm -f 6 | ASMZ80 = zasm 7 | BINTOC = bin2c 8 | 9 | OPTION = 10 | #INCS = -I. -I$(GENDEV)/m68k-elf/include -I$(GENDEV)/m68k-elf/m68k-elf/include 11 | INCS = -I. -I$(GENDEV)/m68k-elf/include -I../../driver -I../../ 12 | CCFLAGS = $(OPTION) -m68000 -Wall -O2 -c -fomit-frame-pointer 13 | HWCCFLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer 14 | Z80FLAGS = -vb2 15 | ASFLAGS = -m68000 --register-prefix-optional 16 | LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lgcc -lnosys -lc 17 | LINKFLAGS = -T $(GENDEV)/ldscripts/sgdk.ld -Wl,-Map=output.map -nostdlib $(GENDEV)/m68k-elf/lib/libmd.a 18 | 19 | OBJS = rom_head.o sega.o vgm_client.o main.o 20 | 21 | all: out.bin 22 | 23 | sega.o: rom_head.bin 24 | $(AS) $(ASFLAGS) sega.s -o $@ 25 | 26 | %.bin: %.elf 27 | $(OBJC) -O binary $< temp.bin 28 | dd if=temp.bin of=$@ bs=8K conv=sync 29 | 30 | %.elf: $(OBJS) 31 | $(CC) -o $@ $(LINKFLAGS) $(OBJS) $(LIBS) 32 | 33 | %.o80: %.s80 34 | $(ASMZ80) $(Z80FLAGS) -o $@ $< 35 | 36 | %.c: %.o80 37 | $(BINTOC) $< 38 | 39 | %.o: %.c 40 | $(CC) $(CCFLAGS) $(INCS) -c $< -o $@ 41 | 42 | %.o: %.s 43 | $(AS) $(ASFLAGS) $< -o $@ 44 | 45 | rom_head.bin: rom_head.o 46 | $(CC) -o $@ $(LINKFLAGS) $< 47 | 48 | clean: 49 | $(RM) *.o *.bin *.elf *.map *~ 50 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk/main.c: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | #include "ghz.h" 3 | #include "rrpc.h" 4 | #include "yfc2.h" 5 | #include "rrrf.h" 6 | #include "vgm_client.h" 7 | 8 | #define MAX_SONGS 4 9 | 10 | int main(void) 11 | { 12 | int song_addrs[MAX_SONGS]= { 13 | &ghz_vgm, 14 | &rrpc_vgm, 15 | &yfc2_vgm, 16 | &rrrf_vgm 17 | }; 18 | int song_idx = 0; 19 | short startstop = 0; 20 | 21 | int i = 0; 22 | int joy_delay = 0; 23 | u16 state = 0; 24 | 25 | VDP_setScreenWidth320(); 26 | VDP_setHInterrupt(0); 27 | VDP_setHilightShadow(0); 28 | VDP_setPaletteColor(PAL1, 15, 0x0888); 29 | VDP_setTextPalette(0); 30 | 31 | VGM_load_driver(); 32 | 33 | VGM_load_song(song_addrs[song_idx]); 34 | VGM_start(); 35 | 36 | VDP_drawText(" VGM TEST:", 5, 2); 37 | VDP_setTextPalette(1); 38 | VDP_drawText(" Press a button to change track...", 5, 10); 39 | 40 | while(1) 41 | { 42 | if( joy_delay > 0 ){ 43 | joy_delay--; 44 | VDP_drawText("Changing track.", joy_delay, 12); 45 | } 46 | else 47 | { 48 | VDP_drawText(" ", 0, 12); 49 | state = JOY_readJoypad(0); 50 | } 51 | if(state & BUTTON_A || state & BUTTON_B || state & BUTTON_C) 52 | { 53 | VGM_stop(); 54 | song_idx+=1; 55 | if(song_idx == MAX_SONGS) song_idx = 0; 56 | VGM_load_song(song_addrs[song_idx]); 57 | VGM_start(); 58 | state = 0; 59 | joy_delay = 50; 60 | } 61 | else if(state & BUTTON_START) 62 | { 63 | if(startstop) 64 | { 65 | startstop = 0; 66 | VGM_start(); 67 | VDP_drawText(" ",5, 15); 68 | } 69 | else 70 | { 71 | startstop = 1; 72 | VGM_stop(); 73 | VDP_drawText("PAUSED",5, 15); 74 | } 75 | 76 | // Avoid muliple hits of this button. 77 | VDP_waitVSync(); 78 | VDP_waitVSync(); 79 | VDP_waitVSync(); 80 | VDP_waitVSync(); 81 | } 82 | 83 | VDP_waitVSync(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk/rom_head.c: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | 3 | 4 | const struct 5 | { 6 | char console[16]; /* Console Name (16) */ 7 | char copyright[16]; /* Copyright Information (16) */ 8 | char title_local[48]; /* Domestic Name (48) */ 9 | char title_int[48]; /* Overseas Name (48) */ 10 | char serial[16]; /* Serial Number (2, 14) */ 11 | u16 checksum; /* Checksum (2) */ 12 | char IOSupport[16]; /* I/O Support (16) */ 13 | u32 rom_start; /* ROM Start Address (4) */ 14 | u32 rom_end; /* ROM End Address (4) */ 15 | u32 ram_start; /* Start of Backup RAM (4) */ 16 | u32 ram_end; /* End of Backup RAM (4) */ 17 | char modem_support[24]; /* Modem Support (24) */ 18 | char notes[40]; /* Memo (40) */ 19 | char region[16]; /* Country Support (16) */ 20 | } rom_header = { 21 | "SEGA MEGA DRIVE ", 22 | "(C)FLEMTEAM 2011", 23 | "SAMPLE PROGRAM ", 24 | "SAMPLE PROGRAM ", 25 | "GM 00000000-00", 26 | 0x0000, 27 | "JD ", 28 | 0x00000000, 29 | 0x00020000, 30 | 0x00FF0000, 31 | 0x00FFFFFF, 32 | " ", 33 | "DEMONSTRATION PROGRAM ", 34 | "JUE " 35 | }; 36 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk/vgm_client.c: -------------------------------------------------------------------------------- 1 | //#include 2 | //#include 3 | //#include 4 | //#include 5 | //#include 6 | 7 | #include "vgm_drv.h" 8 | #include "vgm_client.h" 9 | 10 | #include "genesis.h" 11 | 12 | volatile unsigned int *addr_z80 = (unsigned int *)0xA00FFF; 13 | volatile uint8_t *init_z80 = (uint8_t *)0xA01003; 14 | volatile uint8_t *play_z80 = (uint8_t *)0xA01004; 15 | 16 | void VGM_load_driver(void) 17 | { 18 | Z80_init(); 19 | Z80_requestBus(1); 20 | Z80_upload(0, &vgm_drv_bin, (u16)vgm_drv_bin_size, 1); 21 | Z80_releaseBus(); 22 | 23 | //Is this reliable? 24 | waitTick(1); 25 | } 26 | 27 | 28 | void VGM_load_song(unsigned int addr) 29 | { 30 | char *p = (char *)addr_z80; 31 | char *q = (char *)&addr; 32 | 33 | // Reset the sound chip 34 | YM2612_reset(); 35 | PSG_init(); 36 | 37 | // Load the songs address 38 | Z80_requestBus(1); 39 | p[0] = q[3]; 40 | p[1] = q[2]; 41 | p[2] = q[1]; 42 | p[3] = q[0]; 43 | Z80_releaseBus(); 44 | 45 | // Pause and initialize 46 | Z80_requestBus(1); 47 | *init_z80 = 0x01; 48 | *play_z80 = 0x00; 49 | Z80_releaseBus(); 50 | 51 | } 52 | 53 | void VGM_start(void) 54 | { 55 | Z80_requestBus(1); 56 | *play_z80 = 0x01; 57 | Z80_releaseBus(); 58 | } 59 | 60 | void VGM_stop(void) 61 | { 62 | Z80_requestBus(1); 63 | *play_z80 = 0x00; 64 | Z80_releaseBus(); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk/vgm_client.h: -------------------------------------------------------------------------------- 1 | #ifndef Z80VGM 2 | #define Z80VGM 3 | void VGM_load_driver(void); 4 | void VGM_load_song(unsigned int addr); 5 | void VGM_start(void); 6 | void VGM_stop(void); 7 | #endif 8 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk_sfx/boot/rom_head.c: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | 3 | 4 | const struct 5 | { 6 | char console[16]; /* Console Name (16) */ 7 | char copyright[16]; /* Copyright Information (16) */ 8 | char title_local[48]; /* Domestic Name (48) */ 9 | char title_int[48]; /* Overseas Name (48) */ 10 | char serial[14]; /* Serial Number (2, 12) */ 11 | u16 checksum; /* Checksum (2) */ 12 | char IOSupport[16]; /* I/O Support (16) */ 13 | u32 rom_start; /* ROM Start Address (4) */ 14 | u32 rom_end; /* ROM End Address (4) */ 15 | u32 ram_start; /* Start of Backup RAM (4) */ 16 | u32 ram_end; /* End of Backup RAM (4) */ 17 | char sram_sig[2]; /* "RA" for save ram (2) */ 18 | u16 sram_type; /* 0xF820 for save ram on odd bytes (2) */ 19 | u32 sram_start; /* SRAM start address - normally 0x200001 (4) */ 20 | u32 sram_end; /* SRAM end address - start + 2*sram_size (4) */ 21 | char modem_support[12]; /* Modem Support (24) */ 22 | char notes[40]; /* Memo (40) */ 23 | char region[16]; /* Country Support (16) */ 24 | } rom_header = { 25 | "SEGA MEGA DRIVE ", 26 | "(C)FLEMTEAM 2013", 27 | "SAMPLE PROGRAM ", 28 | "SAMPLE PROGRAM ", 29 | "GM 00000000-00", 30 | 0x0000, 31 | "JD ", 32 | 0x00000000, 33 | 0x00100000, 34 | 0x00FF0000, 35 | 0x00FFFFFF, 36 | " ", 37 | 0x0000, 38 | 0x00200000, 39 | 0x002001FF, 40 | " ", 41 | "DEMONSTRATION PROGRAM ", 42 | "JUE " 43 | }; 44 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk_sfx/main.c: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | #include "cowbell.h" 3 | #include "ghz.h" 4 | #include "rrpc.h" 5 | #include "yfc2.h" 6 | #include "rrrf.h" 7 | #include "tjae_eb.h" 8 | #include "bhb_s1.h" 9 | #include "tjae_test.h" 10 | #include "tjae_tjsj.h" 11 | #include "tjae_hack.h" 12 | #include "sound1.h" 13 | #include "laser1.h" 14 | #include "boom.h" 15 | #include "vgm_client.h" 16 | 17 | #define MAX_SONGS 5 18 | 19 | int main(void) 20 | { 21 | int song_addrs[MAX_SONGS]= { 22 | &ghz, 23 | &tjae_tjsj, 24 | &tjae_eb, 25 | &rrpc, 26 | &rrrf_vgm 27 | }; 28 | int song_idx = 0; 29 | short startstop = 0; 30 | 31 | int i = 0; 32 | int joy_delay = 0; 33 | u16 state = 0; 34 | char buf[256]; 35 | 36 | VDP_setScreenWidth320(); 37 | VDP_setHInterrupt(0); 38 | VDP_setHilightShadow(0); 39 | //VDP_setPaletteColor(PAL1, 15, 0x0888); 40 | VDP_setTextPalette(0); 41 | 42 | VGM_load_driver(); 43 | 44 | VGM_load_song(song_addrs[song_idx]); 45 | VGM_start(); 46 | 47 | VDP_drawText(" VGM TEST:", 5, 2); 48 | VDP_setTextPalette(1); 49 | VDP_drawText(" A - Fire B - Change track", 5, 10); 50 | 51 | while(1) 52 | { 53 | if( joy_delay > 0 ){ 54 | joy_delay--; 55 | VDP_drawText("Changing track.", joy_delay, 12); 56 | } 57 | else 58 | { 59 | VDP_drawText(" ", 0, 12); 60 | state = JOY_readJoypad(0); 61 | } 62 | 63 | if(state & BUTTON_C | state & BUTTON_B) 64 | { 65 | VGM_stop(); 66 | song_idx+=1; 67 | if(song_idx == MAX_SONGS) song_idx = 0; 68 | VGM_load_song(song_addrs[song_idx]); 69 | VGM_start(); 70 | state = 0; 71 | joy_delay = 50; 72 | } 73 | else if(state & BUTTON_START) 74 | { 75 | if(startstop) 76 | { 77 | startstop = 0; 78 | VGM_start(); 79 | VDP_drawText(" ",5, 15); 80 | } 81 | else 82 | { 83 | startstop = 1; 84 | VGM_stop(); 85 | VDP_drawText("PAUSED",5, 15); 86 | } 87 | 88 | // Avoid muliple hits of this button. 89 | VDP_waitVSync(); 90 | VDP_waitVSync(); 91 | VDP_waitVSync(); 92 | VDP_waitVSync(); 93 | } 94 | else if(state & BUTTON_A) { 95 | //VGM_play_sfx(sound1_pcm, sound1_pcm_size); 96 | VGM_play_sfx(laser1_pcm, laser1_pcm_size); 97 | VDP_drawText("Bang!",5,20); 98 | VDP_waitVSync(); 99 | } 100 | /* 101 | else if(state & BUTTON_B) { 102 | //VGM_play_sfx(sound1_pcm, sound1_pcm_size); 103 | VGM_play_sfx(boom_pcm, boom_pcm_size); 104 | VDP_drawText("BOOM!",5,20); 105 | VDP_waitVSync(); 106 | } 107 | */ 108 | else { 109 | VDP_drawText(" ",5,20); 110 | } 111 | 112 | //VGM_debug(); 113 | 114 | VDP_waitVSync(); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk_sfx/vgm_client.h: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | 3 | #ifndef Z80VGM 4 | #define Z80VGM 5 | void VGM_load_driver(void); 6 | void VGM_load_song(unsigned int addr); 7 | void VGM_play_sfx(unsigned int addr, u16 len); 8 | void VGM_start(void); 9 | void VGM_stop(void); 10 | void VGM_debug(void); 11 | #endif 12 | -------------------------------------------------------------------------------- /extras/sound_drvr/client/sgdk_sfx/vgm_demo.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/extras/sound_drvr/client/sgdk_sfx/vgm_demo.bin -------------------------------------------------------------------------------- /extras/sound_drvr/driver/Makefile: -------------------------------------------------------------------------------- 1 | SDCC=sdcc 2 | ASMZ80=sdasz80 3 | 4 | #SDCCFLAGS=--opt-code-speed --cyclomatic -mz80 --lospre-unsafe-read --peep-file optimiza.tion --max-allocs-per-node 10000 5 | SDCCFLAGS=--cyclomatic -mz80 --opt-code-speed --max-allocs-per-node 50000 --std-c99 --nojtbound --peep-file optimiza.tion -V 6 | #SDCCFLAGS=-mz80 --std-c99 7 | 8 | #SDCC=../sdcc/bin/sdcc 9 | #ASMZ80=../sdcc/bin/as-z80 10 | 11 | all: vgm_drv.h 12 | 13 | asm: vgm_drv.asm 14 | $(ASMZ80) -plosgffwz "vgm_drv.o" "vgm_drv.asm" 15 | cp vgm_drv.o vgm_drv.rel 16 | cp crt0.o crt0.rel 17 | $(SDCC) --verbose --xstack --fomit-frame-pointer $(SDCCFLAGS) --no-std-crt0 --code-loc 0x0101 --data-loc 0xfff -V -mz80 crt0.rel vgm_drv.rel 18 | python timez80.py vgm_drv.lst > vgm_drv_timed.lst 19 | mv crt0.ihx vgm_drv.ihx 20 | hex2bin vgm_drv.ihx 21 | bin2c -o vgm_drv.h vgm_drv.bin 22 | 23 | crt0.o: crt0.s 24 | $(ASMZ80) -o crt0.o crt0.s 25 | 26 | vgm_drv.h: vgm_drv.bin 27 | bin2c -o vgm_drv.h vgm_drv.bin 28 | 29 | vgm_drv.bin: vgm_drv.ihx 30 | hex2bin vgm_drv.ihx 31 | 32 | vgm_drv.o: vgm_drv.c 33 | $(SDCC) $(SDCCFLAGS) -o vgm_drv.o -c vgm_drv.c 34 | 35 | vgm_drv.ihx: vgm_drv.o crt0.o 36 | cp vgm_drv.o vgm_drv.rel 37 | cp crt0.o crt0.rel 38 | $(SDCC) --verbose --xstack --fomit-frame-pointer $(SDCCFLAGS) --no-std-crt0 --code-loc 0x0101 --data-loc 0xfff -V -mz80 crt0.rel vgm_drv.rel 39 | #python timez80.py vgm_drv.lst > vgm_drv_timed.lst 40 | python ../../scripts/timez80/timez80.py vgm_drv.lst > vgm_drv_timed.lst 41 | mv crt0.ihx vgm_drv.ihx 42 | 43 | clean: 44 | rm -rf *.bin *.ihx *.lnk *.lst *.o *.map *.noi *.rel *.sym *.rel vgm_drv.h 45 | 46 | -------------------------------------------------------------------------------- /extras/sound_drvr/driver/crt0.s: -------------------------------------------------------------------------------- 1 | ;; Generic crt0.s for a Z80 2 | .module crt0 3 | .globl _main 4 | 5 | .area _HEADER (ABS) 6 | ;; Reset vector 7 | .org 0 8 | jp init 9 | 10 | .org 0x08 11 | reti 12 | .org 0x10 13 | reti 14 | .org 0x18 15 | reti 16 | .org 0x20 17 | reti 18 | .org 0x28 19 | reti 20 | .org 0x30 21 | reti 22 | .org 0x38 23 | reti 24 | 25 | .org 0x40 26 | init: 27 | ;; Stack at the top of memory. 28 | ld sp,#0x1fff 29 | 30 | ;; Initialise global variables 31 | call gsinit 32 | call _main 33 | jp _exit 34 | 35 | ;; Ordering of segments for the linker. 36 | .area _HOME 37 | .area _CODE 38 | .area _GSINIT 39 | .area _GSFINAL 40 | 41 | .area _DATA 42 | .area _BSS 43 | .area _HEAP 44 | 45 | .area _CODE 46 | __clock:: 47 | ld a,#2 48 | rst 0x08 49 | ret 50 | 51 | _exit:: 52 | ;; Exit - special code to the emulator 53 | ld a,#0 54 | rst 0x08 55 | 1$: 56 | halt 57 | jr 1$ 58 | 59 | .area _GSINIT 60 | gsinit:: 61 | 62 | .area _GSFINAL 63 | ret 64 | -------------------------------------------------------------------------------- /extras/sound_drvr/driver/optimiza.tion: -------------------------------------------------------------------------------- 1 | replace 2 | { 3 | ld a,(#_op + 0) 4 | ld (hl),a 5 | } 6 | by 7 | { 8 | ; peephole custom rule, register argument passing 9 | ld (hl),d 10 | } 11 | 12 | replace 13 | { 14 | ld iy,#_op 15 | ld a,0 (iy) 16 | sub a, %1 17 | jp C,%2 18 | ld a,%3 19 | sub a, 0 (iy) 20 | jp C,%2 21 | ld a,0 (iy) 22 | } 23 | by 24 | { 25 | ld a,d 26 | sub a, %1 27 | jp C,%2 28 | ld a,%3 29 | sub a, d 30 | jp C,%2 31 | ld a,d 32 | } 33 | 34 | replace 35 | { 36 | ld a,(#_op + 0) 37 | } 38 | by 39 | { 40 | ld a,d 41 | } 42 | 43 | replace 44 | { 45 | ld iy,#_op 46 | ld a,0 (iy) 47 | ld (hl),a 48 | } 49 | by 50 | { 51 | ld (hl),d 52 | } 53 | 54 | replace 55 | { 56 | ld iy,#_op 57 | ld a,0 (iy) 58 | } 59 | by 60 | { 61 | ld a,d 62 | } 63 | -------------------------------------------------------------------------------- /extras/sound_drvr/driver/vgm_drv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/extras/sound_drvr/driver/vgm_drv.bin -------------------------------------------------------------------------------- /extras/tiled_tools/tiled2c.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import argparse 3 | import json 4 | 5 | class Tile2C(object): 6 | def __init__(self, infile, outfile): 7 | self.inputf = infile 8 | self.outputf = outfile 9 | 10 | def run(self): 11 | f = open(self.inputf) 12 | try: 13 | data = f.read() 14 | finally: 15 | f.close() 16 | 17 | tiled_data = json.loads(data) 18 | 19 | print dir(tiled_data) 20 | print tiled_data.viewkeys() 21 | 22 | print "Orientation: ", tiled_data.get("orientation") 23 | print "Layer Count: ", len(tiled_data.get("layers", [])) 24 | print "Height: ", tiled_data.get("height") 25 | print "Width: ", tiled_data.get("width") 26 | print "Tile Height: ", tiled_data.get("tileheight") 27 | print "Tile Width: ", tiled_data.get("tilewidth") 28 | print "Properties: ", tiled_data.get("properties") 29 | print "Version: ", tiled_data.get("version") 30 | print "Tile Sets: ", tiled_data.get("tilesets") 31 | print "Tile Image: ", tiled_data.get("tilesets",[{}])[0].get("image") 32 | 33 | tiles_name = tiled_data.get("tilesets",[{}])[0].get("name") 34 | 35 | layer0 = tiled_data.get("layers",[{}])[0] 36 | print layer0.viewkeys() 37 | 38 | tiles = layer0.get("data") 39 | width = layer0.get("width") 40 | height = layer0.get("height") 41 | 42 | f = open(self.outputf, "w") 43 | try: 44 | f.write("const unsigned char %s_map_data[%s] = {\n" % (tiles_name, width*height)) 45 | 46 | for i in xrange(height): 47 | f.write(",".join(["%s" % hex(x) for x in tiles[width*i:width*(i+1)]])) 48 | f.write(",\n") 49 | 50 | f.write("};\n") 51 | f.write("const tilemap %s_map = {\n" % tiles_name) 52 | f.write("%s,\n" % width) 53 | f.write("%s,\n" % height) 54 | f.write("(unsigned char *) %s_map_data\n};\n" % tiles_name) 55 | finally: 56 | f.close() 57 | 58 | print "LEN:", len(["%s" % hex(x) for x in tiles[width*i:width*(i+1)]]) 59 | 60 | if __name__ == "__main__": 61 | parser = argparse.ArgumentParser( 62 | description="Turn Tiled json files into .h files for SGDK." 63 | ) 64 | 65 | parser.add_argument( 66 | "infile", 67 | type=str, 68 | help="Input json file that should be read." 69 | ) 70 | parser.add_argument( 71 | "outfile", 72 | type=str, 73 | help="Output file." 74 | ) 75 | 76 | args = parser.parse_args() 77 | 78 | t = Tile2C(args.infile, args.outfile) 79 | t.run() 80 | -------------------------------------------------------------------------------- /logdoer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while read line; do 4 | printf '\r%s %s' "$(tput el)" "$line" 5 | done < "/dev/stdin" 6 | -------------------------------------------------------------------------------- /pkg/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: gendev 2 | Version: ##VER## 3 | Section: devel 4 | Priority: optional 5 | Maintainer: Matt Kubilus (mattkubilus) 6 | Depends: texinfo, default-jre, make 7 | Architecture: all 8 | Homepage: https://github.com/kubilus1/gendev 9 | Description: Sega Genesis development on *nix. 10 | -------------------------------------------------------------------------------- /sgdk/.gitattributes: -------------------------------------------------------------------------------- 1 | * -crlf 2 | -------------------------------------------------------------------------------- /sgdk/extra_incs/gfx.h: -------------------------------------------------------------------------------- 1 | #ifndef GFX 2 | #define GFX 3 | #include "genesis.h" 4 | 5 | u16 load_bmp(u32 *data, u16 w, u16 h); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /sgdk/extra_incs/sprite.h: -------------------------------------------------------------------------------- 1 | #include "genesis.h" 2 | 3 | #ifndef _SPRITE 4 | #define _SPRITE 5 | 6 | typedef struct 7 | { 8 | s16 posx; 9 | s16 posy; 10 | u16 tile_attr; 11 | u8 size; 12 | u8 link; 13 | u16 startaddr; 14 | u8 steps; 15 | u8 curstep; 16 | u8 tilesize; 17 | u8 pal; 18 | u8 prev_link; 19 | } spritedef; 20 | 21 | 22 | spritedef _sprite_all[MAX_SPRITE]; 23 | 24 | u8 _sprite_init; 25 | 26 | void animate_sprite(spritedef * sprt); 27 | 28 | int add_sprite(spritedef sprite); 29 | int drop_sprite(int index); 30 | void hscroll_sprites(s8 hscroll); 31 | void vscroll_sprites(s8 vscroll); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /sgdk/extra_incs/tilemap.h: -------------------------------------------------------------------------------- 1 | #ifndef _MAP 2 | #define _MAP 3 | #include "genesis.h" 4 | 5 | u8 planwidth; 6 | u8 planheight; 7 | 8 | // winX and winY -> tile location in tilemap 9 | u16 winX; 10 | u16 winY; 11 | 12 | // tX and tY -> tile position in the plane 13 | u16 tX; 14 | u16 tY; 15 | 16 | // maph and mapw -> height and width of tilemap 17 | u16 maph; 18 | u16 mapw; 19 | 20 | // winH and winW -> height and width of visible window in tiles 21 | #define winH 28 22 | #define winW 40 23 | 24 | typedef struct t_map{ 25 | u16 width; 26 | u16 height; 27 | u8* data; 28 | } tilemap; 29 | 30 | void load_map(const tilemap* inmap, int xoffset, int yoffset, u16 plan, u16 tileoffset); 31 | void load_visible_map(const tilemap* inmap, int xoffset, int yoffset, u16 plan, u16 tileoffset); 32 | void load_map_row(const tilemap* inmap, u16 plan, u8 row, u16 tileoffset); 33 | void load_map_col(const tilemap* inmap, u16 plan, u8 col, u16 tileoffset); 34 | #endif 35 | -------------------------------------------------------------------------------- /sgdk/extra_libs/gfx.c: -------------------------------------------------------------------------------- 1 | #include "gfx.h" 2 | 3 | static u16 vdp_offset = 1; 4 | 5 | 6 | u16 load_bmp(u32 *data, u16 w, u16 h) { 7 | u16 tmp_offset = vdp_offset; 8 | 9 | VDP_loadBMPTileData( 10 | data, 11 | vdp_offset, 12 | w/8, 13 | h/8, 14 | w/8 15 | ); 16 | 17 | vdp_offset += ((w/8) * (h/8)); 18 | return tmp_offset; 19 | } 20 | -------------------------------------------------------------------------------- /sgdk/mkfiles/Makefile.rom: -------------------------------------------------------------------------------- 1 | # 2 | # Use this Makefile for most SGDK projects 3 | # 4 | 5 | GENDEV?=/opt/gendev 6 | SGDKDIR?=$(GENDEV)/sgdk 7 | 8 | # Set GDK before including default SGDK makefile 9 | GDK=$(SGDKDIR) 10 | 11 | include $(SGDKDIR)/mkfiles/makefile.gen 12 | 13 | # Override shell variables 14 | MKDIR=/bin/mkdir 15 | RM=/bin/rm 16 | CP=/bin/cp 17 | SHELL=/bin/bash 18 | -------------------------------------------------------------------------------- /sgdk/mkfiles/Makefile.sgdk_lib: -------------------------------------------------------------------------------- 1 | GENDEV?=/opt/gendev/ 2 | MAKE?=make 3 | GENGCC_BIN=$(GENDEV)/bin 4 | GENBIN=$(GENDEV)/bin 5 | SGDKBIN=$(GENDEV)/sgdk/bin 6 | 7 | 8 | CC = $(GENGCC_BIN)/m68k-elf-gcc 9 | AR = $(GENGCC_BIN)/m68k-elf-ar 10 | RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib 11 | OBJC = $(GENGCC_BIN)/m68k-elf-objcopy 12 | RM = rm -f 13 | ASMZ80 = $(GENBIN)/sjasm 14 | BINTOS = $(SGDKBIN)/bintos 15 | RESCOMP= java -jar ./bin/rescomp.jar 16 | 17 | OPTION= -Dnologo_ 18 | 19 | CS=$(wildcard src/*.c) 20 | SS=$(wildcard src/*.s) 21 | S80S=$(wildcard src/*.s80) 22 | RESS= $(wildcard res/*.res) 23 | 24 | RESOURCES=$(RESS:.res=.o) 25 | RESOURCES+=$(CS:.c=.o) 26 | RESOURCES+=$(SS:.s=.o) 27 | RESOURCES+=$(S80S:.s80=.o) 28 | 29 | libmd.a_OBJS=$(RESOURCES) 30 | 31 | INCS = -Iinc -Ires 32 | FLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer $(INCS) 33 | FLAGSZ80 = -isrc -iinc 34 | 35 | all: $(libmd.a_OBJS) libmd.a 36 | 37 | %.a: $(libmd.a_OBJS) 38 | $(RM) $@ 39 | $(AR) cru $@ $($@_OBJS) 40 | $(RANLIB) $@ 41 | 42 | %.o80: %.s80 43 | $(ASMZ80) $(FLAGSZ80) $< $@ out.lst 44 | 45 | %.s: %.o80 46 | $(BINTOS) $< 47 | 48 | %.o: %.c 49 | $(CC) $(FLAGS) -c $< -o $@ 50 | 51 | %.o: %.s 52 | $(CC) -x assembler-with-cpp -MMD $(FLAGS) -c $< -o $@ 53 | 54 | %.o: %.rs 55 | $(CC) -x assembler-with-cpp $(FLAGS_LIB) -c $*.rs -o $@ 56 | 57 | %.rs: %.res 58 | $(RESCOMP) $*.res $*.rs -dep $*.o 59 | 60 | clean: 61 | #$(RM) -f z80_drv1.c z80_drv2.c 62 | $(RM) $(RESOURCES) 63 | $(RM) -rf *.o *.a *.o80 *.log *.lst 64 | 65 | install: all 66 | cp inc/*.h $(GENDEV)/m68k-elf/include 67 | cp res/*.h $(GENDEV)/m68k-elf/include 68 | cp libmd.a $(GENDEV)/m68k-elf/lib 69 | -------------------------------------------------------------------------------- /sgdk/mkfiles/makefile.vars: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Gendev specific vars 3 | PATH := $(GENDEV)/bin:$(PATH) 4 | GENGCC_BIN= $(GENDEV)/bin 5 | GENBIN= $(GENDEV)/bin 6 | BIN= $(GENDEV)/bin 7 | 8 | GDK= $(GENDEV)/sgdk 9 | 10 | AS = $(GENGCC_BIN)/m68k-elf-as 11 | AR = $(GENGCC_BIN)/m68k-elf-ar 12 | RANLIB = $(GENGCC_BIN)/m68k-elf-ranlib 13 | NM2WCH = nm2wch 14 | MKISOFS = mkisofs 15 | 16 | ############################################################################### 17 | # SGDK overrid vars 18 | LIB= $(GENDEV)/sgdk/lib 19 | 20 | LIBSRC= $(GENDEV)/sgdk/src 21 | LIBRES= $(GENDEV)/sgdk/res 22 | LIBINCLUDE= $(GENDEV)/sgdk/inc 23 | 24 | SRC= src 25 | RES= res 26 | INCLUDE= inc 27 | 28 | SHELL= sh 29 | RM = rm -f 30 | CP= cp 31 | CC = $(GENGCC_BIN)/m68k-elf-gcc 32 | LD = $(GENGCC_BIN)/m68k-elf-ld 33 | NM = nm 34 | #JAVA= java 35 | ECHO= echo 36 | OBJCPY = $(GENGCC_BIN)/m68k-elf-objcopy 37 | ASMZ80 = $(GENBIN)/sjasm 38 | #ASMZ80 = $(GENBIN)/zasm 39 | #MACCER= $(BIN)/mac68k 40 | SIZEBND= $(GENGCC_BIN)/sizebnd 41 | BINTOS = $(GENBIN)/bintos 42 | RESCOMP= $(JAVA) -jar $(GENBIN)/rescomp.jar 43 | MKDIR= mkdir 44 | -------------------------------------------------------------------------------- /sgdk/patches/rescomp.diff: -------------------------------------------------------------------------------- 1 | Index: inc/tools.h 2 | =================================================================== 3 | --- inc/tools.h (revision 206) 4 | +++ inc/tools.h (working copy) 5 | @@ -1,6 +1,11 @@ 6 | #ifndef _TOOLS_H_ 7 | #define _TOOLS_H_ 8 | 9 | +#if __linux 10 | +#define stricmp strcasecmp 11 | +#define strnicmp strncasecmp 12 | +#define strupr toupper 13 | +#endif 14 | 15 | #define FALSE 0 16 | #define TRUE 1 17 | Index: src/tools.c 18 | =================================================================== 19 | --- src/tools.c (revision 206) 20 | +++ src/tools.c (working copy) 21 | @@ -798,7 +798,7 @@ 22 | strcat(cmd, "\" \""); 23 | strcat(cmd, fout); 24 | strcat(cmd, "\""); 25 | - strcat(cmd, " -s"); 26 | + //strcat(cmd, " -s"); 27 | 28 | printf("Executing %s\n", cmd); 29 | 30 | -------------------------------------------------------------------------------- /sgdk/patches/sgdk_v1.40.diff: -------------------------------------------------------------------------------- 1 | diff --git a/makefile.gen b/makefile.gen 2 | index f12594d..d240b3f 100644 3 | --- a/makefile.gen 4 | +++ b/makefile.gen 5 | @@ -25,6 +25,8 @@ BINTOS= $(BIN)/bintos 6 | RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar 7 | MKDIR= $(BIN)/mkdir 8 | 9 | +include $(GENDEV)/sgdk/mkfiles/makefile.vars 10 | + 11 | SRC_C= $(wildcard *.c) 12 | SRC_C+= $(wildcard $(SRC)/*.c) 13 | SRC_S= $(wildcard *.s) 14 | diff --git a/sample/xgmplayer/src/main.c b/sample/xgmplayer/src/main.c 15 | index 5623e70..f23590b 100644 16 | --- a/sample/xgmplayer/src/main.c 17 | +++ b/sample/xgmplayer/src/main.c 18 | @@ -285,7 +285,7 @@ int main() 19 | initBGScroll(); 20 | 21 | // init Sprite engine 22 | - SPR_initEx(20, 80, 64); 23 | + SPR_initEx(0, 0); 24 | 25 | // prepare sprites for panning 26 | YMPanSprites[0] = SPR_addSprite(&left_right, 32 + 0, 203, TILE_ATTR(PAL0, TRUE, FALSE, FALSE)); 27 | diff --git a/tools/appack/makefile.elf b/tools/appack/makefile.elf 28 | index 63864f9..2826b2f 100644 29 | --- a/tools/appack/makefile.elf 30 | +++ b/tools/appack/makefile.elf 31 | @@ -12,7 +12,12 @@ objects = appack.o 32 | 33 | cflags = -Wall -O2 -s 34 | ldflags = $(cflags) 35 | -incdir = ../lib/elf 36 | +include ./makefile.vars 37 | +ifeq ($(osBits), 32) 38 | + incdir = ./lib/elf 39 | +else 40 | + incdir = ./lib/elf64 41 | +endif 42 | libs = $(incdir)/aplib.a 43 | 44 | .PHONY: all clean 45 | -------------------------------------------------------------------------------- /sgdk/patches/sgdk_v1.41.diff: -------------------------------------------------------------------------------- 1 | diff --git a/makefile.gen b/makefile.gen 2 | index f12594d..d240b3f 100644 3 | --- a/makefile.gen 4 | +++ b/makefile.gen 5 | @@ -25,6 +25,8 @@ BINTOS= $(BIN)/bintos 6 | RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar 7 | MKDIR= $(BIN)/mkdir 8 | 9 | +include $(GENDEV)/sgdk/mkfiles/makefile.vars 10 | + 11 | SRC_C= $(wildcard *.c) 12 | SRC_C+= $(wildcard $(SRC)/*.c) 13 | SRC_S= $(wildcard *.s) 14 | diff --git a/tools/appack/makefile.elf b/tools/appack/makefile.elf 15 | index 63864f9..2826b2f 100644 16 | --- a/tools/appack/makefile.elf 17 | +++ b/tools/appack/makefile.elf 18 | @@ -12,7 +12,12 @@ objects = appack.o 19 | 20 | cflags = -Wall -O2 -s 21 | ldflags = $(cflags) 22 | -incdir = ../lib/elf 23 | +include ./makefile.vars 24 | +ifeq ($(osBits), 32) 25 | + incdir = ./lib/elf 26 | +else 27 | + incdir = ./lib/elf64 28 | +endif 29 | libs = $(incdir)/aplib.a 30 | 31 | .PHONY: all clean 32 | -------------------------------------------------------------------------------- /sgdk/patches/sgdk_v1.51.diff: -------------------------------------------------------------------------------- 1 | diff --git a/makefile.gen b/makefile.gen 2 | index b2e19e1..61f4f56 100644 3 | --- a/makefile.gen 4 | +++ b/makefile.gen 5 | @@ -25,6 +25,8 @@ BINTOS= $(BIN)/bintos 6 | RESCOMP= $(JAVA) -jar $(BIN)/rescomp.jar 7 | MKDIR= $(BIN)/mkdir 8 | 9 | +include $(GENDEV)/sgdk/mkfiles/makefile.vars 10 | + 11 | SRC_C= $(wildcard *.c) 12 | SRC_C+= $(wildcard $(SRC)/*.c) 13 | SRC_S= $(wildcard *.s) 14 | @@ -114,7 +116,7 @@ out/rom.bin: out/rom.out 15 | $(SIZEBND) out/rom.bin -sizealign 131072 16 | 17 | out/symbol.txt: out/rom.out 18 | - $(NM) --plugin=liblto_plugin-0.dll -n out/rom.out > out/symbol.txt 19 | + $(NM) -n out/rom.out > out/symbol.txt 20 | 21 | out/rom.out: out/sega.o out/cmd_ $(LIBMD) 22 | $(CC) -B$(BIN) -n -T $(GDK)/md.ld -nostdlib out/sega.o @out/cmd_ $(LIBMD) $(LIB)/libgcc.a -o out/rom.out 23 | diff --git a/tools/appack/makefile.elf b/tools/appack/makefile.elf 24 | index fb10510..527053d 100644 25 | --- a/tools/appack/makefile.elf 26 | +++ b/tools/appack/makefile.elf 27 | @@ -12,7 +12,14 @@ objects = appack.o 28 | 29 | cflags = -Wall -O2 -s 30 | ldflags = $(cflags) 31 | -incdir = lib/elf 32 | + 33 | +include ./makefile.vars 34 | +ifeq ($(osBits), 32) 35 | + incdir = ./lib/elf 36 | +else 37 | + incdir = ./lib/elf64 38 | +endif 39 | + 40 | libs = $(incdir)/aplib.a 41 | 42 | .PHONY: all clean 43 | -------------------------------------------------------------------------------- /sgdk/patches/sgdk_v1.62.diff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/sgdk/patches/sgdk_v1.62.diff -------------------------------------------------------------------------------- /sgdk/skeleton/boot/rom_head.c: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | 3 | 4 | const struct 5 | { 6 | char console[16]; /* Console Name (16) */ 7 | char copyright[16]; /* Copyright Information (16) */ 8 | char title_local[48]; /* Domestic Name (48) */ 9 | char title_int[48]; /* Overseas Name (48) */ 10 | char serial[14]; /* Serial Number (2, 12) */ 11 | u16 checksum; /* Checksum (2) */ 12 | char IOSupport[16]; /* I/O Support (16) */ 13 | u32 rom_start; /* ROM Start Address (4) */ 14 | u32 rom_end; /* ROM End Address (4) */ 15 | u32 ram_start; /* Start of Backup RAM (4) */ 16 | u32 ram_end; /* End of Backup RAM (4) */ 17 | char sram_sig[2]; /* "RA" for save ram (2) */ 18 | u16 sram_type; /* 0xF820 for save ram on odd bytes (2) */ 19 | u32 sram_start; /* SRAM start address - normally 0x200001 (4) */ 20 | u32 sram_end; /* SRAM end address - start + 2*sram_size (4) */ 21 | char modem_support[12]; /* Modem Support (24) */ 22 | char notes[40]; /* Memo (40) */ 23 | char region[16]; /* Country Support (16) */ 24 | } rom_header = { 25 | "SEGA MEGA DRIVE ", 26 | "(C)FLEMTEAM 2013", 27 | "SAMPLE PROGRAM ", 28 | "SAMPLE PROGRAM ", 29 | "GM 00000000-00", 30 | 0x0000, 31 | "JD ", 32 | 0x00000000, 33 | 0x00100000, 34 | 0x00FF0000, 35 | 0x00FFFFFF, 36 | " ", 37 | 0x0000, 38 | 0x00200000, 39 | 0x002001FF, 40 | " ", 41 | "DEMONSTRATION PROGRAM ", 42 | "JUE " 43 | }; 44 | -------------------------------------------------------------------------------- /sgdk/skeleton/scd/LukeProjectCD/_boot/security/eur.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/sgdk/skeleton/scd/LukeProjectCD/_boot/security/eur.bin -------------------------------------------------------------------------------- /sgdk/skeleton/scd/LukeProjectCD/_boot/security/jap.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/sgdk/skeleton/scd/LukeProjectCD/_boot/security/jap.bin -------------------------------------------------------------------------------- /sgdk/skeleton/scd/LukeProjectCD/_boot/security/usa.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/sgdk/skeleton/scd/LukeProjectCD/_boot/security/usa.bin -------------------------------------------------------------------------------- /sgdk/skeleton/scd/LukeProjectCD/main-eu.asm: -------------------------------------------------------------------------------- 1 | ; ======================================================================================= 2 | ; Sega CD Boot loader by Luke Usher/SoullessSentinel (c) 2010 3 | ; Used with permission. This code is not released under the GPL. 4 | ; ======================================================================================= 5 | align macro 6 | cnop 0,\1 7 | endm 8 | ; ======================================================================================= 9 | ; Sega CD Header (Based on Sonic CD's header) 10 | ; ======================================================================================= 11 | DiscType: dc.b 'SEGADISCSYSTEM ' ; Disc Type (Must be SEGADISCSYSTEM) 12 | VolumeName: dc.b 'SEGACDGAME ',0 ; Disc ID 13 | VolumeSystem: dc.w $100, $1 ; System ID, Type 14 | SystemName: dc.b 'SEGACDGAME ',0 ; System Name 15 | SystemVersion: dc.w 0,0 ; System Version, Type 16 | IP_Addr: dc.l $800 ; IP Start Address (Must be $800) 17 | IP_Size: dc.l $800 ; IP End Address (Must be $800) 18 | IP_Entry: dc.l 0 19 | IP_WorkRAM: dc.l 0 20 | SP_Addr: dc.l $1000 ; SP Start Address (Must be $1000) 21 | SP_Size: dc.l $7000 ; SP End Address (Must be $7000) 22 | SP_Entry: dc.l 0 23 | SP_WorkRAM: dc.l 0 24 | align $100 ; Pad to $100 25 | 26 | ; ======================================================================================= 27 | ; Game Header 28 | ; ======================================================================================= 29 | HardwareType: dc.b 'SEGA MEGA DRIVE ' 30 | Copyright: dc.b '(C)ARTEMIO 2011 ' 31 | NativeName: dc.b '240P TEST SUITE ' 32 | OverseasName: dc.b '240P TEST SUITE ' 33 | DiscID: dc.b 'GM 00-0000-00 ' 34 | IO: dc.b 'J ' 35 | ; Modem information, notes, and padding, left undefined as it is not used 36 | ; Padded to $1F0 instead (Start of Region Code) 37 | align $1F0 38 | Region: dc.b 'E ' 39 | ; ======================================================================================== 40 | ; IP (Includes security sector) 41 | ; ======================================================================================== 42 | incbin "_boot\ip-eu.bin"; 43 | ; ======================================================================================= 44 | ; Sub CPU Program (SP) 45 | ; ======================================================================================= 46 | align $1000 47 | incbin "_boot\sp.bin" 48 | ; ======================================================================================= 49 | ; Padding, to $8000 (Size of boot area of iso) 50 | ; ======================================================================================= 51 | align $8000 52 | ; ======================================================================================= 53 | ; FileSystem: 54 | ; ======================================================================================= 55 | incbin "filesystem.bin" 56 | align $2000000 57 | -------------------------------------------------------------------------------- /sgdk/skeleton/scd/LukeProjectCD/main-jp.asm: -------------------------------------------------------------------------------- 1 | ; ======================================================================================= 2 | ; Sega CD Boot loader by Luke Usher/SoullessSentinel (c) 2010 3 | ; Used with permission. This code is not released under the GPL. 4 | ; ======================================================================================= 5 | align macro 6 | cnop 0,\1 7 | endm 8 | ; ======================================================================================= 9 | ; Sega CD Header (Based on Sonic CD's header) 10 | ; ======================================================================================= 11 | DiscType: dc.b 'SEGADISCSYSTEM ' ; Disc Type (Must be SEGADISCSYSTEM) 12 | VolumeName: dc.b 'SEGACDGAME ',0 ; Disc ID 13 | VolumeSystem: dc.w $100, $1 ; System ID, Type 14 | SystemName: dc.b 'SEGACDGAME ',0 ; System Name 15 | SystemVersion: dc.w 0,0 ; System Version, Type 16 | IP_Addr: dc.l $800 ; IP Start Address (Must be $800) 17 | IP_Size: dc.l $800 ; IP End Address (Must be $800) 18 | IP_Entry: dc.l 0 19 | IP_WorkRAM: dc.l 0 20 | SP_Addr: dc.l $1000 ; SP Start Address (Must be $1000) 21 | SP_Size: dc.l $7000 ; SP End Address (Must be $7000) 22 | SP_Entry: dc.l 0 23 | SP_WorkRAM: dc.l 0 24 | align $100 ; Pad to $100 25 | 26 | ; ======================================================================================= 27 | ; Game Header 28 | ; ======================================================================================= 29 | HardwareType: dc.b 'SEGA MEGA DRIVE ' 30 | Copyright: dc.b '(C)ARTEMIO 2011 ' 31 | NativeName: dc.b '240P TEST SUITE ' 32 | OverseasName: dc.b '240P TEST SUITE ' 33 | DiscID: dc.b 'GM 00-0000-00 ' 34 | IO: dc.b 'J ' 35 | ; Modem information, notes, and padding, left undefined as it is not used 36 | ; Padded to $1F0 instead (Start of Region Code) 37 | align $1F0 38 | Region: dc.b 'E ' 39 | ; ======================================================================================== 40 | ; IP (Includes security sector) 41 | ; ======================================================================================== 42 | incbin "_boot\ip-jp.bin"; 43 | ; ======================================================================================= 44 | ; Sub CPU Program (SP) 45 | ; ======================================================================================= 46 | align $1000 47 | incbin "_boot\sp.bin" 48 | ; ======================================================================================= 49 | ; Padding, to $8000 (Size of boot area of iso) 50 | ; ======================================================================================= 51 | align $8000 52 | ; ======================================================================================= 53 | ; FileSystem: 54 | ; ======================================================================================= 55 | incbin "filesystem.bin" 56 | align $2000000 57 | -------------------------------------------------------------------------------- /sgdk/skeleton/scd/LukeProjectCD/main-us.asm: -------------------------------------------------------------------------------- 1 | ; ======================================================================================= 2 | ; Sega CD Boot loader by Luke Usher/SoullessSentinel (c) 2010 3 | ; Used with permission. This code is not released under the GPL. 4 | ; ======================================================================================= 5 | align macro 6 | cnop 0,\1 7 | endm 8 | ; ======================================================================================= 9 | ; Sega CD Header (Based on Sonic CD's header) 10 | ; ======================================================================================= 11 | DiscType: dc.b 'SEGADISCSYSTEM ' ; Disc Type (Must be SEGADISCSYSTEM) 12 | VolumeName: dc.b 'SEGACDGAME ',0 ; Disc ID 13 | VolumeSystem: dc.w $100,$1 ; System ID, Type 14 | SystemName: dc.b 'SEGACDGAME ',0 ; System Name 15 | SystemVersion: dc.w 0,0 ; System Version, Type 16 | IP_Addr: dc.l $800 ; IP Start Address (Must be $800) 17 | IP_Size: dc.l $800 ; IP End Address (Must be $800) 18 | IP_Entry: dc.l 0 19 | IP_WorkRAM: dc.l 0 20 | SP_Addr: dc.l $1000 ; SP Start Address (Must be $1000) 21 | SP_Size: dc.l $7000 ; SP End Address (Must be $7000) 22 | SP_Entry: dc.l 0 23 | SP_WorkRAM: dc.l 0 24 | align $100 ; Pad to $100 25 | 26 | ; ======================================================================================= 27 | ; Game Header 28 | ; ======================================================================================= 29 | HardwareType: dc.b 'SEGA MEGA DRIVE ' 30 | Copyright: dc.b '(C)ARTEMIO 2011 ' 31 | NativeName: dc.b '240P TEST SUITE ' 32 | OverseasName: dc.b '240P TEST SUITE ' 33 | DiscID: dc.b 'GM 00-0000-00 ' 34 | IO: dc.b 'J ' 35 | ; Modem information, notes, and padding, left undefined as it is not used 36 | ; Padded to $1F0 instead (Start of Region Code) 37 | align $1F0 38 | Region: dc.b 'E ' 39 | ; ======================================================================================== 40 | ; IP (Includes security sector) 41 | ; ======================================================================================== 42 | incbin "_boot/ip-us.bin"; 43 | ; ======================================================================================= 44 | ; Sub CPU Program (SP) 45 | ; ======================================================================================= 46 | align $1000 47 | incbin "_boot/sp.bin" 48 | ; ======================================================================================= 49 | ; Padding, to $8000 (Size of boot area of iso) 50 | ; ======================================================================================= 51 | align $8000 52 | ; ======================================================================================= 53 | ; FileSystem: 54 | ; ======================================================================================= 55 | incbin "filesystem.bin" 56 | align $2000000 57 | -------------------------------------------------------------------------------- /sgdk/skeleton/scd/mdcd.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(m68k) 2 | SEARCH_DIR(.) 3 | __DYNAMIC = 0; 4 | 5 | /* 6 | * The memory map look like this: 7 | * +--------------------+ <- 0x00200000 8 | * | .text | 9 | * | _etext | 10 | * | ctor list | the ctor and dtor lists are for 11 | * | dtor list | C++ support 12 | * +--------------------+ <- 0x00240000 13 | * . . 14 | * . . 15 | * . . 16 | * +--------------------+ <- 0x00FF0000 17 | * | .data | initialized data goes here 18 | * | _edata | 19 | * +--------------------+ 20 | * | .bss | 21 | * | __bss_start | start of bss, cleared by crt0 22 | * | _end | start of heap, used by sbrk() 23 | * +--------------------+ 24 | * . . 25 | * . . 26 | * . . 27 | * | __stack | top of stack 28 | * +--------------------+ <- 0x00FFFD00 29 | */ 30 | 31 | MEMORY 32 | { 33 | wram (wx) : ORIGIN = 0x00200000, LENGTH = 0x00040000 34 | ram (wx) : ORIGIN = 0x00FF0000, LENGTH = 0x0000FD00 35 | } 36 | 37 | /* 38 | * Allocate the stack to be at the top of memory, since the stack 39 | * grows down 40 | */ 41 | 42 | PROVIDE (__stack = 0x00FFFD00); 43 | 44 | SECTIONS 45 | { 46 | .text 0x00200000 : 47 | AT ( 0x00000000 ) 48 | { 49 | *(.text .text.*) 50 | . = ALIGN(0x4); 51 | __CTOR_LIST__ = .; 52 | ___CTOR_LIST__ = .; 53 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 54 | *(.ctors) 55 | LONG(0) 56 | __CTOR_END__ = .; 57 | __DTOR_LIST__ = .; 58 | ___DTOR_LIST__ = .; 59 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) 60 | *(.dtors) 61 | LONG(0) 62 | __DTOR_END__ = .; 63 | *(.rodata .rodata.*) 64 | *(.gcc_except_table) 65 | 66 | . = ALIGN(0x2); 67 | __INIT_SECTION__ = . ; 68 | LONG (0x4E560000) /* linkw %fp,#0 */ 69 | *(.init) 70 | SHORT (0x4E5E) /* unlk %fp */ 71 | SHORT (0x4E75) /* rts */ 72 | 73 | __FINI_SECTION__ = . ; 74 | LONG (0x4E560000) /* linkw %fp,#0 */ 75 | *(.fini) 76 | SHORT (0x4E5E) /* unlk %fp */ 77 | SHORT (0x4E75) /* rts */ 78 | 79 | _etext = .; 80 | *(.lit) 81 | } > wram 82 | 83 | .data 0x00FF0000 : 84 | AT ( LOADADDR (.text) + SIZEOF (.text) ) 85 | { 86 | *(.got.plt) *(.got) 87 | *(.shdata) 88 | *(.data .data.*) 89 | _edata = .; 90 | } > ram 91 | 92 | .bss 0x00FF0000 + SIZEOF (.data) : 93 | { 94 | . = ALIGN(0x4); 95 | __bss_start = . ; 96 | *(.shbss) 97 | *(.bss .bss.*) 98 | *(COMMON) 99 | _bend = ALIGN (0x8); 100 | __end = _bend; 101 | end = _bend; 102 | } > ram 103 | 104 | .stab 0 (NOLOAD) : 105 | { 106 | *(.stab) 107 | } 108 | 109 | .stabstr 0 (NOLOAD) : 110 | { 111 | *(.stabstr) 112 | } 113 | 114 | .eh_frame 0 (NOLOAD) : 115 | { 116 | *(.eh_frame) 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /toolchain/Makefile: -------------------------------------------------------------------------------- 1 | GENDEV?=/opt/gendev/ 2 | SUDO?= sudo 3 | MAKE?= make 4 | TOPDIR?=$(CURDIR)/.. 5 | TCDIR=$(TOPDIR)/toolchain 6 | BUILDDIR?=$(TOPDIR)/build 7 | WORKDIR?=$(TCDIR)/work 8 | FILESDIR?=$(TCDIR)/files 9 | 10 | GCC_VERSION=9.3.0 11 | BINUTILS_VERSION=2.34 12 | NEWLIB_VERSION=3.3.0 13 | HOST?=x86_64-pc-linux-gnu 14 | 15 | LOG?=/dev/null 16 | 17 | PATH := $(BUILDDIR)/bin:$(PATH) 18 | 19 | toolchain_build: $(BUILDDIR) setup build-binutils build-gcc-1 build-newlib build-gcc-2 build-ldscripts 20 | echo "Toolchain done" 21 | 22 | toolchain_params: 23 | @echo "TOPDIR $(TOPDIR)" 24 | @echo "TCDIR $(TCDIR)" 25 | @echo "WORKDIR $(WORKDIR)" 26 | @echo "BUILDDIR $(BUILDDIR)" 27 | @echo "FILESDIR $(FILESDIR)" 28 | 29 | $(BUILDDIR): 30 | mkdir -p $@ 31 | 32 | install: 33 | mkdir -p $(GENDEV) 34 | cp -r $(BUILDDIR)/* $(GENDEV)/. 35 | 36 | build-binutils: $(WORKDIR)/build-binutils 37 | $(WORKDIR)/build-binutils: 38 | mkdir -p $@ 39 | cd $@ && ../binutils-$(BINUTILS_VERSION)/configure --host=$(HOST) --target=m68k-elf --prefix=$(BUILDDIR) --enable-install-libbfd --disable-werror 40 | $(MAKE) -C $@ all install DESTDIR= > $(LOG) 41 | 42 | build-gcc-1: $(WORKDIR)/build-gcc 43 | $(WORKDIR)/build-gcc: 44 | #cd $(WORKDIR)/gcc-$(GCC_VERSION) && patch -p1 -i $(FILESDIR)/gcc.patch 45 | cd $(WORKDIR)/gcc-$(GCC_VERSION) && ./contrib/download_prerequisites 46 | mkdir -p $@ 47 | cd $@ && ../gcc-$(GCC_VERSION)/configure --host=$(HOST) --target=m68k-elf --prefix=$(BUILDDIR) --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls --with-cpu=m68000 --disable-werror --disable-nls --disable-multilib 48 | $(MAKE) -C $@ all install DESTDIR= > $(LOG) 49 | 50 | build-newlib: $(WORKDIR)/build-newlib 51 | $(WORKDIR)/build-newlib: 52 | find $(BUILDDIR) -name "m68k-elf-cc" 53 | find $(WORKDIR) -name "m68k-elf-cc" 54 | mkdir -p $@ 55 | cd $@ && ../newlib-$(NEWLIB_VERSION)/configure --host=$(HOST) --target=m68k-elf --prefix=$(BUILDDIR) --with-cpu=m68000 --disable-werror 56 | $(MAKE) -C $@ all install DESTDIR= $(LOG) 57 | 58 | build-gcc-2: 59 | cd $(WORKDIR)/build-gcc && ../gcc-$(GCC_VERSION)/configure --host=$(HOST) --target=m68k-elf --prefix=$(BUILDDIR) --with-newlib --disable-libssp --disable-tls --enable-threads=single --enable-languages=c --with-cpu=m68000 --disable-werror --disable-nls --disable-multilib 60 | $(MAKE) -C $(WORKDIR)/build-gcc all install DESTDIR= $(LOG) 61 | cp $(BUILDDIR)/lib/gcc/m68k-elf/$(GCC_VERSION)/libgcc.a $(BUILDDIR)/lib/. 62 | 63 | build-ldscripts: $(BUILDDIR)/ldscripts 64 | $(BUILDDIR)/ldscripts: 65 | mkdir -p $@ 66 | cp ldscripts/*.ld $@/. 67 | 68 | toolchain_clean: 69 | rm -rf $(WORKDIR) 70 | 71 | ##################################################### 72 | ##################################################### 73 | ##################################################### 74 | TGZS=$(wildcard $(FILESDIR)/*.tar.gz) 75 | BZ2S+=$(wildcard $(FILESDIR)/*.tar.bz2) 76 | XZS+=$(wildcard $(FILESDIR)/*.tar.xz) 77 | 78 | ARCH_DIRS=$(TGZS:.tar.gz=) 79 | ARCH_DIRS+=$(BZ2S:.tar.bz2=) 80 | ARCH_DIRS+=$(XZS:.tar.xz=) 81 | 82 | PKGS=$(addprefix $(WORKDIR)/,$(notdir $(ARCH_DIRS))) 83 | 84 | $(WORKDIR): 85 | mkdir -p $(WORKDIR) 86 | 87 | $(WORKDIR)/%: $(FILESDIR)/% 88 | cd $(WORKDIR) && \ 89 | tar xf $<.* 90 | 91 | $(FILESDIR)/%: 92 | @echo "Will extract $@" 93 | 94 | setup: $(WORKDIR) $(PKGS) 95 | echo $< $@ 96 | @echo "Setup done" 97 | -------------------------------------------------------------------------------- /toolchain/files/binutils-2.34.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/toolchain/files/binutils-2.34.tar.xz -------------------------------------------------------------------------------- /toolchain/files/gcc-9.3.0.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/toolchain/files/gcc-9.3.0.tar.xz -------------------------------------------------------------------------------- /toolchain/files/gcc.patch: -------------------------------------------------------------------------------- 1 | diff -Naur gcc-6.3.0.old/gcc/ubsan.c gcc-6.3.0/gcc/ubsan.c 2 | --- gcc-6.3.0.old/gcc/ubsan.c 2016-12-07 19:39:29.000000000 -0300 3 | +++ gcc-6.3.0/gcc/ubsan.c 2017-07-23 02:55:57.764668196 -0300 4 | @@ -1471,7 +1471,7 @@ 5 | 6 | expanded_location xloc = expand_location (loc); 7 | if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0 8 | - || xloc.file == '\0' || xloc.file[0] == '\xff' 9 | + || xloc.file[0] == '\0' || xloc.file[0] == '\xff' 10 | || xloc.file[1] == '\xff') 11 | return false; 12 | 13 | -------------------------------------------------------------------------------- /toolchain/files/makefile-gen.diff: -------------------------------------------------------------------------------- 1 | --- makefile-gen.old 2011-03-16 22:07:38.000000000 -0700 2 | +++ makefile-gen 2014-02-02 22:33:44.779969997 -0800 3 | @@ -18,12 +18,13 @@ 4 | # build-m68k-newlib: build-m68k-newlib-only 5 | 6 | # User configuration 7 | +MAKE?=make 8 | sh_target=sh-elf 9 | m68k_target=m68k-elf 10 | sh_prefix := /opt/toolchains/gen/$(sh_target) 11 | m68k_prefix := /opt/toolchains/gen/$(m68k_target) 12 | -binutils_ver=2.21 13 | -gcc_ver=4.5.2 14 | +binutils_ver=2.24 15 | +gcc_ver=4.8.2 16 | newlib_ver=1.19.0 17 | thread_model=single 18 | erase=0 19 | @@ -84,7 +85,7 @@ 20 | -mkdir -p $(build) 21 | > $(log) 22 | cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --enable-install-libbfd $(to_log) 23 | - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 24 | + $(MAKE) -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 25 | $(clean_up) 26 | 27 | $(build_gcc_pass1) $(build_gcc_pass2): build = build-gcc-$(target)-$(gcc_ver) 28 | @@ -95,7 +96,7 @@ 29 | -mkdir -p $(build) 30 | > $(log) 31 | cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls $(extra_configure_args) $(to_log) 32 | - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 33 | + $(MAKE) -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 34 | 35 | $(build_newlib): build = build-newlib-$(target)-$(newlib_ver) 36 | $(build_newlib): src_dir = newlib-$(newlib_ver) 37 | @@ -105,7 +106,7 @@ 38 | -mkdir -p $(build) 39 | > $(log) 40 | cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(extra_configure_args) $(to_log) 41 | - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 42 | + $(MAKE) -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 43 | $(clean_up) 44 | 45 | $(build_gcc_pass2): log = $(logdir)/$(build)-pass2.log 46 | @@ -115,7 +116,7 @@ 47 | > $(log) 48 | cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --with-newlib --disable-libssp --disable-tls \ 49 | --enable-threads=$(thread_model) --enable-languages=$(pass2_languages) $(extra_configure_args) $(to_log) 50 | - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 51 | + $(MAKE) -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) 52 | $(clean_up) 53 | 54 | # ---- }}}} 55 | -------------------------------------------------------------------------------- /toolchain/files/newlib-3.3.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/toolchain/files/newlib-3.3.0.tar.gz -------------------------------------------------------------------------------- /toolchain/files/vgm_cmp.diff: -------------------------------------------------------------------------------- 1 | --- vgm_cmp.c.orig 2011-08-14 15:51:52.000000000 -0400 2 | +++ vgm_cmp.c 2012-10-30 19:25:16.937415508 -0400 3 | @@ -11,7 +11,7 @@ 4 | #include // for GetTickCount 5 | #endif 6 | 7 | -#include "zlib.h" 8 | +#include 9 | 10 | #include "stdtype.h" 11 | #include "VGMFile.h" 12 | @@ -782,7 +782,8 @@ 13 | VGMPos += CmdLen; 14 | if (StopVGM) 15 | break; 16 | - 17 | + 18 | + /* 19 | if (CmdTimer < GetTickCount()) 20 | { 21 | PrintMinSec(VGMSmplPos, MinSecStr); 22 | @@ -793,6 +794,7 @@ 23 | MinSecStr, TempStr, VGMPos, VGMHead.lngEOFOffset); 24 | CmdTimer = GetTickCount() + 200; 25 | } 26 | + */ 27 | } 28 | DataSizeA = VGMPos - VGMHead.lngDataOffset; 29 | DataSizeB = DstPos - VGMHead.lngDataOffset; 30 | -------------------------------------------------------------------------------- /toolchain/ldscripts/mars-myth-sdram.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(sh) 2 | SEARCH_DIR(.) 3 | __DYNAMIC = 0; 4 | 5 | /* 6 | * The memory map look like this: 7 | * +--------------------+ <- 0x02300000 8 | * | .text | 9 | * | _etext | 10 | * | ctor list | the ctor and dtor lists are for 11 | * | dtor list | C++ support 12 | * +--------------------+ 13 | * . . 14 | * . . 15 | * . . 16 | * +--------------------+ <- 0x06000000 17 | * | .data | initialized data goes here 18 | * | _edata | 19 | * +--------------------+ 20 | * | .bss | 21 | * | __bss_start | start of bss, cleared by crt0 22 | * | _end | start of heap, used by sbrk() 23 | * +--------------------+ 24 | * . . 25 | * . . 26 | * . . 27 | * | __stack | top of stack (for Master SH2) 28 | * +--------------------+ <- 0x0603FC00 29 | */ 30 | 31 | MEMORY 32 | { 33 | psram (wx) : ORIGIN = 0x02300000, LENGTH = 0x00100000 34 | ram (wx) : ORIGIN = 0x06000000, LENGTH = 0x0003FC00 35 | } 36 | 37 | /* 38 | * Allocate the stack to be at the top of memory, since the stack 39 | * grows down 40 | */ 41 | 42 | PROVIDE (__stack = 0x0603FC00); 43 | 44 | SECTIONS 45 | { 46 | .text 0x02300000 : 47 | AT ( 0x00000000 ) 48 | { 49 | *(.text .text.*) 50 | . = ALIGN(0x4); 51 | __CTOR_LIST__ = .; 52 | ___CTOR_LIST__ = .; 53 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 54 | *(.ctors) 55 | LONG(0) 56 | __CTOR_END__ = .; 57 | __DTOR_LIST__ = .; 58 | ___DTOR_LIST__ = .; 59 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) 60 | *(.dtors) 61 | LONG(0) 62 | __DTOR_END__ = .; 63 | *(.rodata .rodata.*) 64 | *(.gcc_except_table .gcc_except_table.*) 65 | 66 | . = ALIGN(0x10); 67 | __INIT_SECTION__ = . ; 68 | *(.init) 69 | SHORT (0x000B) /* rts */ 70 | SHORT (0x0009) /* nop */ 71 | 72 | . = ALIGN(0x10); 73 | __FINI_SECTION__ = . ; 74 | *(.fini) 75 | SHORT (0x000B) /* rts */ 76 | SHORT (0x0009) /* nop */ 77 | 78 | _etext = .; 79 | *(.lit) 80 | . = ALIGN(0x4); 81 | } > psram 82 | _stext = SIZEOF (.text); 83 | 84 | .data 0x06000000 : 85 | AT ( LOADADDR (.text) + SIZEOF (.text) ) 86 | { 87 | *(.got.plt) *(.got) 88 | *(.shdata) 89 | *(.data .data.*) 90 | _edata = .; 91 | . = ALIGN(0x4); 92 | } > ram 93 | _sdata = SIZEOF (.data); 94 | 95 | .bss 0x06000000 + SIZEOF (.data) : 96 | { 97 | __bss_start = . ; 98 | *(.shbss) 99 | *(.bss .bss.*) 100 | *(COMMON) 101 | _end = ALIGN (0x8); 102 | __end = _end; 103 | end = _end; 104 | } > ram 105 | 106 | .stab 0 (NOLOAD) : 107 | { 108 | *(.stab) 109 | } 110 | 111 | .stabstr 0 (NOLOAD) : 112 | { 113 | *(.stabstr) 114 | } 115 | 116 | .eh_frame 0 (NOLOAD) : 117 | { 118 | *(.eh_frame) 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /toolchain/ldscripts/mars.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(sh) 2 | SEARCH_DIR(.) 3 | __DYNAMIC = 0; 4 | 5 | /* 6 | * The memory map look like this: 7 | * +--------------------+ <- 0x02000000 8 | * | .text | 9 | * | _etext | 10 | * | ctor list | the ctor and dtor lists are for 11 | * | dtor list | C++ support 12 | * +--------------------+ 13 | * . . 14 | * . . 15 | * . . 16 | * +--------------------+ <- 0x06000000 17 | * | .data | initialized data goes here 18 | * | _edata | 19 | * +--------------------+ 20 | * | .bss | 21 | * | __bss_start | start of bss, cleared by crt0 22 | * | _end | start of heap, used by sbrk() 23 | * +--------------------+ 24 | * . . 25 | * . . 26 | * . . 27 | * | __stack | top of stack (for Master SH2) 28 | * +--------------------+ <- 0x0603FC00 29 | */ 30 | 31 | MEMORY 32 | { 33 | rom (rx) : ORIGIN = 0x02000000, LENGTH = 0x00400000 34 | ram (wx) : ORIGIN = 0x06000000, LENGTH = 0x0003FC00 35 | } 36 | 37 | /* 38 | * Allocate the stack to be at the top of memory, since the stack 39 | * grows down 40 | */ 41 | 42 | PROVIDE (__stack = 0x0603FC00); 43 | 44 | SECTIONS 45 | { 46 | .text 0x02000000 : 47 | AT ( 0x00000000 ) 48 | { 49 | *(.text .text.*) 50 | . = ALIGN(0x4); 51 | __CTOR_LIST__ = .; 52 | ___CTOR_LIST__ = .; 53 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 54 | *(.ctors) 55 | LONG(0) 56 | __CTOR_END__ = .; 57 | __DTOR_LIST__ = .; 58 | ___DTOR_LIST__ = .; 59 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) 60 | *(.dtors) 61 | LONG(0) 62 | __DTOR_END__ = .; 63 | *(.rodata .rodata.*) 64 | *(.gcc_except_table .gcc_except_table.*) 65 | 66 | . = ALIGN(0x10); 67 | __INIT_SECTION__ = . ; 68 | *(.init) 69 | SHORT (0x000B) /* rts */ 70 | SHORT (0x0009) /* nop */ 71 | 72 | . = ALIGN(0x10); 73 | __FINI_SECTION__ = . ; 74 | *(.fini) 75 | SHORT (0x000B) /* rts */ 76 | SHORT (0x0009) /* nop */ 77 | 78 | _etext = .; 79 | *(.lit) 80 | . = ALIGN(0x4); 81 | } > rom 82 | _stext = SIZEOF (.text); 83 | 84 | .data 0x06000000 : 85 | AT ( LOADADDR (.text) + SIZEOF (.text) ) 86 | { 87 | *(.got.plt) *(.got) 88 | *(.shdata) 89 | *(.data .data.*) 90 | _edata = .; 91 | . = ALIGN(0x4); 92 | } > ram 93 | _sdata = SIZEOF (.data); 94 | 95 | .bss 0x06000000 + SIZEOF (.data) : 96 | { 97 | __bss_start = . ; 98 | *(.shbss) 99 | *(.bss .bss.*) 100 | *(COMMON) 101 | _end = ALIGN (0x8); 102 | __end = _end; 103 | end = _end; 104 | } > ram 105 | 106 | .stab 0 (NOLOAD) : 107 | { 108 | *(.stab) 109 | } 110 | 111 | .stabstr 0 (NOLOAD) : 112 | { 113 | *(.stabstr) 114 | } 115 | 116 | .eh_frame 0 (NOLOAD) : 117 | { 118 | *(.eh_frame) 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /toolchain/ldscripts/md-myth-psram.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(m68k) 2 | SEARCH_DIR(.) 3 | __DYNAMIC = 0; 4 | 5 | /* 6 | * The memory map look like this: 7 | * +--------------------+ <- 0x00300000 8 | * | .text | 9 | * | _etext | 10 | * | ctor list | the ctor and dtor lists are for 11 | * | dtor list | C++ support 12 | * +--------------------+ 13 | * | .data | initialized data goes here 14 | * | _edata | 15 | * +--------------------+ 16 | * | .bss | 17 | * | __bss_start | start of bss, cleared by crt0 18 | * | _end | start of heap, used by sbrk() 19 | * +--------------------+ 20 | * . . 21 | * . . 22 | * . . 23 | * | __stack | top of stack 24 | * +--------------------+ <- 0x00400000 25 | * 26 | * Note - variables in Myth ram MUST be written as words 27 | */ 28 | 29 | MEMORY 30 | { 31 | psram (wx) : ORIGIN = 0x00300000, LENGTH = 0x00100000 32 | } 33 | 34 | /* 35 | * Allocate the stack to be at the top of memory, since the stack 36 | * grows down 37 | */ 38 | 39 | PROVIDE (__stack = 4M); 40 | 41 | SECTIONS 42 | { 43 | .text 0x00300000 : 44 | AT ( 0x00000000 ) 45 | { 46 | *(.text .text.*) 47 | . = ALIGN(0x4); 48 | __CTOR_LIST__ = .; 49 | ___CTOR_LIST__ = .; 50 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 51 | *(.ctors) 52 | LONG(0) 53 | __CTOR_END__ = .; 54 | __DTOR_LIST__ = .; 55 | ___DTOR_LIST__ = .; 56 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) 57 | *(.dtors) 58 | LONG(0) 59 | __DTOR_END__ = .; 60 | *(.rodata .rodata.*) 61 | *(.gcc_except_table .gcc_except_table.*) 62 | 63 | . = ALIGN(0x4); 64 | __INIT_SECTION__ = . ; 65 | *(.init) 66 | SHORT (0x4E75) /* rts */ 67 | 68 | __FINI_SECTION__ = . ; 69 | *(.fini) 70 | SHORT (0x4E75) /* rts */ 71 | 72 | _etext = .; 73 | *(.lit) 74 | . = ALIGN(0x4); 75 | } > psram 76 | _stext = SIZEOF (.text); 77 | 78 | .data : 79 | AT ( LOADADDR (.text) + SIZEOF (.text) ) 80 | { 81 | *(.got.plt) *(.got) 82 | *(.shdata) 83 | *(.data .data.*) 84 | _edata = .; 85 | . = ALIGN(0x4); 86 | } > psram 87 | _sdata = SIZEOF (.data); 88 | 89 | .bss : 90 | { 91 | __bss_start = . ; 92 | *(.shbss) 93 | *(.bss .bss.*) 94 | *(COMMON) 95 | _end = ALIGN (0x8); 96 | __end = _end; 97 | end = _end; 98 | } > psram 99 | 100 | .stab 0 (NOLOAD) : 101 | { 102 | *(.stab) 103 | } 104 | 105 | .stabstr 0 (NOLOAD) : 106 | { 107 | *(.stabstr) 108 | } 109 | 110 | .eh_frame 0 (NOLOAD) : 111 | { 112 | *(.eh_frame) 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /toolchain/ldscripts/md-myth-wram.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(m68k) 2 | SEARCH_DIR(.) 3 | __DYNAMIC = 0; 4 | 5 | /* 6 | * The memory map look like this: 7 | * +--------------------+ <- 0x00300000 8 | * | .text | 9 | * | _etext | 10 | * | ctor list | the ctor and dtor lists are for 11 | * | dtor list | C++ support 12 | * +--------------------+ 13 | * . . 14 | * . . 15 | * . . 16 | * +--------------------+ <- 0x00FF0000 17 | * | .data | initialized data goes here 18 | * | _edata | 19 | * +--------------------+ 20 | * | .bss | 21 | * | __bss_start | start of bss, cleared by crt0 22 | * | _end | start of heap, used by sbrk() 23 | * +--------------------+ 24 | * . . 25 | * . . 26 | * . . 27 | * | __stack | top of stack 28 | * +--------------------+ <- 0x01000000 29 | */ 30 | 31 | MEMORY 32 | { 33 | psram (wx) : ORIGIN = 0x00300000, LENGTH = 0x00100000 34 | ram (wx) : ORIGIN = 0x00FF0000, LENGTH = 0x00010000 35 | } 36 | 37 | /* 38 | * Allocate the stack to be at the top of memory, since the stack 39 | * grows down 40 | */ 41 | 42 | PROVIDE (__stack = 16M); 43 | 44 | SECTIONS 45 | { 46 | .text 0x00300000 : 47 | AT ( 0x00000000 ) 48 | { 49 | *(.text .text.*) 50 | . = ALIGN(0x4); 51 | __CTOR_LIST__ = .; 52 | ___CTOR_LIST__ = .; 53 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 54 | *(.ctors) 55 | LONG(0) 56 | __CTOR_END__ = .; 57 | __DTOR_LIST__ = .; 58 | ___DTOR_LIST__ = .; 59 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) 60 | *(.dtors) 61 | LONG(0) 62 | __DTOR_END__ = .; 63 | *(.rodata .rodata.*) 64 | *(.gcc_except_table .gcc_except_table.*) 65 | 66 | . = ALIGN(0x4); 67 | __INIT_SECTION__ = . ; 68 | *(.init) 69 | SHORT (0x4E75) /* rts */ 70 | 71 | __FINI_SECTION__ = . ; 72 | *(.fini) 73 | SHORT (0x4E75) /* rts */ 74 | 75 | _etext = .; 76 | *(.lit) 77 | . = ALIGN(0x4); 78 | } > psram 79 | _stext = SIZEOF (.text); 80 | 81 | .data 0x00FF0000 : 82 | AT ( LOADADDR (.text) + SIZEOF (.text) ) 83 | { 84 | *(.got.plt) *(.got) 85 | *(.shdata) 86 | *(.data .data.*) 87 | _edata = .; 88 | . = ALIGN(0x4); 89 | } > ram 90 | _sdata = SIZEOF (.data); 91 | 92 | .bss 0x00FF0000 + SIZEOF (.data) : 93 | { 94 | __bss_start = . ; 95 | *(.shbss) 96 | *(.bss .bss.*) 97 | *(COMMON) 98 | _end = ALIGN (0x8); 99 | __end = _end; 100 | end = _end; 101 | } > ram 102 | 103 | .stab 0 (NOLOAD) : 104 | { 105 | *(.stab) 106 | } 107 | 108 | .stabstr 0 (NOLOAD) : 109 | { 110 | *(.stabstr) 111 | } 112 | 113 | .eh_frame 0 (NOLOAD) : 114 | { 115 | *(.eh_frame) 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /toolchain/ldscripts/md-split-ram.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(m68k) 2 | SEARCH_DIR(.) 3 | __DYNAMIC = 0; 4 | 5 | /* 6 | * The memory map look like this: 7 | * +--------------------+ <- 0x00000000 8 | * | .text | 9 | * | _etext | 10 | * | ctor list | the ctor and dtor lists are for 11 | * | dtor list | C++ support 12 | * +--------------------+ 13 | * . . 14 | * . . 15 | * +--------------------+ <- 0xFFFF0000 16 | * | __stack | top of stack 17 | * +--------------------+ <- 0xFFFF8000 18 | * | .data | initialized data goes here 19 | * | _edata | 20 | * +--------------------+ 21 | * | .bss | 22 | * | __bss_start | start of bss, cleared by crt0 23 | * | _end | start of heap, used by sbrk() 24 | * +--------------------+ 25 | * . . 26 | * . . 27 | * . . 28 | * +--------------------+ <- 0x100000000 29 | */ 30 | 31 | MEMORY 32 | { 33 | rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00400000 34 | ram (wx) : ORIGIN = 0xFFFF8000, LENGTH = 0x00008000 35 | } 36 | 37 | /* 38 | * Allocate the stack to be at the top of memory, since the stack 39 | * grows down 40 | */ 41 | 42 | PROVIDE (__stack = 0xFFFF8000); 43 | 44 | SECTIONS 45 | { 46 | .text 0x00000000 : 47 | { 48 | *(.text .text.*) 49 | . = ALIGN(0x4); 50 | __CTOR_LIST__ = .; 51 | ___CTOR_LIST__ = .; 52 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 53 | *(.ctors) 54 | LONG(0) 55 | __CTOR_END__ = .; 56 | __DTOR_LIST__ = .; 57 | ___DTOR_LIST__ = .; 58 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) 59 | *(.dtors) 60 | LONG(0) 61 | __DTOR_END__ = .; 62 | *(.rodata .rodata.*) 63 | *(.gcc_except_table .gcc_except_table.*) 64 | 65 | . = ALIGN(0x4); 66 | __INIT_SECTION__ = . ; 67 | *(.init) 68 | SHORT (0x4E75) /* rts */ 69 | 70 | __FINI_SECTION__ = . ; 71 | *(.fini) 72 | SHORT (0x4E75) /* rts */ 73 | 74 | _etext = .; 75 | *(.lit) 76 | . = ALIGN(0x4); 77 | } > rom 78 | _stext = SIZEOF (.text); 79 | 80 | .data 0xFFFF8000 : 81 | AT ( LOADADDR (.text) + SIZEOF (.text) ) 82 | { 83 | *(.got.plt) *(.got) 84 | *(.shdata) 85 | *(.data .data.*) 86 | _edata = .; 87 | . = ALIGN(0x4); 88 | } > ram 89 | _sdata = SIZEOF (.data); 90 | 91 | .bss 0xFFFF8000 + SIZEOF (.data) : 92 | { 93 | __bss_start = . ; 94 | *(.shbss) 95 | *(.bss .bss.*) 96 | *(COMMON) 97 | _end = ALIGN (0x8); 98 | __end = _end; 99 | end = _end; 100 | } > ram 101 | 102 | .stab 0 (NOLOAD) : 103 | { 104 | *(.stab) 105 | } 106 | 107 | .stabstr 0 (NOLOAD) : 108 | { 109 | *(.stabstr) 110 | } 111 | 112 | .eh_frame 0 (NOLOAD) : 113 | { 114 | *(.eh_frame) 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /toolchain/ldscripts/md.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(m68k) 2 | SEARCH_DIR(.) 3 | __DYNAMIC = 0; 4 | 5 | /* 6 | * The memory map look like this: 7 | * +--------------------+ <- 0x00000000 8 | * | .text | 9 | * | _etext | 10 | * | ctor list | the ctor and dtor lists are for 11 | * | dtor list | C++ support 12 | * +--------------------+ 13 | * . . 14 | * . . 15 | * . . 16 | * +--------------------+ <- 0x00FF0000 17 | * | .data | initialized data goes here 18 | * | _edata | 19 | * +--------------------+ 20 | * | .bss | 21 | * | __bss_start | start of bss, cleared by crt0 22 | * | _end | start of heap, used by sbrk() 23 | * +--------------------+ 24 | * . . 25 | * . . 26 | * . . 27 | * | __stack | top of stack 28 | * +--------------------+ <- 0x01000000 29 | */ 30 | 31 | MEMORY 32 | { 33 | rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00400000 34 | ram (wx) : ORIGIN = 0x00FF0000, LENGTH = 0x00010000 35 | } 36 | 37 | /* 38 | * Allocate the stack to be at the top of memory, since the stack 39 | * grows down 40 | */ 41 | 42 | PROVIDE (__stack = 16M); 43 | 44 | SECTIONS 45 | { 46 | .text 0x00000000 : 47 | { 48 | *(.text .text.*) 49 | . = ALIGN(0x4); 50 | __CTOR_LIST__ = .; 51 | ___CTOR_LIST__ = .; 52 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 53 | *(.ctors) 54 | LONG(0) 55 | __CTOR_END__ = .; 56 | __DTOR_LIST__ = .; 57 | ___DTOR_LIST__ = .; 58 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) 59 | *(.dtors) 60 | LONG(0) 61 | __DTOR_END__ = .; 62 | *(.rodata .rodata.*) 63 | *(.gcc_except_table .gcc_except_table.*) 64 | 65 | . = ALIGN(0x4); 66 | __INIT_SECTION__ = . ; 67 | *(.init) 68 | SHORT (0x4E75) /* rts */ 69 | 70 | __FINI_SECTION__ = . ; 71 | *(.fini) 72 | SHORT (0x4E75) /* rts */ 73 | 74 | _etext = .; 75 | *(.lit) 76 | . = ALIGN(0x4); 77 | } > rom 78 | _stext = SIZEOF (.text); 79 | 80 | .data 0x00FF0000 : 81 | AT ( LOADADDR (.text) + SIZEOF (.text) ) 82 | { 83 | *(.got.plt) *(.got) 84 | *(.shdata) 85 | *(.data .data.*) 86 | _edata = .; 87 | . = ALIGN(0x4); 88 | } > ram 89 | _sdata = SIZEOF (.data); 90 | 91 | .bss 0x00FF0000 + SIZEOF (.data) : 92 | { 93 | __bss_start = . ; 94 | *(.shbss) 95 | *(.bss .bss.*) 96 | *(COMMON) 97 | _end = ALIGN (0x8); 98 | __end = _end; 99 | end = _end; 100 | } > ram 101 | 102 | .stab 0 (NOLOAD) : 103 | { 104 | *(.stab) 105 | } 106 | 107 | .stabstr 0 (NOLOAD) : 108 | { 109 | *(.stabstr) 110 | } 111 | 112 | .eh_frame 0 (NOLOAD) : 113 | { 114 | *(.eh_frame) 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /tools/files/VGMTools_src.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/VGMTools_src.rar -------------------------------------------------------------------------------- /tools/files/applib/contrib/16bit/deppack.nas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/16bit/deppack.nas -------------------------------------------------------------------------------- /tools/files/applib/contrib/16bit/makeit.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib 16bit NASM depacker examples --- 3 | ECHO. 4 | 5 | call nasm deppack.nas -o deppack.com 6 | call nasm depptiny.nas -o depptiny.com 7 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/PowerBuilder/example.txt: -------------------------------------------------------------------------------- 1 | Compress File: 2 | 3 | Integer li_rtn 4 | String ls_source 5 | String ls_dest 6 | 7 | uo_external_function_compression compression_func 8 | 9 | compression_func = Create uo_external_function_compression 10 | 11 | ls_source = as_source + as_file 12 | ls_dest = as_dest + compression_func.uof_compressed_name(as_file) 13 | 14 | li_rtn = compression_func.uof_compress(ls_source, ls_dest, as_message) 15 | 16 | Destroy compression_func 17 | 18 | Return li_rtn 19 | 20 | 21 | 22 | 23 | Decompress File: 24 | Integer li_rtn 25 | String ls_source 26 | String ls_dest 27 | 28 | uo_external_function_compression compression_func 29 | 30 | compression_func = Create uo_external_function_compression 31 | 32 | ls_source = as_source + compression_func.uof_compressed_name(as_file) 33 | ls_dest = as_dest + as_file 34 | 35 | li_rtn = compression_func.uof_decompress(ls_source, ls_dest, as_message) 36 | 37 | Destroy compression_func 38 | 39 | Return li_rtn -------------------------------------------------------------------------------- /tools/files/applib/contrib/PowerBuilder/str_filetime.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_filetime.srs 2 | global type str_filetime from structure 3 | unsignedlong dwlowdatetime 4 | unsignedlong dwhighdatetime 5 | end type 6 | 7 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/PowerBuilder/str_netresource.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_netresource.srs 2 | global type str_netresource from structure 3 | unsignedlong dwscope 4 | unsignedlong dwtype 5 | unsignedlong dwdisplaytype 6 | unsignedlong dwusage 7 | string lplocalname 8 | string lpremotename 9 | string lpcomment 10 | string lpprovider 11 | end type 12 | 13 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/PowerBuilder/str_ofstruct.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_ofstruct.srs 2 | global type str_ofstruct from structure 3 | unsignedinteger cbytes 4 | unsignedinteger ffixeddisk 5 | unsignedlong nerrcode 6 | unsignedlong reserved1 7 | unsignedlong reserved2 8 | string szpathname 9 | end type 10 | 11 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/PowerBuilder/str_overlapped.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_overlapped.srs 2 | global type str_overlapped from structure 3 | unsignedlong Internal 4 | unsignedlong InternalHigh 5 | unsignedlong Offset 6 | unsignedlong OffsetHigh 7 | unsignedlong hEvent 8 | end type 9 | 10 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/PowerBuilder/str_security_attibutes.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_security_attibutes.srs 2 | global type str_security_attibutes from structure 3 | unsignedlong nlength 4 | long lpsecuritydescriptor 5 | boolean binherithandle 6 | end type 7 | 8 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/ACU_Dos/apacdemo.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/ACU_Dos/aplib.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/ACU_Win/apacdemo.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/ACU_Win/aplib.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/aplib.adb: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- File: aplib.adb; see specification (aplib.ads) 3 | ----------------------------------------------------------------------------- 4 | with System, Ada.Unchecked_Deallocation; 5 | 6 | -- with Ada.Text_IO; use Ada.Text_IO; -- OA debug 7 | 8 | package body aPLib is 9 | 10 | procedure Pack( source : in unpacked_data; 11 | destination : out packed_data; 12 | packed_length: out integer ) is 13 | 14 | type byte is mod 2 ** 8; for byte'size use 8; 15 | type twa is array( 0..aP_workmem_size(source'size / 8) ) of byte; 16 | pragma pack(twa); 17 | 18 | type pwa is access twa; 19 | procedure Dispose is new Ada.Unchecked_Deallocation( twa, pwa ); 20 | 21 | type p_cb is access function (unpacked, packed: integer) return integer; 22 | 23 | function aP_pack(source: unpacked_data; 24 | destination_addr: System.Address; -- trick for "in" par. 25 | length: integer; 26 | work_mem: twa; 27 | cb: p_cb) 28 | return integer; 29 | 30 | pragma Import(C, aP_pack, "aP_pack"); 31 | 32 | function cb(unpacked, packed: integer) return integer is 33 | cont: boolean; 34 | begin 35 | Call_back(unpacked, packed, cont); 36 | return Boolean'Pos(cont); -- 0 false, 1 true 37 | end cb; 38 | 39 | p_to_cb: p_cb:= cb'access; 40 | tmp_work_mem: pwa:= New twa; 41 | begin 42 | -- Put_Line("OA3 "); 43 | -- packed_length:= 44 | -- aP_pack( source'Address, destination'Address, 45 | -- source'size / 8, tmp_work_mem.all'Address, cb'Address ); 46 | -- Put_Line("OA4 "); 47 | 48 | packed_length:= 49 | aP_pack( source, destination'Address, 50 | source'size / 8, tmp_work_mem.all, p_to_cb ); 51 | 52 | Dispose( tmp_work_mem ); -- we immediately free the work memory 53 | 54 | if packed_length=0 then -- 0 means error 55 | raise Pack_failed; 56 | end if; 57 | end Pack; 58 | 59 | procedure Depack( source : in packed_data; 60 | destination: out unpacked_data ) is 61 | 62 | function aP_depack_asm_fast( 63 | source: packed_data; 64 | destination_addr: System.Address -- trick for "in" par. 65 | ) return integer; 66 | pragma Import(C, aP_depack_asm_fast, "aP_depack_asm_fast"); 67 | 68 | begin 69 | if aP_depack_asm_fast( source, destination'Address )=0 then 70 | raise Unpack_failed; 71 | end if; 72 | end Depack; 73 | 74 | end aPLib; 75 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/aplib.ads: -------------------------------------------------------------------------------- 1 | -- 2 | -- aPLib compression library - the smaller the better :) 3 | -- 4 | -- Ada binding for aplib.a 5 | -- 6 | -- Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | -- All Rights Reserved 8 | -- 9 | -- http://www.ibsensoftware.com/ 10 | -- 11 | -- Ada binding by Gautier de Montmollin - gdemont@hotmail.com, gdm@mydiax.ch 12 | -- 13 | 14 | 15 | package aPLib is 16 | 17 | -- Give the maximum "packed" size possible - it can be more than 18 | -- the unpacked size in case of uncompressible data: 19 | 20 | function Evaluate_max_packed_space( unpacked_size: Integer ) return Integer; 21 | pragma Import(C, Evaluate_max_packed_space, "aP_max_packed_size"); 22 | -- Was, before v0.34 b4: (((unpacked_size * 9) / 8) + 16) 23 | 24 | 25 | -- A template for packing data: 26 | 27 | generic 28 | type packed_data is private; 29 | type unpacked_data is private; 30 | with procedure Call_back( unpacked_bytes, packed_bytes: in integer; 31 | continue : out boolean ); 32 | 33 | procedure Pack( source : in unpacked_data; 34 | destination : out packed_data; 35 | packed_length: out integer ); 36 | 37 | -- A template for unpacking data: 38 | 39 | generic 40 | type packed_data is private; 41 | type unpacked_data is private; 42 | 43 | procedure Depack( source : in packed_data; 44 | destination: out unpacked_data ); 45 | 46 | -- Exceptions for errors that could occur: 47 | 48 | pack_failed, unpack_failed: exception; 49 | 50 | -- Just for information 51 | 52 | function aP_workmem_size(inputsize: integer) return integer; 53 | pragma Import(C, aP_workmem_size, "aP_workmem_size"); 54 | 55 | end aPLib; 56 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/gnat.ago: -------------------------------------------------------------------------------- 1 | -O2 -gnatp 2 | -i -aOACU_Win -largs ..\..\lib\mscoff\aplib.lib 3 | 4 | 5 | WINDOWS_TARGET 6 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/mk_aonix.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Ada example for Aonix ObjectAda for Windows --- 3 | ECHO. 4 | 5 | SET OAPATH=C:\Program Files\Aonix\ObjectAda\bin\ 6 | 7 | if not exist "%OAPATH%adareg.exe" echo Wrong path [%OAPATH%] - change mk_aonix.bat! 8 | 9 | if exist unit.map goto build 10 | 11 | "%OAPATH%adareg" *.ad? 12 | ECHO. 13 | 14 | :build 15 | 16 | "%OAPATH%adabuild" apacdemo -ll ..\..\lib\coff\aplib.lib 17 | ECHO. 18 | 19 | ECHO Warning: this version doesn't work yet! :-( 20 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/mk_gndos.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Ada example for GNAT/DOS (ez2load) --- 3 | ECHO. 4 | 5 | gnatmake -g -i %1 -O2 -gnatp -aOACU_DOS apacdemo -largs ..\..\lib\coff\aplib.a 6 | 7 | if exist b_*.* del b_*.* 8 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/ada/mk_gnwin.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Ada example for GNAT/Windows --- 3 | ECHO. 4 | 5 | gnatmake -g -i %1 -O2 -gnatp -aOACU_Win apacdemo -largs ..\..\lib\coff\aplib.lib 6 | 7 | if exist b~*.* del b~*.* 8 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/bcb/MainFormUnit.ddp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/bcb/MainFormUnit.ddp -------------------------------------------------------------------------------- /tools/files/applib/contrib/bcb/MainFormUnit.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | // MainFormUnit.cpp 3 | //--------------------------------------------------------------------------- 4 | 5 | //--------------------------------------------------------------------------- 6 | // Header Guard 7 | #ifndef MainFormUnitH 8 | #define MainFormUnitH 9 | //--------------------------------------------------------------------------- 10 | 11 | //--------------------------------------------------------------------------- 12 | // Application Includes 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | //--------------------------------------------------------------------------- 21 | 22 | 23 | //--------------------------------------------------------------------------- 24 | class TMainForm : public TForm 25 | { 26 | private: 27 | bool wantscancel; 28 | __published: 29 | // IDE-managed Components 30 | TPanel *Panel1; 31 | TLabel *LabelaPLib2; 32 | TLabel *LabelaPLib1; 33 | TLabel *Label5; 34 | TGroupBox *GroupBox1; 35 | TLabel *LabelResult; 36 | TProgressBar *ProgressBar; 37 | TButton *ButtonCancel; 38 | TButton *ButtonCompress; 39 | TButton *ButtonDecompress; 40 | TOpenDialog *OpenDialog; 41 | void __fastcall ButtonCompressClick(TObject *Sender); 42 | void __fastcall ButtonDecompressClick(TObject *Sender); 43 | void __fastcall ButtonCancelClick(TObject *Sender); 44 | public: 45 | // constructor 46 | __fastcall TMainForm(TComponent* Owner); 47 | public: 48 | void Initialize(); 49 | void SetStateRunning(); 50 | void SetStateNotRunning(); 51 | public: 52 | bool get_wantscancel() {return wantscancel;}; 53 | }; 54 | //--------------------------------------------------------------------------- 55 | 56 | 57 | 58 | 59 | 60 | 61 | //--------------------------------------------------------------------------- 62 | // C++ Builder Global Instance Pointer 63 | extern PACKAGE TMainForm *MainForm; 64 | //--------------------------------------------------------------------------- 65 | 66 | 67 | 68 | 69 | 70 | //--------------------------------------------------------------------------- 71 | // End of Header Guard 72 | #endif 73 | //--------------------------------------------------------------------------- 74 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/bcb/README_ABOUT_APLIB_DLL.txt: -------------------------------------------------------------------------------- 1 | If you want to use the aplib.dll with your bcb project, link with the aplib.lib file here in the LibForDll directory. 2 | If you don't want to use the dll, then just link with the static aplib.lib in the ..\..\lib\omf directory. 3 | The sample project uses the static lib in ..\..\lib\omf -------------------------------------------------------------------------------- /tools/files/applib/contrib/bcb/apacksamplec.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | // apackcsample.c 3 | //--------------------------------------------------------------------------- 4 | 5 | //--------------------------------------------------------------------------- 6 | // Header Guard 7 | #ifndef aspacksamplecH 8 | #define aspacksamplecH 9 | //--------------------------------------------------------------------------- 10 | 11 | 12 | //--------------------------------------------------------------------------- 13 | // Calling Convenction (depends on library) 14 | // This version works with watcom version of the lib 15 | //#define STDPREFIX __stdcall 16 | #define STDPREFIX __cdecl 17 | //--------------------------------------------------------------------------- 18 | 19 | 20 | //--------------------------------------------------------------------------- 21 | // Forward declarations 22 | // 23 | typedef STDPREFIX int (callbackfuncdef)(unsigned int insize, unsigned int inpos, unsigned int outpos, void *cbparam); 24 | typedef STDPREFIX void (resultcallbackfundef)(char *errorstring,int errorcode); 25 | // 26 | int STDPREFIX samplecallback(unsigned int insize, unsigned int inpos, unsigned int outpos, void *cbparam); 27 | void STDPREFIX sampleresultcallback(char *errorstr); 28 | // 29 | unsigned int ratio(unsigned int x, unsigned int y); 30 | int compress_file(const char *oldname, const char *packedname,callbackfuncdef *callbackfp,resultcallbackfundef *resultcallbackfp); 31 | int decompress_file(const char *packedname, const char *newname,callbackfuncdef *callbackfp,resultcallbackfundef *resultcallbackfp); 32 | int samplemain(int argc, char *argv[]); 33 | void show_syntax(void); 34 | //--------------------------------------------------------------------------- 35 | 36 | 37 | 38 | 39 | 40 | 41 | //--------------------------------------------------------------------------- 42 | // Header Guard 43 | #endif 44 | //--------------------------------------------------------------------------- -------------------------------------------------------------------------------- /tools/files/applib/contrib/bcb/aptest.cpp: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | 3 | #include 4 | #pragma hdrstop 5 | //--------------------------------------------------------------------------- 6 | USEFORM("MainFormUnit.cpp", MainForm); 7 | //--------------------------------------------------------------------------- 8 | WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) 9 | { 10 | try 11 | { 12 | Application->Initialize(); 13 | Application->CreateForm(__classid(TMainForm), &MainForm); 14 | Application->Run(); 15 | } 16 | catch (Exception &exception) 17 | { 18 | Application->ShowException(&exception); 19 | } 20 | catch (...) 21 | { 22 | try 23 | { 24 | throw Exception(""); 25 | } 26 | catch (Exception &exception) 27 | { 28 | Application->ShowException(&exception); 29 | } 30 | } 31 | return 0; 32 | } 33 | //--------------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/bcb/aptest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/bcb/aptest.res -------------------------------------------------------------------------------- /tools/files/applib/contrib/delphi/aplib.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * Delphi aPLib wrapper for example 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> Delphi by Solodovnikov Alexey 21.03.1999 (alenka@mail.line.ru) 12 | *) 13 | 14 | unit aPLib; 15 | 16 | interface 17 | 18 | uses 19 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 20 | (*$IFDEF DYNAMIC_VERSION*) 21 | aPLibud; 22 | (*$ELSE*) 23 | aPLibu; 24 | (*$ENDIF*) 25 | 26 | const 27 | aP_pack_break : DWORD = 0; 28 | aP_pack_continue : DWORD = 1; 29 | 30 | aPLib_Error : DWORD = DWORD(-1); (* indicates error compressing/decompressing *) 31 | 32 | type 33 | 34 | TaPLib = class(TComponent) 35 | private 36 | FWorkMem : Pointer; 37 | FLength : DWORD; 38 | FSource : Pointer; 39 | FDestination : Pointer; 40 | 41 | protected 42 | 43 | public 44 | 45 | CallBack : TaPack_Status; 46 | 47 | procedure Pack; 48 | procedure DePack; 49 | 50 | property Source : Pointer read FSource write FSource; 51 | property Destination : Pointer read FDestination write FDestination; 52 | property Length : DWORD read FLength write FLength; 53 | 54 | published 55 | 56 | end; 57 | 58 | procedure Register; 59 | 60 | implementation 61 | 62 | procedure Register; 63 | begin 64 | RegisterComponents('Samples', [TaPLib]); 65 | end; 66 | 67 | procedure TaPLib.Pack; 68 | begin 69 | if FDestination <> nil then 70 | begin 71 | FreeMem(FDestination); 72 | FDestination := nil; 73 | end; 74 | 75 | if FWorkMem <> nil then 76 | begin 77 | FreeMem(FWorkMem); 78 | FWorkMem := nil; 79 | end; 80 | 81 | GetMem(FDestination,_aP_max_packed_size(FLength)); 82 | if FDestination = nil then raise Exception.Create('Out of memory'); 83 | 84 | GetMem(FWorkMem,_aP_workmem_size(FLength)); 85 | if FWorkMem = nil then raise Exception.Create('Out of memory'); 86 | 87 | FLength := _aPsafe_pack(FSource^, FDestination^, FLength, FWorkMem^, CallBack, nil); 88 | 89 | if FLength = aPLib_Error then raise Exception.Create('Compression error'); 90 | end; 91 | 92 | procedure TaPLib.DePack; 93 | var 94 | DLength : DWORD; 95 | begin 96 | if FDestination <> nil then 97 | begin 98 | FreeMem(FDestination); 99 | FDestination := nil; 100 | end; 101 | 102 | DLength := _aPsafe_get_orig_size(FSource^); 103 | if DLength = aPLib_Error then raise Exception.Create('File is not packed with aPLib'); 104 | 105 | Getmem(FDestination, DLength); 106 | if FDestination = nil then raise Exception.Create('Out of memory'); 107 | 108 | FLength := _aPsafe_depack(FSource^, FLength, FDestination^, DLength); 109 | 110 | if FLength = aPLib_Error then raise Exception.Create('Decompression error'); 111 | end; 112 | 113 | end. 114 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/delphi/aptest.dof: -------------------------------------------------------------------------------- 1 | [Compiler] 2 | A=1 3 | B=0 4 | C=1 5 | D=1 6 | E=0 7 | F=0 8 | G=1 9 | H=1 10 | I=1 11 | J=1 12 | K=0 13 | L=1 14 | M=0 15 | N=1 16 | O=1 17 | P=1 18 | Q=0 19 | R=0 20 | S=0 21 | T=0 22 | U=0 23 | V=1 24 | W=0 25 | X=1 26 | Y=0 27 | Z=1 28 | ShowHints=1 29 | ShowWarnings=1 30 | UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 31 | [Linker] 32 | MapFile=0 33 | OutputObjs=0 34 | ConsoleApp=1 35 | DebugInfo=0 36 | MinStackSize=16384 37 | MaxStackSize=1048576 38 | ImageBase=4194304 39 | ExeDescription= 40 | [Directories] 41 | OutputDir= 42 | UnitOutputDir= 43 | SearchPath= 44 | Packages=vclx30;VCL30;vcldb30;vcldbx30;inetdb30;inet30;VclSmp30;Qrpt30;teeui30;teedb30;tee30;dss30;IBEVNT30;RxDB;RxCtl;RxTools;ppQryWiz;ppDsgnr;ppRCL;ppBDE 45 | Conditionals= 46 | DebugSourceDirs= 47 | UsePackages=0 48 | [Parameters] 49 | RunParams= 50 | HostApplication= 51 | [Version Info] 52 | IncludeVerInfo=0 53 | AutoIncBuild=0 54 | MajorVer=1 55 | MinorVer=0 56 | Release=0 57 | Build=0 58 | Debug=0 59 | PreRelease=0 60 | Special=0 61 | Private=0 62 | DLL=0 63 | Locale=1049 64 | CodePage=1251 65 | [Version Info Keys] 66 | CompanyName= 67 | FileDescription= 68 | FileVersion=1.0.0.0 69 | InternalName= 70 | LegalCopyright= 71 | LegalTrademarks= 72 | OriginalFilename= 73 | ProductName= 74 | ProductVersion=1.0.0.0 75 | Comments= 76 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/delphi/aptest.dpr: -------------------------------------------------------------------------------- 1 | program aPTest; 2 | 3 | uses 4 | Forms, 5 | t_main in 't_main.pas' {frmMain}; 6 | 7 | {$R *.RES} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.CreateForm(TfrmMain, frmMain); 12 | Application.Run; 13 | end. 14 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/delphi/aptest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/delphi/aptest.res -------------------------------------------------------------------------------- /tools/files/applib/contrib/delphi/makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## Delphi example makefile (Borland make) 5 | ## 6 | ## Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | ## All Rights Reserved 8 | ## 9 | 10 | # Add -DDYNAMIC_VERSION to the dccflags variable to link with the 11 | # dll interface (remember to copy the aPLib dll here). 12 | 13 | libdir = ..\..\lib\delphi 14 | 15 | target = aptest.exe 16 | objects = t_main.dcu aplib.dcu aplibu.dcu aplibud.dcu aptest.dpr $(libdir)\aplib.obj $(libdir)\depack.obj $(libdir)\depackf.obj 17 | 18 | dcc = dcc32.exe 19 | dccflags = -Q -$A+ -$O+ -$D- 20 | 21 | .phony: clean 22 | 23 | $(target): $(objects) 24 | $(dcc) $(dccflags) aptest.dpr 25 | 26 | .pas.dcu: 27 | $(dcc) $(dccflags) $< 28 | 29 | clean: 30 | del $(target) 31 | del *.dcu 32 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/delphi/t_main.dfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/delphi/t_main.dfm -------------------------------------------------------------------------------- /tools/files/applib/contrib/dotnet/IbsenSoftware/aPLib/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // aPLib compression library - the smaller the better :) 3 | // 4 | // C# wrapper 5 | // 6 | // Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | // All Rights Reserved 8 | // 9 | // http://www.ibsensoftware.com/ 10 | // 11 | 12 | using System.Reflection; 13 | using System.Runtime.CompilerServices; 14 | 15 | [assembly: AssemblyTitle("aPLib dll wrapper")] 16 | [assembly: AssemblyDescription("C# wrapper for the aPLib dll")] 17 | [assembly: AssemblyConfiguration("")] 18 | [assembly: AssemblyCompany("Ibsen Software")] 19 | [assembly: AssemblyProduct("aPLib compression library")] 20 | [assembly: AssemblyCopyright("Copyright (c) 1998-2009 by Joergen Ibsen. All Rights Reserved.")] 21 | [assembly: AssemblyTrademark("")] 22 | [assembly: AssemblyCulture("")] 23 | 24 | [assembly: AssemblyVersion("1.0.0.0")] 25 | 26 | [assembly: AssemblyDelaySign(false)] 27 | [assembly: AssemblyKeyFile("")] 28 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/dotnet/IbsenSoftware/aPLib/DllInterface.cs: -------------------------------------------------------------------------------- 1 | // 2 | // aPLib compression library - the smaller the better :) 3 | // 4 | // C# wrapper 5 | // 6 | // Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | // All Rights Reserved 8 | // 9 | // http://www.ibsensoftware.com/ 10 | // 11 | 12 | namespace IbsenSoftware.aPLib 13 | { 14 | using System.Runtime.InteropServices; 15 | 16 | public class DllInterface 17 | { 18 | // declare delegate type used for compression callback 19 | public delegate int CompressionCallback( 20 | int length, 21 | int slen, 22 | int dlen, 23 | int cbparam 24 | ); 25 | 26 | [DllImport("aplib.dll")] 27 | public static extern int aP_pack( 28 | [In] byte[] source, 29 | [Out] byte[] destination, 30 | int length, 31 | [In] byte[] workmem, 32 | CompressionCallback callback, 33 | int cbparam 34 | ); 35 | 36 | [DllImport("aplib.dll")] 37 | public static extern int aP_workmem_size(int length); 38 | 39 | [DllImport("aplib.dll")] 40 | public static extern int aP_max_packed_size(int length); 41 | 42 | [DllImport("aplib.dll")] 43 | public static extern int aP_depack_asm( 44 | [In] byte[] source, 45 | [Out] byte[] destination 46 | ); 47 | 48 | [DllImport("aplib.dll")] 49 | public static extern int aP_depack_asm_fast( 50 | [In] byte[] source, 51 | [Out] byte[] destination 52 | ); 53 | 54 | [DllImport("aplib.dll")] 55 | public static extern int aP_depack_asm_safe( 56 | [In] byte[] source, 57 | int srclen, 58 | [Out] byte[] destination, 59 | int dstlen 60 | ); 61 | 62 | [DllImport("aplib.dll")] 63 | public static extern int aP_crc32([In] byte[] source, int length); 64 | 65 | [DllImport("aplib.dll")] 66 | public static extern int aPsafe_pack( 67 | [In] byte[] source, 68 | [Out] byte[] destination, 69 | int length, 70 | [In] byte[] workmem, 71 | CompressionCallback callback, 72 | int cbparam 73 | ); 74 | 75 | [DllImport("aplib.dll")] 76 | public static extern int aPsafe_check([In] byte[] source); 77 | 78 | [DllImport("aplib.dll")] 79 | public static extern int aPsafe_get_orig_size([In] byte[] source); 80 | 81 | [DllImport("aplib.dll")] 82 | public static extern int aPsafe_depack( 83 | [In] byte[] source, 84 | int srclen, 85 | [Out] byte[] destination, 86 | int dstlen 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/dotnet/mk.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib .NET dll wrapper --- 3 | ECHO. 4 | 5 | csc /nologo /w:3 /t:library /debug- /o+ /out:IbsenSoftware.aPLib.dll IbsenSoftware\aPLib\*.cs 6 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/ap.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/masm32/ap.ico -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/aplib.inc: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; MASM32 include file 5 | ;; 6 | 7 | aP_pack proto c, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD 8 | aP_workmem_size proto c, :DWORD 9 | aP_max_packed_size proto c, :DWORD 10 | aP_depack_asm proto c, :DWORD, :DWORD 11 | aP_depack_asm_fast proto c, :DWORD, :DWORD 12 | aP_depack_asm_safe proto c, :DWORD, :DWORD, :DWORD, :DWORD 13 | aP_crc32 proto c, :DWORD, :DWORD 14 | 15 | aPsafe_pack proto c, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD 16 | aPsafe_check proto c, :DWORD 17 | aPsafe_get_orig_size proto c, :DWORD 18 | aPsafe_depack proto c, :DWORD, :DWORD, :DWORD, :DWORD 19 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/appack.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/masm32/appack.asm -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/appack.inc: -------------------------------------------------------------------------------- 1 | ; ######################################################################### 2 | 3 | ; include files 4 | ; ~~~~~~~~~~~~~ 5 | include \MASM32\INCLUDE\windows.inc 6 | include \MASM32\INCLUDE\masm32.inc 7 | include \MASM32\INCLUDE\gdi32.inc 8 | include \MASM32\INCLUDE\user32.inc 9 | include \MASM32\INCLUDE\kernel32.inc 10 | include \MASM32\INCLUDE\Comctl32.inc 11 | include \MASM32\INCLUDE\comdlg32.inc 12 | include \MASM32\INCLUDE\shell32.inc 13 | include \MASM32\include\oleaut32.inc 14 | include aplib.inc 15 | 16 | ; libraries 17 | ; ~~~~~~~~~ 18 | includelib \MASM32\LIB\masm32.lib 19 | 20 | includelib \MASM32\LIB\gdi32.lib 21 | includelib \MASM32\LIB\user32.lib 22 | includelib \MASM32\LIB\kernel32.lib 23 | includelib \MASM32\LIB\Comctl32.lib 24 | includelib \MASM32\LIB\comdlg32.lib 25 | includelib \MASM32\LIB\shell32.lib 26 | includelib \MASM32\LIB\oleaut32.lib 27 | includelib ..\..\lib\coff\aplib.lib 28 | 29 | ; ######################################################################### 30 | 31 | ;================= 32 | ; Local prototypes 33 | ;================= 34 | WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD 35 | WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD 36 | TopXY PROTO :DWORD,:DWORD 37 | Paint_Proc PROTO :DWORD,:DWORD 38 | PackFile PROTO :DWORD 39 | UnpackFile PROTO 40 | cbProc PROTO C :DWORD,:DWORD,:DWORD,:DWORD 41 | 42 | wsprintfA PROTO C :DWORD,:VARARG 43 | wsprintf equ 44 | 45 | ;============= 46 | ; Local macros 47 | ;============= 48 | 49 | szText MACRO Name, Text:VARARG 50 | LOCAL lbl 51 | jmp lbl 52 | Name db Text,0 53 | lbl: 54 | ENDM 55 | 56 | m2m MACRO M1, M2 57 | push M2 58 | pop M1 59 | ENDM 60 | 61 | return MACRO arg 62 | mov eax, arg 63 | ret 64 | ENDM 65 | 66 | stralloc MACRO ln 67 | invoke SysAllocStringByteLen,0,ln 68 | ENDM 69 | 70 | strfree MACRO strhandle 71 | invoke SysFreeString,strhandle 72 | ENDM 73 | 74 | .data 75 | CommandLine dd 0 76 | hWnd dd 0 77 | hInstance dd 0 78 | hIcon dd 0 79 | hEdit1 dd 0 80 | hButn1 dd 0 81 | hButn2 dd 0 82 | hStat1 dd 0 83 | Packing dd 0 84 | ContPack dd 1 85 | killFlag dd 0 86 | szDisplayName db "aPLib Pack",0 87 | plSelect db "Please Select File First",0 88 | 89 | ; ########################### Inserted modules ############################ 90 | 91 | include toolbar.asm 92 | include filedlgs.asm 93 | include ctrls.asm 94 | 95 | ; ######################################################################### 96 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/ctrls.asm: -------------------------------------------------------------------------------- 1 | ; ######################################################################## 2 | 3 | PushButton PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD 4 | EditSl PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD 5 | Static PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD 6 | 7 | .data 8 | btnClass db "BUTTON",0 9 | EditClass db "EDIT",0 10 | statClass db "STATIC",0 11 | 12 | .code 13 | 14 | ; ######################################################################## 15 | 16 | PushButton proc lpText:DWORD,hParent:DWORD, 17 | a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD 18 | 19 | ; invoke PushButton,ADDR szText,hWnd,20,20,100,25,500 20 | 21 | invoke CreateWindowEx,0, 22 | ADDR btnClass,lpText, 23 | WS_CHILD or WS_VISIBLE, 24 | a,b,wd,ht,hParent,ID, 25 | hInstance,NULL 26 | 27 | ret 28 | 29 | PushButton endp 30 | 31 | ; ######################################################################### 32 | 33 | EditSl proc szMsg:DWORD,a:DWORD,b:DWORD, 34 | wd:DWORD,ht:DWORD,hParent:DWORD,ID:DWORD 35 | 36 | ; invoke EditSl,ADDR adrTxt,200,10,150,25,hWnd,700 37 | 38 | 39 | invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClass,szMsg, 40 | WS_VISIBLE or WS_CHILDWINDOW or \ 41 | ES_AUTOHSCROLL or ES_NOHIDESEL, 42 | a,b,wd,ht,hParent,ID,hInstance,NULL 43 | 44 | ret 45 | 46 | EditSl endp 47 | 48 | ; ######################################################################## 49 | 50 | Static proc lpText:DWORD,hParent:DWORD, 51 | a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD 52 | 53 | ; invoke Static,ADDR szText,hWnd,20,20,100,25,500 54 | 55 | invoke CreateWindowEx,WS_EX_STATICEDGE, 56 | ADDR statClass,lpText, 57 | WS_CHILD or WS_VISIBLE or SS_CENTER, 58 | a,b,wd,ht,hParent,ID, 59 | hInstance,NULL 60 | 61 | ret 62 | 63 | Static endp 64 | 65 | ; ######################################################################## 66 | 67 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/file0750.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/contrib/masm32/file0750.bmp -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/filedlgs.asm: -------------------------------------------------------------------------------- 1 | ; ######################################################################## 2 | 3 | GetFileName PROTO :DWORD, :DWORD, :DWORD 4 | SaveFileName PROTO :DWORD, :DWORD, :DWORD 5 | FillBuffer PROTO :DWORD, :DWORD, :BYTE 6 | 7 | .data 8 | szFileName db 260 dup(0) 9 | ofn OPENFILENAME <> ; structure 10 | 11 | .code 12 | 13 | ; ######################################################################## 14 | 15 | GetFileName proc hParent:DWORD,lpTitle:DWORD,lpFilter:DWORD 16 | 17 | mov ofn.lStructSize, sizeof OPENFILENAME 18 | m2m ofn.hWndOwner, hParent 19 | m2m ofn.hInstance, hInstance 20 | m2m ofn.lpstrFilter, lpFilter 21 | m2m ofn.lpstrFile, offset szFileName 22 | mov ofn.nMaxFile, sizeof szFileName 23 | m2m ofn.lpstrTitle, lpTitle 24 | mov ofn.Flags, OFN_EXPLORER or OFN_FILEMUSTEXIST or \ 25 | OFN_LONGNAMES 26 | 27 | invoke GetOpenFileName,ADDR ofn 28 | 29 | ret 30 | 31 | GetFileName endp 32 | 33 | ; ######################################################################### 34 | 35 | SaveFileName proc hParent:DWORD,lpTitle:DWORD,lpFilter:DWORD 36 | 37 | mov ofn.lStructSize, sizeof OPENFILENAME 38 | m2m ofn.hWndOwner, hParent 39 | m2m ofn.hInstance, hInstance 40 | m2m ofn.lpstrFilter, lpFilter 41 | m2m ofn.lpstrFile, offset szFileName 42 | mov ofn.nMaxFile, sizeof szFileName 43 | m2m ofn.lpstrTitle, lpTitle 44 | mov ofn.Flags, OFN_EXPLORER or OFN_LONGNAMES or OFN_OVERWRITEPROMPT 45 | 46 | invoke GetSaveFileName,ADDR ofn 47 | 48 | ret 49 | 50 | SaveFileName endp 51 | 52 | ; ######################################################################## 53 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/makeit.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if not exist rsrc.rc goto over1 4 | \MASM32\BIN\Rc.exe /v rsrc.rc 5 | \MASM32\BIN\Cvtres.exe /machine:ix86 rsrc.res 6 | :over1 7 | 8 | if exist %1.obj del aPPack.obj 9 | if exist %1.exe del aPPack.exe 10 | 11 | \MASM32\BIN\Ml.exe /c /coff aPPack.asm 12 | if errorlevel 1 goto errasm 13 | 14 | if not exist rsrc.obj goto nores 15 | 16 | \MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS aPPack.obj rsrc.obj 17 | if errorlevel 1 goto errlink 18 | 19 | dir aPPack.* 20 | goto TheEnd 21 | 22 | :nores 23 | \MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS aPPack.obj 24 | if errorlevel 1 goto errlink 25 | dir aPPack.* 26 | goto TheEnd 27 | 28 | :errlink 29 | echo _ 30 | echo Link error 31 | goto TheEnd 32 | 33 | :errasm 34 | echo _ 35 | echo Assembly Error 36 | goto TheEnd 37 | 38 | :TheEnd 39 | 40 | pause 41 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/rsrc.rc: -------------------------------------------------------------------------------- 1 | #include "\masm32\include\resource.h" 2 | 3 | 500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "ap.ico" 4 | 5 | 750 BITMAP MOVEABLE PURE LOADONCALL DISCARDABLE "file0750.bmp" 6 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/masm32/tbmacros.asm: -------------------------------------------------------------------------------- 1 | ; --------------------------- 2 | ; macros for creating toolbar 3 | ; --------------------------- 4 | 5 | TBextraData MACRO 6 | mov tbb.fsState, TBSTATE_ENABLED 7 | mov tbb.dwData, 0 8 | mov tbb.iString, 0 9 | ENDM 10 | 11 | ; ------------------------------ 12 | 13 | TBbutton MACRO bID, cID 14 | mov tbb.iBitmap, bID ;; button ID number 15 | mov tbb.idCommand, cID ;; command ID number 16 | mov tbb.fsStyle, TBSTYLE_BUTTON 17 | invoke SendMessage,hToolBar,TB_ADDBUTTONS,1,ADDR tbb 18 | ENDM 19 | 20 | ; ------------------------------ 21 | 22 | TBblank MACRO 23 | mov tbb.iBitmap, 0 24 | mov tbb.idCommand, 0 25 | mov tbb.fsStyle, TBSTYLE_SEP 26 | invoke SendMessage,hToolBar,TB_ADDBUTTONS,1,ADDR tbb 27 | ENDM 28 | 29 | ; ------------------------------ 30 | 31 | Create_Tool_Bar MACRO Wd, Ht 32 | 33 | szText tbClass,"ToolbarWindow32" 34 | 35 | invoke CreateWindowEx,0, 36 | ADDR tbClass, 37 | ADDR szDisplayName, 38 | WS_CHILD or WS_VISIBLE or CCS_NODIVIDER or TBSTYLE_FLAT, 39 | 0,0,500,40, 40 | hWin,NULL, 41 | hInstance,NULL 42 | 43 | ;; or TBSTYLE_FLAT 44 | 45 | mov hToolBar, eax 46 | 47 | invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0 48 | 49 | ;; --------------------------------------- 50 | ;; Put width & height of bitmap into DWORD 51 | ;; --------------------------------------- 52 | mov ecx,Wd ;; loword = bitmap Width 53 | mov eax,Ht ;; hiword = bitmap Height 54 | shl eax,16 55 | mov ax, cx 56 | 57 | mov bSize, eax 58 | 59 | invoke SendMessage,hToolBar,TB_SETBITMAPSIZE,0,bSize 60 | 61 | invoke SetBmpColor,hTbBmp 62 | mov hTbBmp,eax 63 | 64 | mov tbab.hInst, 0 65 | m2m tbab.nID, hTbBmp 66 | invoke SendMessage,hToolBar,TB_ADDBITMAP,12,ADDR tbab 67 | 68 | invoke SendMessage,hToolBar,TB_SETBUTTONSIZE,0,bSize 69 | ENDM 70 | 71 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/tmt/appack.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * TMT Pascal packing example 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> VPascal by Veit Kannegieser, 23.09.1998 12 | * -> TMT Pascal by Oleg Prokhorov 13 | *) 14 | 15 | uses aplibu; 16 | 17 | var 18 | infile,outfile :file; 19 | inbuffer,outbuffer :pointer; 20 | workmem :pointer; 21 | insize,outsize :longint; 22 | 23 | begin 24 | (* check number of parameters *) 25 | if paramcount<1 then 26 | begin 27 | writeln; 28 | writeln('Syntax: APPACK [output file]'); 29 | writeln; 30 | halt(1); 31 | end; 32 | 33 | (* open input file and read data *) 34 | assign(infile,paramstr(1)); 35 | reset(infile,1); 36 | insize:=filesize(infile); 37 | getmem(inbuffer,insize); 38 | blockread(infile,inbuffer^,insize); 39 | close(infile); 40 | 41 | (* get output mem and workmem *) 42 | getmem(outbuffer,aP_max_packed_size(insize)); 43 | getmem(workmem,aP_workmem_size(insize)); 44 | 45 | (* pack data *) 46 | outsize:=aPsafe_pack(inbuffer^,outbuffer^,insize,workmem^,@cb1,nil); 47 | writeln; 48 | 49 | if outsize=aPLib_Error then 50 | begin 51 | WriteLn; 52 | WriteLn('ERR: an error occured while compressing'); 53 | WriteLn; 54 | Halt(1); 55 | end; 56 | 57 | (* write packed data *) 58 | if paramcount<2 then 59 | begin 60 | assign(outfile,'out.apk'); 61 | writeln; 62 | writeln('No output file specified, writing to ''out.apk'''); 63 | end else assign(outfile,paramstr(2)); 64 | rewrite(outfile,1); 65 | blockwrite(outfile,outbuffer^,outsize); 66 | close(outfile); 67 | 68 | (* free mem *) 69 | freemem(inbuffer,insize); 70 | freemem(outbuffer,aP_max_packed_size(insize)); 71 | freemem(workmem,aP_workmem_size(insize)); 72 | 73 | end. 74 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/tmt/apunpack.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * TMT Pascal depacking example 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> VPascal by Veit Kannegieser, 23.09.1998 12 | * -> TMT Pascal by Oleg Prokhorov 13 | *) 14 | 15 | uses aplibu; 16 | 17 | var 18 | infile,outfile :file; 19 | inbuffer,outbuffer :pointer; 20 | insize,outsize :longint; 21 | outmemsize :longint; 22 | 23 | begin 24 | (* check number of parameters *) 25 | if paramcount<1 then 26 | begin 27 | writeln; 28 | writeln('Syntax: APUNPACK [output file]'); 29 | writeln; 30 | halt(1); 31 | end; 32 | 33 | (* open input file and read header *) 34 | assign(infile,paramstr(1)); 35 | reset(infile,1); 36 | insize:=filesize(infile); 37 | 38 | (* get mem and read input file *) 39 | getmem(inbuffer,insize); 40 | blockread(infile,inbuffer^,insize); 41 | close(infile); 42 | 43 | (* check header and get original size *) 44 | outmemsize := aPsafe_get_orig_size(inbuffer^); 45 | if outmemsize=aPLib_Error then 46 | begin 47 | writeln('File is not packed with aPPack.'); 48 | halt(0); 49 | end; 50 | 51 | (* get mem for unpacked data *) 52 | getmem(outbuffer,outmemsize); 53 | 54 | (* unpack data *) 55 | outsize:=aPsafe_depack(inbuffer^,insize,outbuffer^,outmemsize); 56 | 57 | if outsize=aPLib_Error then 58 | begin 59 | WriteLn; 60 | WriteLn('ERR: compressed data error'); 61 | WriteLn; 62 | Halt(1); 63 | end; 64 | 65 | if outsize<>outmemsize then halt(1); 66 | 67 | (* write unpacked data *) 68 | if paramcount<2 then 69 | begin 70 | assign(outfile,'out.dat'); 71 | writeln; 72 | writeln('No output file specified, writing to ''out.dat'''); 73 | end else assign(outfile,paramstr(2)); 74 | rewrite(outfile,1); 75 | blockwrite(outfile,outbuffer^,outsize); 76 | close(outfile); 77 | 78 | (* free memory *) 79 | freemem(inbuffer,insize); 80 | freemem(outbuffer,outmemsize); 81 | 82 | end. 83 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/tmt/makeit.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib TMT Pascal example --- 3 | ECHO. 4 | 5 | tmtpc -C aplibu.pas 6 | tmtpc -$LOGO- appack.pas 7 | tmtpc -$LOGO- apunpack.pas 8 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/vpascal/aplib.def: -------------------------------------------------------------------------------- 1 | LIBRARY 'aplib.dll' 2 | 3 | STUB NONE 4 | 5 | DESCRIPTION '@#Jibz,V.K.:1.01#@ aPLib Compression/Decompression Library' 6 | 7 | EXPORTS 8 | _aP_pack @1 9 | _aP_workmem_size @2 10 | _aP_max_packed_size @3 11 | _aP_depack_asm @4 12 | _aP_depack_asm_fast @5 13 | _aP_depack_asm_safe @6 14 | _aP_crc32 @7 15 | _aPsafe_pack @8 16 | _aPsafe_check @9 17 | _aPsafe_get_orig_size @10 18 | _aPsafe_depack @11 19 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/vpascal/appack.pas: -------------------------------------------------------------------------------- 1 | {$M 32000} 2 | {$I+} 3 | program test__aplib_pack; 4 | 5 | (* 6 | * aPLib compression library - the smaller the better :) 7 | * 8 | * VPascal packing example 9 | * 10 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 11 | * All Rights Reserved 12 | * 13 | * http://www.ibsensoftware.com/ 14 | * 15 | * -> VPascal by Veit Kannegieser, 23.09.1998 16 | *) 17 | 18 | 19 | {$IfDef DYNAMIC_VERSION} 20 | uses aplibud; 21 | {$Else} 22 | uses aplibu; 23 | {$EndIf} 24 | 25 | var 26 | infile ,outfile :file; 27 | inbuffer ,outbuffer :pointer; 28 | workmem :pointer; 29 | insize ,outsize :longint; 30 | 31 | begin 32 | (* check number of parameters *) 33 | if ParamCount<1 then 34 | begin 35 | WriteLn; 36 | WriteLn('Syntax: APPACK [output file]'); 37 | WriteLn; 38 | Halt(1); 39 | end; 40 | 41 | (* open input file and read data *) 42 | Assign(infile,ParamStr(1)); 43 | FileMode:=$40; (* open_access_ReadOnly OR open_share_DenyNone *) 44 | Reset(infile,1); 45 | insize:=FileSize(infile); 46 | GetMem(inbuffer,insize); 47 | BlockRead(infile,inbuffer^,insize); 48 | Close(infile); 49 | 50 | (* get output mem and workmem *) 51 | GetMem(outbuffer,_aP_max_packed_size(insize)); 52 | GetMem(workmem,_aP_workmem_size(insize)); 53 | 54 | (* pack data *) 55 | outsize:=_aPsafe_pack(inbuffer^,outbuffer^,insize,workmem^,cb1,nil); 56 | Writeln; 57 | 58 | if outsize=aPLib_Error then 59 | begin 60 | WriteLn; 61 | WriteLn('ERR: an error occured while compressing'); 62 | WriteLn; 63 | Halt(1); 64 | end; 65 | 66 | (* write packed data *) 67 | if ParamCount<2 then 68 | begin 69 | Assign(outfile,'out.apk'); 70 | WriteLn; 71 | WriteLn('No output file specified, writing to ''out.apk'''); 72 | end 73 | else 74 | Assign(outfile,ParamStr(2)); 75 | FileModeReadWrite:=$42; (* open_access_ReadWrite OR open_share_DenyNone *) 76 | Rewrite(outfile,1); 77 | BlockWrite(outfile,outbuffer^,outsize); 78 | Close(outfile); 79 | 80 | (* free mem *) 81 | Dispose(inbuffer); 82 | Dispose(outbuffer); 83 | Dispose(workmem); 84 | 85 | end. 86 | 87 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/vpascal/apunpack.pas: -------------------------------------------------------------------------------- 1 | program test__aplib_depack; 2 | 3 | (* 4 | * aPLib compression library - the smaller the better :) 5 | * 6 | * VPascal depacking example 7 | * 8 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 9 | * All Rights Reserved 10 | * 11 | * http://www.ibsensoftware.com/ 12 | * 13 | * -> VPascal by Veit Kannegieser, 23.09.1998 14 | *) 15 | 16 | {$IfDef DYNAMIC_VERSION} 17 | uses aplibud; 18 | {$Else} 19 | uses aplibu; 20 | {$EndIf} 21 | 22 | var 23 | infile ,outfile :file; 24 | inbuffer ,outbuffer :pointer; 25 | insize ,outsize :longint; 26 | outmemsize :longint; 27 | 28 | begin 29 | (* check number of parameters *) 30 | if ParamCount<1 then 31 | begin 32 | WriteLn; 33 | WriteLn('Syntax: APUNPACK [output file]'); 34 | WriteLn; 35 | Halt(1); 36 | end; 37 | 38 | (* open input file and read header *) 39 | Assign(infile,ParamStr(1)); 40 | FileMode:=$40; (* open_access_ReadOnly OR open_share_DenyNone *) 41 | Reset(infile,1); 42 | insize:=FileSize(infile); 43 | 44 | (* get mem and read input file *) 45 | GetMem(inbuffer,insize); 46 | BlockRead(infile,inbuffer^,insize); 47 | Close(infile); 48 | 49 | (* get original size from header and get mem *) 50 | outmemsize := _aPsafe_get_orig_size(inbuffer^); 51 | GetMem(outbuffer,outmemsize); 52 | 53 | (* unpack data *) 54 | outsize:=_aPsafe_depack(inbuffer^,insize,outbuffer^,outmemsize); 55 | 56 | if outsize=aPLib_Error then 57 | begin 58 | WriteLn; 59 | WriteLn('ERR: compressed data error'); 60 | WriteLn; 61 | Halt(1); 62 | end; 63 | 64 | if outsize<>outmemsize then Halt(1); 65 | 66 | (* write unpacked data *) 67 | if ParamCount<2 then 68 | begin 69 | Assign(outfile,'out.dat'); 70 | WriteLn; 71 | WriteLn('No output file specified, writing to ''out.dat'''); 72 | end 73 | else 74 | Assign(outfile,ParamStr(2)); 75 | FileModeReadWrite:=$42; (* open_access_ReadWrite OR open_share_DenyNone *) 76 | Rewrite(outfile,1); 77 | BlockWrite(outfile,outbuffer^,outsize); 78 | Close(outfile); 79 | 80 | (* free mem *) 81 | Dispose(inbuffer); 82 | Dispose(outbuffer); 83 | 84 | end. 85 | 86 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/vpascal/descript.ion: -------------------------------------------------------------------------------- 1 | aplib.def Interface Definition for APLIB.DLL (OS/2) 2 | aplibu.pas Interface Unit to ..\..\lib\omf\aplib.lib 3 | aplibud.pas Dynamic Version of aplibu 4 | appack.pas demo program for the Compressor 5 | apunpack.pas demo program for the Decompressor 6 | make_exe.cmd make demo executables (adapt path) 7 | test_exe.cmd test make_exe result 8 | vpc.cfg VPC.CFG compiler parameter (adapt path) 9 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/vpascal/test_exe.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | if [%1] == [L1] goto L1 3 | 4 | cls 5 | set testfile=aPPack.exe 6 | call %0 L1 dynamic os2 7 | call %0 L1 dynamic w32 8 | call %0 L1 static d32 9 | call %0 L1 static os2 10 | call %0 L1 static w32 11 | goto END 12 | 13 | :L1 14 | echo ** %2 ** %3 ** 15 | cd %2\%3 16 | if exist out.apk del out.apk 17 | if exist test.ap del test.ap 18 | if exist test.unp del test.unp 19 | if [%3] == [d32] Dos4GW.exe aPPack.exe %testfile% test.ap 20 | if [%3] == [os2] aPPack.exe %testfile% test.ap 21 | if [%3] == [w32] call pec aPPack.exe %testfile% test.ap 22 | if not exist test.ap pause 23 | if [%3] == [d32] Dos4GW.exe aPUnpack.exe test.ap test.unp 24 | if [%3] == [os2] aPUnpack.exe test.ap test.unp 25 | if [%3] == [w32] call pec aPUnpack.exe test.ap test.unp 26 | if not exist test.unp pause 27 | if exist test.ap del test.ap 28 | if exist test.unp del test.unp 29 | cd ..\.. 30 | 31 | :END 32 | -------------------------------------------------------------------------------- /tools/files/applib/contrib/vpascal/vpc.cfg: -------------------------------------------------------------------------------- 1 | /iY:\VP21\source\rtl 2 | /lY:\VP21\lib.%p;Y:\VP21\units.%p 3 | /oY:\VP21\out.%p\units 4 | /rY:\VP21\res.%p 5 | /uY:\VP21\units.%p;Y:\VP21\source\rtl;Y:\VP21\source\%p 6 | /B 7 | /P0 8 | /$D- 9 | /$Delphi- 10 | /$Optimize+ 11 | /$L- 12 | /$V- 13 | /$LocInfo- 14 | /$G+ 15 | /$G3+ 16 | /$I+ 17 | /$Q- 18 | /$R- 19 | /$S- 20 | /$SmartLink+ 21 | /$Speed- 22 | /$Use32+ 23 | /$V+ 24 | /$W- 25 | /$X+ 26 | -------------------------------------------------------------------------------- /tools/files/applib/doc/aPLib-1.1.0.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/doc/aPLib-1.1.0.chm -------------------------------------------------------------------------------- /tools/files/applib/doc/html/acknowledgements.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | aPLib - Acknowledgements 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 68 | 69 |
16 | 17 |
18 | << prev | 19 | home | 20 | next >> 21 |
22 | 23 |
Acknowledgements
24 | 25 |

Greetings and thanks to:

26 | 27 |
    28 |
  • d'b for our continuous discussions of compression techniques :)
  • 29 |
  • TAD for all the great ideas and the good discussions
  • 30 |
  • The people who made the Epsilon Compression Page
  • 31 |
  • Pasi 'Albert' Ojala for his info on PuCrunch
  • 32 |
  • RIT Research Labs for making Dos Navigator .. it's the BEST!
  • 33 |
  • LiuTaoTao for making TR .. one of the best debuggers around!
  • 34 |
  • Eugene Suslikov (SEN) for making HIEW .. it ROCKS!
  • 35 |
  • Oleg for his work on the TMT Pascal code
  • 36 |
  • Veit Kannegieser for his work on the VPascal code
  • 37 |
  • METALBRAIN for his work on the 16bit depackers
  • 38 |
  • Gautier for his work on the Ada code
  • 39 |
  • Alexey Solodovnikov for his work on the Delphi code
  • 40 |
  • Steve Hutchesson for his work on the MASM32 code
  • 41 |
  • Agner Fog for objconv and his great info on calling conventions
  • 42 |
  • All other people who make good software freely available for 43 | non-commercial use!
  • 44 |
45 | 46 |

A special thanks to the beta-testers:

47 | 48 |
    49 |
  • x-otic (thx mate ;)
  • 50 |
  • Oleg Prokhorov (great optimisations and bug reports!)
  • 51 |
  • Lawrence E. Boothby
  • 52 |
  • METALBRAIN (believe in miracles, my friend ;)
  • 53 |
  • eL PuSHeR
  • 54 |
  • Elli
  • 55 |
  • Veit Kannegieser
  • 56 |
  • Gautier
  • 57 |
58 | 59 |  
60 | 61 |
62 | << prev | 63 | home | 64 | next >> 65 |
66 | 67 |
70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /tools/files/applib/doc/html/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | aPLib Compression Library 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 65 | 66 |
19 | 20 |
21 | << prev | 22 | home | 23 | next >> 24 |
25 | 26 | 27 | 28 |
Welcome to the aPLib documentation!
29 | 30 |

aPLib is a compression library based on the algorithm used 31 | in aPACK (my 16-bit executable packer). aPLib is an easy-to-use alternative 32 | to many of the heavy-weight compression libraries available.

33 | 34 |

The compression ratios achieved by aPLib combined with the speed and 35 | tiny footprint of the decompressors (as low as 169 bytes!) makes it the ideal 36 | choice for many products.

37 | 38 |

The following topics are available:

39 | 40 | 48 | 49 |  
50 | 51 |
52 | Valid XHTML 1.0!  53 | Made with Cascading Style Sheets!  54 | Valid CSS! 55 |
56 | 57 |  
58 | 59 |
60 | Copyright © 1998-2014 Jørgen Ibsen. All Rights Reserved. 61 | Products and company names mentioned may be the trademarks of their respective owners. 62 |
63 | 64 |
67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /tools/files/applib/doc/html/license.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | aPLib - License 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 90 | 91 |
16 | 17 |
18 | << prev | 19 | home | 20 | next >> 21 |
22 | 23 |
License
24 | 25 |

aPLib is free to use even for commercial use. If you use 26 | aPLib in a product, an acknowledgement would be appreciated, e.g. by adding 27 | something like the following to the documentation:

28 | 29 |
30 |     This product uses the aPLib compression library,
31 |     Copyright © 1998-2014 Jørgen Ibsen, All Rights Reserved.
32 |     For more information, please visit: http://www.ibsensoftware.com/
33 | 
34 | 35 |

You may not distribute aPLib without all of the files.

36 | 37 |

You may not edit or reverse engineer any of the files (except the header 38 | files and the decompression code, which you may edit as long as you do not 39 | remove the copyright notice).

40 | 41 |

You may not sell aPLib, or any part of it, for money (except for 42 | charging for the media).

43 | 44 | #ifndef COMMON_SENSE 45 | 46 |
47 | 48 | 62 |
49 |

This software is provided "as is". In no event shall I, the author, 50 | be liable for any kind of loss or damage arising out of the use, 51 | abuse or the inability to use this software. USE IT ENTIRELY AT 52 | YOUR OWN RISK!

53 | 54 |

This software comes without any kind of warranty, either expressed 55 | or implied, including, but not limited to the implied warranties of 56 | merchantability or fitness for any particular purpose.

57 | 58 |

If you do not agree with these terms or if your jurisdiction does 59 | not allow the exclusion of warranty and liability as stated above 60 | you are NOT allowed to use this software at all.

61 |
63 |
64 | 65 | #else 66 | 67 |
68 | 69 | 74 |
70 |

Bla bla bla .. the usual stuff - you know it anyway:

71 | 72 |

If anything goes even remotely wrong - blame _yourself_, NOT me!

73 |
75 |
76 | 77 | #endif 78 | 79 |  
80 | 81 |  
82 | 83 |
84 | << prev | 85 | home | 86 | next >> 87 |
88 | 89 |
92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /tools/files/applib/doc/html/mwcos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/doc/html/mwcos.png -------------------------------------------------------------------------------- /tools/files/applib/doc/html/vcss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/doc/html/vcss.png -------------------------------------------------------------------------------- /tools/files/applib/doc/html/xhtml10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/doc/html/xhtml10.png -------------------------------------------------------------------------------- /tools/files/applib/example/appack.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/example/appack.exe -------------------------------------------------------------------------------- /tools/files/applib/example/make_bcc.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Borland C/C++ example --- 3 | ECHO. 4 | 5 | bcc32 -I..\lib\omf appack.c ..\lib\omf\aplib.lib -eappack.exe 6 | -------------------------------------------------------------------------------- /tools/files/applib/example/make_dll.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Visual C/C++ DLL example --- 3 | ECHO. 4 | 5 | cl /nologo /O2 /I..\lib\dll /DAP_DLL appack.c ..\lib\dll\aplib.lib 6 | 7 | ECHO. 8 | ECHO Remember to copy APLIB.DLL here before running. 9 | -------------------------------------------------------------------------------- /tools/files/applib/example/make_pc.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Pelles C example --- 3 | ECHO. 4 | 5 | cc /Ot /I..\lib\coff appack.c ..\lib\coff\aplib.lib 6 | -------------------------------------------------------------------------------- /tools/files/applib/example/make_vc.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Visual C/C++ example --- 3 | ECHO. 4 | 5 | cl /nologo /O2 /I..\lib\coff appack.c ..\lib\coff\aplib.lib 6 | -------------------------------------------------------------------------------- /tools/files/applib/example/make_wat.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Watcom C/C++ example --- 3 | ECHO. 4 | 5 | wcl386 /oneax /oe /oh /5r /zc -zld /i=..\lib\omf appack.c /"library ..\lib\omf\aplib" 6 | -------------------------------------------------------------------------------- /tools/files/applib/example/makefile.cyg: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## Cygwin GCC makefile 5 | ## 6 | ## Copyright (c) 1998-2014 Joergen Ibsen 7 | ## All Rights Reserved 8 | ## 9 | 10 | target = appack.exe 11 | objects = appack.o 12 | 13 | cflags = -Wall -O2 -s -mno-cygwin 14 | ldflags = $(cflags) 15 | incdir = ../lib/coff 16 | libs = $(incdir)/aplib.lib 17 | 18 | .PHONY: all clean 19 | 20 | all: $(target) 21 | 22 | $(target): $(objects) 23 | gcc $(ldflags) -o $@ $^ $(libs) 24 | 25 | %.o : %.c 26 | gcc -c -I$(incdir) $(cflags) -o $@ $< 27 | 28 | clean: 29 | $(RM) $(objects) $(target) 30 | -------------------------------------------------------------------------------- /tools/files/applib/example/makefile.elf: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## GCC makefile (Linux, FreeBSD, BeOS and QNX) 5 | ## 6 | ## Copyright (c) 1998-2014 Joergen Ibsen 7 | ## All Rights Reserved 8 | ## 9 | 10 | target = appack 11 | objects = appack.o 12 | 13 | cflags = -Wall -O2 -s 14 | ldflags = $(cflags) 15 | 16 | LBITS := $(shell getconf LONG_BIT) 17 | ifeq ($(LBITS), 64) 18 | incdir = ../lib/elf64 19 | else 20 | incdir = ../lib/elf 21 | endif 22 | 23 | libs = $(incdir)/aplib.a 24 | 25 | .PHONY: all clean 26 | 27 | all: $(target) 28 | 29 | $(target): $(objects) 30 | gcc $(ldflags) -o $@ $^ $(libs) 31 | 32 | %.o : %.c 33 | gcc -c -I$(incdir) $(cflags) -o $@ $< 34 | 35 | clean: 36 | $(RM) $(objects) $(target) 37 | -------------------------------------------------------------------------------- /tools/files/applib/example/makefile.mgw: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## MinGW GCC makefile 5 | ## 6 | ## Copyright (c) 1998-2014 Joergen Ibsen 7 | ## All Rights Reserved 8 | ## 9 | 10 | target = appack.exe 11 | objects = appack.o 12 | 13 | cflags = -Wall -O2 -s 14 | ldflags = $(cflags) 15 | incdir = ../lib/coff 16 | libs = $(incdir)/aplib.lib 17 | 18 | .PHONY: all clean 19 | 20 | all: $(target) 21 | 22 | $(target): $(objects) 23 | gcc $(ldflags) -o $@ $^ $(libs) 24 | 25 | %.o : %.c 26 | gcc -c -I$(incdir) $(cflags) -o $@ $< 27 | 28 | clean: 29 | $(RM) $(objects) $(target) 30 | -------------------------------------------------------------------------------- /tools/files/applib/lib/coff/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * COFF format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int __cdecl aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int __cdecl aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int __cdecl aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int __cdecl aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int __cdecl aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int __cdecl aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int __cdecl aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int __cdecl aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int __cdecl aPsafe_check(const void *source); 53 | 54 | unsigned int __cdecl aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int __cdecl aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /tools/files/applib/lib/coff/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/coff/aplib.lib -------------------------------------------------------------------------------- /tools/files/applib/lib/coff64/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * COFF 64-bit format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /tools/files/applib/lib/coff64/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/coff64/aplib.lib -------------------------------------------------------------------------------- /tools/files/applib/lib/dll/aplib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/dll/aplib.dll -------------------------------------------------------------------------------- /tools/files/applib/lib/dll/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * DLL header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | __declspec(dllimport) unsigned int __stdcall aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (__stdcall *callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | __declspec(dllimport) unsigned int __stdcall aP_workmem_size(unsigned int inputsize); 31 | 32 | __declspec(dllimport) unsigned int __stdcall aP_max_packed_size(unsigned int inputsize); 33 | 34 | __declspec(dllimport) unsigned int __stdcall aP_depack_asm(const void *source, void *destination); 35 | 36 | __declspec(dllimport) unsigned int __stdcall aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | __declspec(dllimport) unsigned int __stdcall aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | __declspec(dllimport) unsigned int __stdcall aP_crc32(const void *source, unsigned int length); 44 | 45 | __declspec(dllimport) unsigned int __stdcall aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (__stdcall *callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | __declspec(dllimport) unsigned int __stdcall aPsafe_check(const void *source); 53 | 54 | __declspec(dllimport) unsigned int __stdcall aPsafe_get_orig_size(const void *source); 55 | 56 | __declspec(dllimport) unsigned int __stdcall aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /tools/files/applib/lib/dll/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/dll/aplib.lib -------------------------------------------------------------------------------- /tools/files/applib/lib/dll64/aplib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/dll64/aplib.dll -------------------------------------------------------------------------------- /tools/files/applib/lib/dll64/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * DLL 64-bit header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | __declspec(dllimport) unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | __declspec(dllimport) unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | __declspec(dllimport) unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | __declspec(dllimport) unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | __declspec(dllimport) unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | __declspec(dllimport) unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | __declspec(dllimport) unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | __declspec(dllimport) unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | __declspec(dllimport) unsigned int aPsafe_check(const void *source); 53 | 54 | __declspec(dllimport) unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | __declspec(dllimport) unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /tools/files/applib/lib/dll64/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/dll64/aplib.lib -------------------------------------------------------------------------------- /tools/files/applib/lib/elf/aplib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/elf/aplib.a -------------------------------------------------------------------------------- /tools/files/applib/lib/elf/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * ELF format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /tools/files/applib/lib/elf64/aplib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/elf64/aplib.a -------------------------------------------------------------------------------- /tools/files/applib/lib/elf64/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * ELF 64-bit format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /tools/files/applib/lib/omf/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * OMF format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int __cdecl aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int __cdecl aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int __cdecl aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int __cdecl aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int __cdecl aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int __cdecl aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int __cdecl aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int __cdecl aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int __cdecl aPsafe_check(const void *source); 53 | 54 | unsigned int __cdecl aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int __cdecl aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /tools/files/applib/lib/omf/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/applib/lib/omf/aplib.lib -------------------------------------------------------------------------------- /tools/files/applib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | ______ ______ ____ ______ ____ 4 | _\__ /_ _\ /_ _\ /___ _\____/ _\ /___ 5 | / // / // / // /___ / / 6 | / / // / // / // / // / / 7 | /_ / //_ ___//_ / //_ / //_ / / 8 | /______\ /___\ /______\ /______\ /______\ 9 | -= t h e s m a l l e r t h e b e t t e r =- 10 | 11 | Copyright (c) 1998-2014 Joergen Ibsen, All Rights Reserved 12 | 13 | http://www.ibsensoftware.com/ 14 | 15 | 16 | 17 | About 18 | ----- 19 | 20 | aPLib is a compression library based on the algorithm used in aPACK (my 21 | 16-bit executable packer). aPLib is an easy-to-use alternative to many of the 22 | heavy-weight compression libraries available. 23 | 24 | The compression ratios achieved by aPLib combined with the speed and tiny 25 | footprint of the depackers (as low as 169 bytes!) makes it the ideal choice 26 | for many products. 27 | 28 | Please read the documentation file 'doc/aPLib-1.1.0.chm' or 29 | 'doc/html/index.html'. 30 | 31 | 32 | 33 | License 34 | ------- 35 | 36 | aPLib is freeware. If you use aPLib in a product, an acknowledgement would be 37 | appreciated, e.g. by adding something like the following to the documentation: 38 | 39 | This product uses the aPLib compression library, 40 | Copyright (c) 1998-2014 Joergen Ibsen, All Rights Reserved. 41 | For more information, please visit: http://www.ibsensoftware.com/ 42 | 43 | You may not distribute aPLib without all of the files. 44 | 45 | You may not edit or reverse engineer any of the files (except the header files 46 | and the decompression code, which you may edit as long as you do not remove 47 | the copyright notice). 48 | 49 | You may not sell aPLib, or any part of it, for money (except for charging for 50 | the media). 51 | 52 | #ifndef COMMON_SENSE 53 | 54 | This software is provided "as is". In no event shall I, the author, be 55 | liable for any kind of loss or damage arising out of the use, abuse or 56 | the inability to use this software. USE IT ENTIRELY AT YOUR OWN RISK! 57 | 58 | This software comes without any kind of warranty, either expressed or 59 | implied, including, but not limited to the implied warranties of 60 | merchantability or fitness for any particular purpose. 61 | 62 | If you do not agree with these terms or if your jurisdiction does not 63 | allow the exclusion of warranty and liability as stated above you are 64 | NOT allowed to use this software at all. 65 | 66 | #else 67 | 68 | Bla bla bla .. the usual stuff - you know it anyway: 69 | 70 | If anything goes even remotely wrong - blame _yourself_, NOT me! 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /tools/files/applib/src/32bit/depack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm assembler depacker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aP_depack_asm as '_aP_depack_asm' 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aP_depack_asm: 21 | ; aP_depack_asm(const void *source, void *destination) 22 | 23 | _ret$ equ 7*4 24 | _src$ equ 8*4 + 4 25 | _dst$ equ 8*4 + 8 26 | 27 | pushad 28 | 29 | mov esi, [esp + _src$] ; C calling convention 30 | mov edi, [esp + _dst$] 31 | 32 | cld 33 | mov dl, 80h 34 | xor ebx,ebx 35 | 36 | literal: 37 | movsb 38 | mov bl, 2 39 | nexttag: 40 | call getbit 41 | jnc literal 42 | 43 | xor ecx, ecx 44 | call getbit 45 | jnc codepair 46 | xor eax, eax 47 | call getbit 48 | jnc shortmatch 49 | mov bl, 2 50 | inc ecx 51 | mov al, 10h 52 | .getmorebits: 53 | call getbit 54 | adc al, al 55 | jnc .getmorebits 56 | jnz domatch 57 | stosb 58 | jmp nexttag 59 | codepair: 60 | call getgamma_no_ecx 61 | sub ecx, ebx 62 | jnz normalcodepair 63 | call getgamma 64 | jmp domatch_lastpos 65 | 66 | shortmatch: 67 | lodsb 68 | shr eax, 1 69 | jz donedepacking 70 | adc ecx, ecx 71 | jmp domatch_with_2inc 72 | 73 | normalcodepair: 74 | xchg eax, ecx 75 | dec eax 76 | shl eax, 8 77 | lodsb 78 | call getgamma 79 | 80 | cmp eax, 32000 81 | jae domatch_with_2inc 82 | cmp ah, 5 83 | jae domatch_with_inc 84 | cmp eax, 7fh 85 | ja domatch_new_lastpos 86 | 87 | domatch_with_2inc: 88 | inc ecx 89 | 90 | domatch_with_inc: 91 | inc ecx 92 | 93 | domatch_new_lastpos: 94 | xchg eax, ebp 95 | domatch_lastpos: 96 | mov eax, ebp 97 | 98 | mov bl, 1 99 | 100 | domatch: 101 | push esi 102 | mov esi, edi 103 | sub esi, eax 104 | rep movsb 105 | pop esi 106 | jmp nexttag 107 | 108 | getbit: 109 | add dl, dl 110 | jnz .stillbitsleft 111 | mov dl, [esi] 112 | inc esi 113 | adc dl, dl 114 | .stillbitsleft: 115 | ret 116 | 117 | getgamma: 118 | xor ecx, ecx 119 | getgamma_no_ecx: 120 | inc ecx 121 | .getgammaloop: 122 | call getbit 123 | adc ecx, ecx 124 | call getbit 125 | jc .getgammaloop 126 | ret 127 | 128 | donedepacking: 129 | sub edi, [esp + _dst$] 130 | mov [esp + _ret$], edi ; return unpacked length in eax 131 | 132 | popad 133 | 134 | ret 135 | 136 | ; ============================================================= 137 | -------------------------------------------------------------------------------- /tools/files/applib/src/32bit/scheck.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm safe assembler crc checker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aPsafe_check as '_aPsafe_check' 15 | 16 | extrn '_aP_crc32' as aP_crc32 17 | 18 | ; ============================================================= 19 | 20 | section '.text' code readable executable 21 | 22 | aPsafe_check: 23 | ; aPsafe_check(const void *source) 24 | 25 | .ret$ equ 7*4 26 | .src$ equ 8*4 + 4 27 | 28 | pushad 29 | 30 | mov esi, [esp + .src$] ; esi -> buffer 31 | 32 | test esi, esi 33 | jz .return_error 34 | 35 | mov ebx, [esi] ; ebx = header.tag 36 | 37 | cmp ebx, 032335041h ; check tag == 'AP32' 38 | jne .return_error 39 | 40 | mov ebx, [esi + 4] ; ebx = header.header_size 41 | cmp ebx, 24 ; check header_size >= 24 42 | jb .return_error 43 | 44 | add ebx, esi ; ebx -> packed data 45 | 46 | push dword [esi + 8] ; push header.packed_size 47 | push ebx 48 | call aP_crc32 49 | add esp, 8 50 | 51 | cmp eax, [esi + 12] ; check eax == header.packed_crc 52 | 53 | mov eax, [esi + 16] ; eax = header.orig_size 54 | 55 | je .return_eax 56 | 57 | .return_error: 58 | or eax, -1 ; eax = -1 59 | 60 | .return_eax: 61 | mov [esp + .ret$], eax ; return unpacked length in eax 62 | 63 | popad 64 | 65 | ret 66 | 67 | ; ============================================================= 68 | -------------------------------------------------------------------------------- /tools/files/applib/src/32bit/sgetsize.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm safe assembler header access 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aPsafe_get_orig_size as '_aPsafe_get_orig_size' 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aPsafe_get_orig_size: 21 | ; aPsafe_get_orig_size(const void *source) 22 | 23 | .ret$ equ 7*4 24 | .src$ equ 8*4 + 4 25 | 26 | pushad 27 | 28 | mov esi, [esp + .src$] ; esi -> buffer 29 | 30 | mov ebx, [esi] ; ebx = header.tag 31 | 32 | or eax, -1 ; eax = -1 33 | 34 | cmp ebx, 032335041h ; check tag == 'AP32' 35 | jne .return_eax 36 | 37 | mov ebx, [esi + 4] ; ebx = header.header_size 38 | cmp ebx, 24 ; check header_size >= 24 39 | jb .return_eax 40 | 41 | mov eax, [esi + 16] ; eax = header.orig_size 42 | 43 | .return_eax: 44 | mov [esp + .ret$], eax ; return unpacked length in eax 45 | 46 | popad 47 | 48 | ret 49 | 50 | ; ============================================================= 51 | -------------------------------------------------------------------------------- /tools/files/applib/src/64bit/depack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit assembler depacker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS64 COFF 13 | 14 | public aP_depack_asm 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aP_depack_asm: 21 | ; aP_depack_asm(const void *source, void *destination) 22 | 23 | push rbx 24 | push rsi 25 | push rdi 26 | 27 | push rdx 28 | 29 | mov rsi, rcx 30 | mov rdi, rdx 31 | 32 | cld 33 | mov dl, 80h 34 | xor ebx, ebx 35 | 36 | literal: 37 | movsb 38 | mov bl, 2 39 | nexttag: 40 | call getbit 41 | jnc literal 42 | 43 | xor ecx, ecx 44 | call getbit 45 | jnc codepair 46 | xor eax, eax 47 | call getbit 48 | jnc shortmatch 49 | mov bl, 2 50 | inc ecx 51 | mov al, 10h 52 | .getmorebits: 53 | call getbit 54 | adc al, al 55 | jnc .getmorebits 56 | jnz domatch 57 | stosb 58 | jmp nexttag 59 | codepair: 60 | call getgamma_no_ecx 61 | sub ecx, ebx 62 | jnz normalcodepair 63 | call getgamma 64 | jmp domatch_lastpos 65 | 66 | shortmatch: 67 | lodsb 68 | shr eax, 1 69 | jz donedepacking 70 | adc ecx, ecx 71 | jmp domatch_with_2inc 72 | 73 | normalcodepair: 74 | xchg eax, ecx 75 | dec eax 76 | shl eax, 8 77 | lodsb 78 | call getgamma 79 | 80 | cmp eax, 32000 81 | jae short domatch_with_2inc 82 | cmp ah, 5 83 | jae short domatch_with_inc 84 | cmp eax, 7fh 85 | ja short domatch_new_lastpos 86 | 87 | domatch_with_2inc: 88 | inc ecx 89 | 90 | domatch_with_inc: 91 | inc ecx 92 | 93 | domatch_new_lastpos: 94 | xchg eax, r8d 95 | domatch_lastpos: 96 | mov eax, r8d 97 | 98 | mov bl, 1 99 | 100 | domatch: 101 | push rsi 102 | mov rsi, rdi 103 | sub rsi, rax 104 | rep movsb 105 | pop rsi 106 | jmp nexttag 107 | 108 | getbit: 109 | add dl, dl 110 | jnz .stillbitsleft 111 | mov dl, [rsi] 112 | inc rsi 113 | adc dl, dl 114 | .stillbitsleft: 115 | ret 116 | 117 | getgamma: 118 | xor ecx, ecx 119 | getgamma_no_ecx: 120 | inc ecx 121 | .getgammaloop: 122 | call getbit 123 | adc ecx, ecx 124 | call getbit 125 | jc .getgammaloop 126 | ret 127 | 128 | donedepacking: 129 | pop rdx 130 | sub rdi, rdx 131 | xchg eax, edi 132 | 133 | pop rdi 134 | pop rsi 135 | pop rbx 136 | 137 | ret 138 | 139 | ; ============================================================= 140 | -------------------------------------------------------------------------------- /tools/files/applib/src/64bit/scheck.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit safe assembler crc checker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS64 COFF 13 | 14 | public aPsafe_check 15 | 16 | extrn aP_crc32 17 | 18 | ; ============================================================= 19 | 20 | section '.text' code readable executable 21 | 22 | aPsafe_check: 23 | ; aPsafe_check(const void *source) 24 | 25 | push rdi 26 | sub rsp, 32 27 | 28 | mov rdi, rcx ; rdi -> source 29 | 30 | test rcx, rcx 31 | jz .return_error 32 | 33 | mov eax, [rdi] ; eax = header.tag 34 | 35 | cmp eax, 032335041h ; check tag == 'AP32' 36 | jne .return_error 37 | 38 | mov eax, [rdi + 4] ; rax = header.header_size 39 | cmp eax, 24 ; check header_size >= 24 40 | jb .return_error 41 | 42 | add rcx, rax ; rcx -> packed data 43 | mov edx, [rdi + 8] ; rdx = header.packed_size 44 | 45 | call aP_crc32 46 | 47 | cmp eax, [rdi + 12] ; check eax == header.packed_crc 48 | 49 | mov eax, [rdi + 16] ; rax = header.orig_size 50 | 51 | je .return_rax 52 | 53 | .return_error: 54 | or rax, -1 ; rax = -1 55 | 56 | .return_rax: 57 | add rsp, 32 58 | pop rdi 59 | 60 | ret 61 | 62 | ; ============================================================= 63 | -------------------------------------------------------------------------------- /tools/files/applib/src/64bit/sgetsize.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit safe assembler header access 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS64 COFF 13 | 14 | public aPsafe_get_orig_size 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aPsafe_get_orig_size: 21 | ; aPsafe_get_orig_size(const void *source) 22 | 23 | mov edx, [rcx] ; edx = header.tag 24 | 25 | or rax, -1 ; rax = -1 26 | 27 | cmp edx, 032335041h ; check tag == 'AP32' 28 | jne .return_rax 29 | 30 | mov edx, [rcx + 4] ; edx = header.header_size 31 | cmp edx, 24 ; check header_size >= 24 32 | jb .return_rax 33 | 34 | mov eax, [rcx + 16] ; rax = header.orig_size 35 | 36 | .return_rax: 37 | ret 38 | 39 | ; ============================================================= 40 | -------------------------------------------------------------------------------- /tools/files/applib/src/64bit/spack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit safe assembler wrapper for aP_pack 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | ; header format: 13 | ; 14 | ; offs size data 15 | ; -------------------------------------- 16 | ; 0 dword tag ('AP32') 17 | ; 4 dword header_size (24 bytes) 18 | ; 8 dword packed_size 19 | ; 12 dword packed_crc 20 | ; 16 dword orig_size 21 | ; 20 dword orig_crc 22 | 23 | format MS64 COFF 24 | 25 | public aPsafe_pack 26 | 27 | extrn aP_pack 28 | extrn aP_crc32 29 | 30 | ; ============================================================= 31 | 32 | section '.text' code readable executable 33 | 34 | aPsafe_pack: 35 | ; aPsafe_pack(const void *source, 36 | ; void *destination, 37 | ; unsigned int length, 38 | ; void *workmem, 39 | ; int (*callback)(unsigned int, unsigned int, void *), 40 | ; void *cbparam) 41 | 42 | mov [rsp + 8], rcx 43 | mov [rsp + 16], rdx 44 | mov [rsp + 24], r8 45 | mov [rsp + 32], r9 46 | push rdi 47 | sub rsp, 48 48 | 49 | mov rdi, rdx ; rdi -> destination 50 | 51 | or rax, -1 ; rax = -1 52 | 53 | test rcx, rcx ; check parameters 54 | jz .return_rax ; 55 | test rdx, rdx ; 56 | jz .return_rax ; 57 | test r8, r8 ; 58 | jz .return_rax ; 59 | 60 | mov edx, 032335041h 61 | mov [rdi], edx ; set header.tag 62 | 63 | mov edx, 24 64 | mov [rdi + 4], edx ; set header.header_size 65 | 66 | mov rdx, r8 67 | mov [rdi + 16], edx ; set header.orig_size 68 | 69 | call aP_crc32 70 | 71 | mov [rdi + 20], eax ; set header.orig_crc 72 | 73 | mov r10, [rsp + 96] ; r10 -> callback 74 | mov r11, [rsp + 104] ; r11 = cbparam 75 | 76 | mov rcx, [rsp + 64] 77 | mov rdx, [rsp + 72] 78 | mov r8, [rsp + 80] 79 | mov r9, [rsp + 88] 80 | mov [rsp + 32], r10 81 | mov [rsp + 40], r11 82 | add rdx, 24 ; rdx -> after header 83 | 84 | call aP_pack 85 | 86 | cmp eax, -1 87 | je .return_rax 88 | 89 | mov [rdi + 8], eax ; set header.packed_size 90 | 91 | mov rcx, [rsp + 72] ; rcx -> destination 92 | mov rdx, rax ; rdx = packed size 93 | add rcx, 24 ; rcx -> after header 94 | 95 | call aP_crc32 96 | 97 | mov [rdi + 12], eax ; set header.packed_crc 98 | 99 | mov eax, [rdi + 8] ; eax = header.packed_size 100 | add rax, 24 ; rax = final size 101 | 102 | .return_rax: 103 | add rsp, 48 104 | pop rdi 105 | 106 | ret 107 | 108 | ; ============================================================= 109 | -------------------------------------------------------------------------------- /tools/files/applib/src/depack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * C depacker, header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef DEPACK_H_INCLUDED 13 | #define DEPACK_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | /* function prototype */ 24 | unsigned int aP_depack(const void *source, void *destination); 25 | 26 | #ifdef __cplusplus 27 | } /* extern "C" */ 28 | #endif 29 | 30 | #endif /* DEPACK_H_INCLUDED */ 31 | -------------------------------------------------------------------------------- /tools/files/applib/src/depacks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * C safe depacker, header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef DEPACKS_H_INCLUDED 13 | #define DEPACKS_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | /* function prototype */ 24 | unsigned int aP_depack_safe(const void *source, 25 | unsigned int srclen, 26 | void *destination, 27 | unsigned int dstlen); 28 | 29 | #ifdef __cplusplus 30 | } /* extern "C" */ 31 | #endif 32 | 33 | #endif /* DEPACKS_H_INCLUDED */ 34 | -------------------------------------------------------------------------------- /tools/files/bin2c-1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/bin2c-1.0.zip -------------------------------------------------------------------------------- /tools/files/makefiles-ldscripts-2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/makefiles-ldscripts-2.zip -------------------------------------------------------------------------------- /tools/files/sixpack-13.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/sixpack-13.zip -------------------------------------------------------------------------------- /tools/files/sjasm39g6.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/sjasm39g6.zip -------------------------------------------------------------------------------- /tools/files/zasm-3.0.21-source-linux-2011-06-19.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubilus1/gendev/728f0f1b0a0237dfa411505713396b3eabcf90a8/tools/files/zasm-3.0.21-source-linux-2011-06-19.zip --------------------------------------------------------------------------------