mirror of https://github.com/zxdos/zxuno.git
Merge pull request #28 from ivan-tat/master
various SDK improvements, added `fcut`, `fpad`, `fpoke` tools
This commit is contained in:
commit
0d014f33ab
|
|
@ -1 +0,0 @@
|
|||
https://sourceforge.net/p/emuscriptoria/code/HEAD/tree/desprot/fcut.c
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
@call ..\sdk\setvars.bat
|
||||
set output=\Google Drive\Proyecto ZX-Uno\cores_%2\
|
||||
echo define version %1 > version.asm
|
||||
call make.bat
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,6 +1,8 @@
|
|||
@rem SPDX-FileCopyrightText: 2019 Antonio Villena <_@antoniovillena.es>
|
||||
@rem
|
||||
@rem SPDX-FileContributor: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: GPL-3.0-only
|
||||
copy /Y FLASHempty.ZX1 FLASH.ZX1
|
||||
call addroms.bat
|
||||
call addcores.bat
|
||||
|
|
|
|||
52
sdk/Makefile
52
sdk/Makefile
|
|
@ -3,22 +3,58 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Supported environments:
|
||||
# * GNU/Linux
|
||||
# * Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
# * GNU on Linux, FreeBSD etc.
|
||||
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
#
|
||||
# Build:
|
||||
# make [BUILD=<BUILD>] [FORCEBUILD=<FB_FLAG>] [<TARGET>]
|
||||
# Clean:
|
||||
# make [BUILD=<BUILD>] [FORCECLEAN=<FC_FLAG>] clean
|
||||
#
|
||||
# where:
|
||||
# <BUILD> is one of: mingw32, mingw64.
|
||||
# <FB_FLAG> is 1 to force build, otherwise do not (default).
|
||||
# <FC_FLAG> is 1 to force clean, otherwise do not (default).
|
||||
# <TARGET> is one of values of TOOLS variable (see below).
|
||||
#
|
||||
# Notes:
|
||||
# BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment.
|
||||
|
||||
include common.mk
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
SJASMPLUS := sjasmplus.exe
|
||||
ZX7B := zx7b.exe
|
||||
ifeq ($(BUILD),mingw32)
|
||||
FORCEBUILD:=1
|
||||
else ifeq ($(BUILD),mingw64)
|
||||
FORCEBUILD:=1
|
||||
else
|
||||
SJASMPLUS := sjasmplus
|
||||
ZX7B := zx7b
|
||||
BUILD:=
|
||||
FORCEBUILD:=0
|
||||
endif
|
||||
|
||||
ifdef $(FORCECLEAN)
|
||||
ifneq ($(FORCECLEAN),1)
|
||||
FORCECLEAN:=0
|
||||
else
|
||||
FORCECLEAN:=0
|
||||
endif
|
||||
endif
|
||||
|
||||
export BUILD
|
||||
export FORCEBUILD
|
||||
export FORCECLEAN
|
||||
|
||||
SJASMPLUS := sjasmplus$(EXECEXT)
|
||||
ZX7B := zx7b$(EXECEXT)
|
||||
FCUT := fcut$(EXECEXT)
|
||||
FPAD := fpad$(EXECEXT)
|
||||
FPOKE := fpoke$(EXECEXT)
|
||||
|
||||
TOOLS:=\
|
||||
bin/$(SJASMPLUS) \
|
||||
bin/$(ZX7B)
|
||||
bin/$(ZX7B) \
|
||||
bin/$(FCUT) \
|
||||
bin/$(FPAD) \
|
||||
bin/$(FPOKE)
|
||||
|
||||
.PHONY: all
|
||||
all: $(TOOLS)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,28 @@ Command | Target
|
|||
`make` | all tools
|
||||
`make bin/sjasmplus` | **sjasmplus**
|
||||
`make bin/zx7b` | **zx7b**
|
||||
`make bin/fcut` | **fcut**
|
||||
`make bin/fpad` | **fpad**
|
||||
`make bin/fpoke` | **fpoke**
|
||||
|
||||
To build using MinGW add this parameter for **make** tool:
|
||||
|
||||
Parameter | Target system
|
||||
----|----
|
||||
`BUILD=mingw32` | Windows with i686 architecture (32-bits)
|
||||
`BUILD=mingw64` | Windows with AMD64 architecture (64-bits)
|
||||
|
||||
Remember to specify proper file extension (".exe") for target when building with MinGW. Example:
|
||||
|
||||
```bash
|
||||
make BUILD=mingw64 bin/fcut.exe bin/fpad.exe bin/fpoke.exe
|
||||
```
|
||||
|
||||
Then you may use **strip** tool to strip debug information from file and thus shrink file's size:
|
||||
|
||||
```bash
|
||||
strip bin/fcut.exe bin/fpad.exe bin/fpoke.exe
|
||||
```
|
||||
|
||||
## 2.2. Clean tools
|
||||
|
||||
|
|
@ -38,6 +60,12 @@ To clean everything type:
|
|||
make clean
|
||||
```
|
||||
|
||||
To clean MinGW builds use appropriate `BUILD` parameter as described in [2.1](#21-build-tools). Example:
|
||||
|
||||
```bash
|
||||
make BUILD=mingw64 clean
|
||||
```
|
||||
|
||||
## 2.3. Tools usage
|
||||
|
||||
These tools are supposed to be used mainly in Makefiles and Bash scripts invoked from Makefiles.
|
||||
|
|
@ -77,30 +105,38 @@ This has the same behavior as the inclusion of `common.mk` file in a Makefile.
|
|||
|
||||
# 3. Using SDK in GNU environment on Windows
|
||||
|
||||
**NOTE**: compilation of the following tools:
|
||||
**NOTE**: *by default* compilation of the following tools:
|
||||
|
||||
* sjasmplus
|
||||
* zx7b
|
||||
* fcut
|
||||
* fpad
|
||||
* fpoke
|
||||
|
||||
on Windows platform is disabled right now because of presence of precompiled binaries of them in repository. They are not deleted when cleaning.
|
||||
on Windows platform is disabled right now because of presence of precompiled binaries of them in repository.
|
||||
*By default* they are not deleted when cleaning.
|
||||
|
||||
## 3.1. Build tools
|
||||
|
||||
The building process is similar to one for GNU on Linux, FreeBSD etc. See [2.1](#21-build-tools).
|
||||
The building process is similar to one for GNU on Linux, FreeBSD etc.
|
||||
See [2.1](#21-build-tools) with addition that you should provide correct target name (specify file extension ".exe") and also specify parameter `FORCEBUILD=1`.
|
||||
|
||||
## 3.2. Clean tools
|
||||
|
||||
The cleaning process is similar to one for GNU on Linux, FreeBSD etc. See [2.2](#22-clean-tools).
|
||||
The cleaning process is similar to one for GNU on Linux, FreeBSD etc.
|
||||
See [2.2](#22-clean-tools) with addition that you should specify parameter `FORCECLEAN=1`.
|
||||
|
||||
## 3.3. Tools usage
|
||||
|
||||
### 3.3.1. In Makefiles
|
||||
|
||||
The usage is similar to one for GNU/Linux, FreeBSD etc. See [2.3.1](#231-in-makefiles).
|
||||
The usage is similar to one for GNU on Linux, FreeBSD etc.
|
||||
See [2.3.1](#231-in-makefiles).
|
||||
|
||||
### 3.3.2. In Bash scripts
|
||||
|
||||
The usage is similar to one for GNU/Linux, FreeBSD etc. See [2.3.2](#232-in-bash-scripts).
|
||||
The usage is similar to one for GNU on Linux, FreeBSD etc.
|
||||
See [2.3.2](#232-in-bash-scripts).
|
||||
|
||||
# 4. Using SDK on Windows without GNU environment
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,9 @@
|
|||
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
sjasmplus
|
||||
zx7b
|
||||
fcut
|
||||
fpad
|
||||
fpoke
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,11 @@
|
|||
SPDX-FileName: fcut.exe
|
||||
|
||||
SPDX-FileType: BINARY
|
||||
|
||||
SPDX-FileChecksum: SHA1: 57dc4b8241477fe9bfdf03b249575b38876da7f2
|
||||
|
||||
SPDX-FileCopyrightText: Copyright (C) 2015, 2021 Antonio Villena
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
SPDX-FileComment: fcut version 1.00 (20 Jun 2015) - a file hexadecimal cutter.
|
||||
Binary file not shown.
|
|
@ -0,0 +1,11 @@
|
|||
SPDX-FileName: fpad.exe
|
||||
|
||||
SPDX-FileType: BINARY
|
||||
|
||||
SPDX-FileChecksum: SHA1: 1aa7d48a742da3ffaff2c29bcb8acceb7eb8042c
|
||||
|
||||
SPDX-FileCopyrightText: Copyright (C) 2016, 2021 Antonio Villena
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
SPDX-FileComment: fpad version 1.00 (24 Apr 2016) - generate a file with padded values.
|
||||
Binary file not shown.
|
|
@ -0,0 +1,11 @@
|
|||
SPDX-FileName: fpoke.exe
|
||||
|
||||
SPDX-FileType: BINARY
|
||||
|
||||
SPDX-FileChecksum: SHA1: 59c8b1ea5221e31d7c23573591bdb4bb61878d9a
|
||||
|
||||
SPDX-FileCopyrightText: Copyright (C) 2016, 2021 Antonio Villena
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
SPDX-FileComment: fpoke version 1.0 (11 May 2016) - tool that overwrites bytes in a file.
|
||||
BIN
sdk/bin/zx7b.exe
BIN
sdk/bin/zx7b.exe
Binary file not shown.
|
|
@ -2,12 +2,15 @@ SPDX-FileName: zx7b.exe
|
|||
|
||||
SPDX-FileType: BINARY
|
||||
|
||||
SPDX-FileChecksum: SHA1: de47984d9d155eb89153052297caac5ffef5e720
|
||||
SPDX-FileChecksum: SHA1: 0068364b1463d8f27c29a8a183ea348af12cf456
|
||||
|
||||
SPDX-LicenseConcluded: BSD-3-Clause
|
||||
SPDX-FileCopyrightText: Copyright (c) 2013, 2021 Antonio Villena. All rights reserved.
|
||||
|
||||
SPDX-LicenseComments: The concluded license is taken from https://github.com/antoniovillena/zx7b/raw/master/zx7b.c
|
||||
SPDX-FileNotice: Based on ZX7 <http://www.worldofspectrum.org/infoseekid.cgi?id=0027996>
|
||||
SPDX-FileNotice: ZX7 is Copyright (c) 2012 Einar Saukas. All rights reserved.
|
||||
|
||||
SPDX-FileCopyrightText: Einar Saukas/AntonioVillena, 28 Dec 2013
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
SPDX-FileComment: ZX7 Backwards compressor v1.01 by Einar Saukas/AntonioVillena, 28 Dec 2013
|
||||
SPDX-LicenseComments: License's text equals to one from https://directory.fsf.org/wiki/License:BSD-3-Clause
|
||||
|
||||
SPDX-FileComment: zx7b version 1.01 (28 Dec 2013) - backwards compressor.
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Supported environments:
|
||||
# * GNU/Linux
|
||||
# * Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
# * GNU on Linux, FreeBSD etc.
|
||||
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
|
||||
ifndef ZXUNOSDK
|
||||
|
||||
|
|
@ -17,3 +17,17 @@ export ZXUNOSDK
|
|||
export PATH
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
EXECEXT := .exe
|
||||
else
|
||||
EXECEXT :=
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD),mingw32)
|
||||
CC := i686-w64-mingw32-gcc
|
||||
EXECEXT := .exe
|
||||
else ifeq ($(BUILD),mingw64)
|
||||
CC := x86_64-w64-mingw32-gcc
|
||||
EXECEXT := .exe
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
sjasmplus
|
||||
|
|
|
|||
|
|
@ -3,25 +3,62 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Supported environments:
|
||||
# * GNU/Linux
|
||||
# * Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
# * GNU on Linux, FreeBSD etc.
|
||||
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
#
|
||||
# Build:
|
||||
# make [BUILD=<BUILD>] [FORCEBUILD=<FB_FLAG>] [<TARGET>]
|
||||
# Clean:
|
||||
# make [BUILD=<BUILD>] [FORCECLEAN=<FC_FLAG>] clean
|
||||
#
|
||||
# where:
|
||||
# <BUILD> is one of: mingw32, mingw64.
|
||||
# <FB_FLAG> is 1 to force build, otherwise do not (default).
|
||||
# <FC_FLAG> is 1 to force clean, otherwise do not (default).
|
||||
# <TARGET> is one of values of TOOLS variable (see below).
|
||||
#
|
||||
# Notes:
|
||||
# BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment.
|
||||
|
||||
include ../common.mk
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
SJASMPLUS := sjasmplus.exe
|
||||
ZX7B := zx7b.exe
|
||||
else
|
||||
SJASMPLUS := sjasmplus
|
||||
ZX7B := zx7b
|
||||
endif
|
||||
SJASMPLUS := sjasmplus$(EXECEXT)
|
||||
ZX7B := zx7b$(EXECEXT)
|
||||
FCUT := fcut$(EXECEXT)
|
||||
FPAD := fpad$(EXECEXT)
|
||||
FPOKE := fpoke$(EXECEXT)
|
||||
|
||||
TOOLS:= \
|
||||
../bin/$(SJASMPLUS) \
|
||||
../bin/$(ZX7B) \
|
||||
../bin/$(FCUT) \
|
||||
../bin/$(FPAD) \
|
||||
../bin/$(FPOKE)
|
||||
|
||||
.PHONY: all
|
||||
all: \
|
||||
../bin/$(SJASMPLUS) \
|
||||
../bin/$(ZX7B)
|
||||
all: $(TOOLS)
|
||||
|
||||
ifneq ($(OS),Windows_NT)
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq ($(FORCEBUILD),1)
|
||||
_DoBuild:=1
|
||||
else
|
||||
_DoBuild:=0
|
||||
endif
|
||||
else
|
||||
_DoBuild:=1
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq ($(FORCECLEAN),1)
|
||||
_DoClean:=1
|
||||
else
|
||||
_DoClean:=0
|
||||
endif
|
||||
else
|
||||
_DoClean:=1
|
||||
endif
|
||||
|
||||
ifeq ($(_DoBuild),1)
|
||||
../bin/$(SJASMPLUS): sjasmplus/build/$(SJASMPLUS)
|
||||
cp $< $@
|
||||
|
||||
|
|
@ -42,14 +79,29 @@ sjasmplus:
|
|||
|
||||
zx7b/$(ZX7B): | zx7b
|
||||
$(MAKE) -w -C $|
|
||||
|
||||
../bin/$(FCUT): tools/$(FCUT)
|
||||
cp $< $@
|
||||
|
||||
../bin/$(FPAD): tools/$(FPAD)
|
||||
cp $< $@
|
||||
|
||||
../bin/$(FPOKE): tools/$(FPOKE)
|
||||
cp $< $@
|
||||
|
||||
tools/$(FCUT) \
|
||||
tools/$(FPAD) \
|
||||
tools/$(FPOKE): | tools
|
||||
$(MAKE) -w -C $|
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifneq ($(_DoClean),1)
|
||||
clean:;
|
||||
else
|
||||
clean: | sjasmplus sjasmplus.mk zx7b
|
||||
clean: | sjasmplus sjasmplus.mk zx7b tools
|
||||
$(MAKE) -w -C sjasmplus -f ../sjasmplus.mk clean
|
||||
$(MAKE) -w -C zx7b clean
|
||||
rm -f ../bin/$(SJASMPLUS) ../bin/$(ZX7B)
|
||||
$(MAKE) -w -C tools clean
|
||||
rm -f $(TOOLS)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -3,29 +3,50 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Supported environments:
|
||||
# * GNU/Linux
|
||||
# * Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
# * GNU on Linux, FreeBSD etc.
|
||||
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
#
|
||||
# Build:
|
||||
# make -w -C sjasmplus -f ../sjasmplus.mk
|
||||
# make [BUILD=<BUILD>] -w -C sjasmplus -f ../sjasmplus.mk
|
||||
# Clean:
|
||||
# make -w -C sjasmplus -f ../sjasmplus.mk clean
|
||||
# make [BUILD=<BUILD>] -w -C sjasmplus -f ../sjasmplus.mk clean
|
||||
#
|
||||
# where:
|
||||
# <BUILD> is one of: mingw32, mingw64.
|
||||
#
|
||||
# Notes:
|
||||
# BUILD variable may be set in user's environment.
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
SJASMPLUS := sjasmplus.exe
|
||||
else
|
||||
SJASMPLUS := sjasmplus
|
||||
|
||||
include ../../common.mk
|
||||
|
||||
CMAKEFLAGS :=
|
||||
|
||||
ifeq ($(BUILD),mingw32)
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_NAME=Windows
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_PROCESSOR=x86
|
||||
CMAKEFLAGS += CMAKE_C_COMPILER=i686-w64-mingw32-gcc
|
||||
CMAKEFLAGS += CMAKE_CXX_COMPILER=i686-w64-mingw32-g++
|
||||
CMAKEFLAGS := $(patsubst %,-D%,$(CMAKEFLAGS))
|
||||
else ifeq ($(BUILD),mingw64)
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_NAME=Windows
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_PROCESSOR=AMD64
|
||||
CMAKEFLAGS += CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc
|
||||
CMAKEFLAGS += CMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++
|
||||
CMAKEFLAGS := $(patsubst %,-D%,$(CMAKEFLAGS))
|
||||
endif
|
||||
|
||||
SJASMPLUS := sjasmplus$(EXECEXT)
|
||||
|
||||
build/$(SJASMPLUS): | build/Makefile
|
||||
$(MAKE) -w -C build
|
||||
|
||||
build/Makefile: | build
|
||||
cd build && cmake ..
|
||||
cd build && cmake $(CMAKEFLAGS) ..
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
mkdir $@
|
||||
|
||||
.PHONY: clean
|
||||
clean: | build/Makefile
|
||||
$(MAKE) -w -C build clean
|
||||
clean:
|
||||
rm -rf build
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
fcut
|
||||
fcut.exe
|
||||
fpad
|
||||
fpad.exe
|
||||
fpoke
|
||||
fpoke.exe
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Supported environments:
|
||||
# * GNU on Linux, FreeBSD etc.
|
||||
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
#
|
||||
# Build:
|
||||
# make [BUILD=<BUILD>] [<TARGET>]
|
||||
# Clean:
|
||||
# make [BUILD=<BUILD>] clean
|
||||
#
|
||||
# where:
|
||||
# <BUILD> is one of: mingw32, mingw64.
|
||||
# <TARGET> is one of values for TOOLS variable (see below).
|
||||
#
|
||||
# Notes:
|
||||
# BUILD variable may be set in user's environment.
|
||||
|
||||
include ../../common.mk
|
||||
|
||||
FCUT := fcut$(EXECEXT)
|
||||
FPAD := fpad$(EXECEXT)
|
||||
FPOKE := fpoke$(EXECEXT)
|
||||
|
||||
TOOLS:=\
|
||||
$(FCUT) \
|
||||
$(FPAD) \
|
||||
$(FPOKE)
|
||||
|
||||
.PHONY: all
|
||||
all: $(TOOLS)
|
||||
|
||||
$(FCUT): fcut.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(FPAD): fpad.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(FPOKE): fpoke.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(TOOLS)
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* fcut - a file hexadecimal cutter.
|
||||
*
|
||||
* Copyright (C) 2015, 2021 Antonio Villena
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (C) 2015, 2021 Antonio Villena
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define PROGRAM "fcut"
|
||||
#define DESCRIPTION "a file hexadecimal cutter."
|
||||
#define VERSION "1.00 (20 Jun 2015)"
|
||||
#define COPYRIGHT "Copyright (C) 2015, 2021 Antonio Villena"
|
||||
#define LICENSE \
|
||||
"This program is free software: you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation, version 3."
|
||||
#define HOMEPAGE "https://github.com/zxdos/zxuno/"
|
||||
|
||||
void show_help() {
|
||||
printf(
|
||||
PROGRAM " version " VERSION " - " DESCRIPTION "\n"
|
||||
COPYRIGHT "\n"
|
||||
LICENSE "\n"
|
||||
"Home page: " HOMEPAGE "\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
" " PROGRAM " <input_file> <start> <length> <output_file>\n"
|
||||
"\n"
|
||||
" <input_file> Origin file to cut\n"
|
||||
" <start> In hexadecimal, is the start offset of the segment\n"
|
||||
" <length> In hexadecimal, is the length of the segment\n"
|
||||
" <output_file> Genetated output file\n"
|
||||
"\n"
|
||||
"<start> negative value assumes a negative offset from the end of the file.\n"
|
||||
"<length> negative value will substract file size result to that parameter.\n"
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]){
|
||||
unsigned char *mem= (unsigned char *) malloc (0x10000);
|
||||
FILE *fi, *fo;
|
||||
long start, length, size;
|
||||
if( argc==1 )
|
||||
show_help(),
|
||||
exit(0);
|
||||
if( argc!=5 )
|
||||
printf("\nInvalid number of parameters\n"),
|
||||
exit(-1);
|
||||
fi= fopen(argv[1], "rb");
|
||||
if( !fi )
|
||||
printf("\nInput file not found: %s\n", argv[1]),
|
||||
exit(-1);
|
||||
fo= fopen(argv[4], "wb+");
|
||||
if( !fo )
|
||||
printf("\nCannot create output file: %s\n", argv[4]),
|
||||
exit(-1);
|
||||
fseek(fi, 0, SEEK_END);
|
||||
size= ftell(fi);
|
||||
rewind(fi);
|
||||
start= strtol(argv[2], NULL, 16);
|
||||
if( start<0 )
|
||||
start+= size;
|
||||
length= strtol(argv[3], NULL, 16);
|
||||
if( length<0 )
|
||||
length+= size;
|
||||
if( start+length>size
|
||||
|| start>size )
|
||||
printf("\nOut of input file\n"),
|
||||
exit(-1);
|
||||
fseek(fi, start, SEEK_SET);
|
||||
for ( size= 0; size<length>>16; size++ )
|
||||
fread(mem, 1, 0x10000, fi),
|
||||
fwrite(mem, 1, 0x10000, fo);
|
||||
fread(mem, 1, length&0xffff, fi);
|
||||
fwrite(mem, 1, length&0xffff, fo);
|
||||
fclose(fi);
|
||||
fclose(fo);
|
||||
printf("\n0x%lx bytes written (%lu) at offset 0x%lx (%lu)\n", length, length, start, start);
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* fpad - generate a file with padded values.
|
||||
*
|
||||
* Copyright (C) 2016, 2021 Antonio Villena
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (C) 2016, 2021 Antonio Villena
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PROGRAM "fpad"
|
||||
#define DESCRIPTION "generate a file with padded values."
|
||||
#define VERSION "1.00 (24 Apr 2016)"
|
||||
#define COPYRIGHT "Copyright (C) 2016, 2021 Antonio Villena"
|
||||
#define LICENSE \
|
||||
"This program is free software: you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation, version 3."
|
||||
#define HOMEPAGE "https://github.com/zxdos/zxuno/"
|
||||
|
||||
void show_help() {
|
||||
printf(
|
||||
PROGRAM " version " VERSION " - " DESCRIPTION "\n"
|
||||
COPYRIGHT "\n"
|
||||
LICENSE "\n"
|
||||
"Home page: " HOMEPAGE "\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
" " PROGRAM " <length> <byte> <output_file>\n"
|
||||
"\n"
|
||||
" <length> In hexadecimal, is the length of the future file\n"
|
||||
" <byte> In hexadecimal, is the value of the padding\n"
|
||||
" <output_file> Genetated output file\n"
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]){
|
||||
unsigned char mem[0x10000];
|
||||
FILE *fo;
|
||||
long length, size;
|
||||
if( argc==1 )
|
||||
show_help(),
|
||||
exit(0);
|
||||
if( argc!=4 )
|
||||
printf("\nInvalid number of parameters\n"),
|
||||
exit(-1);
|
||||
fo= fopen(argv[3], "wb+");
|
||||
if( !fo )
|
||||
printf("\nCannot create output file: %s\n", argv[3]),
|
||||
exit(-1);
|
||||
memset(mem, strtol(argv[2], NULL, 16), 0x10000);
|
||||
length= strtol(argv[1], NULL, 16);
|
||||
for ( size= 0; size<length>>16; size++ )
|
||||
fwrite(mem, 1, 0x10000, fo);
|
||||
fwrite(mem, 1, length&0xffff, fo);
|
||||
fclose(fo);
|
||||
printf("\nDone\n");
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* fpoke - tool that overwrites bytes in a file.
|
||||
*
|
||||
* Copyright (C) 2016, 2021 Antonio Villena
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (C) 2016, 2021 Antonio Villena
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PROGRAM "fpoke"
|
||||
#define DESCRIPTION "tool that overwrites bytes in a file."
|
||||
#define VERSION "1.0 (11 May 2016)"
|
||||
#define COPYRIGHT "Copyright (C) 2016, 2021 Antonio Villena"
|
||||
#define LICENSE \
|
||||
"This program is free software: you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation, version 3."
|
||||
#define HOMEPAGE "https://github.com/zxdos/zxuno/"
|
||||
|
||||
#define BUFFER_LENGTH 0x60000
|
||||
|
||||
void show_help() {
|
||||
printf(
|
||||
PROGRAM " version " VERSION " - " DESCRIPTION "\n"
|
||||
COPYRIGHT "\n"
|
||||
LICENSE "\n"
|
||||
"Home page: " HOMEPAGE "\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
" " PROGRAM " <target_file> <addr> [<repeat>x]<bytes> [<addr> [<repeat>x]<bytes>] ..\n"
|
||||
"\n"
|
||||
" <target_file> Origin and target file to poke\n"
|
||||
" <addr> In hexadecimal, address of the first byte to poke\n"
|
||||
" <repeat> Number of repetitions, also in hex\n"
|
||||
" <bytes> Even digits in hex or single quotation string like 'hello'\n"
|
||||
" file:filename Equivalent to [<repeat>x]<bytes> but with a file\n"
|
||||
"\n"
|
||||
"At least one sequence of <addr><bytes> is mandatory (<repeat> is optional). The\n"
|
||||
"first char of <bytes> can be g or l to indicate biG endian or Little endian,\n"
|
||||
"default is little endian. Example:hello.txt 48 65 6C 6C 6F 20 57 6F 72 6C 64 21\n"
|
||||
" " PROGRAM " hello.txt 2 12 48 65 12 6C 6F 20 57 6F 72 6C 64 21\n"
|
||||
" " PROGRAM " hello.txt 3 1234 48 65 6C 34 12 20 57 6F 72 6C 64 21\n"
|
||||
" " PROGRAM " hello.txt 4 g123456 0 l1234 34 12 6C 6C 12 34 56 6F 72 6C 64 21\n"
|
||||
" " PROGRAM " hello.txt 5 3xab 48 65 6C 6C 6F AB AB AB 72 6C 64 21\n"
|
||||
" " PROGRAM " hello.txt 6 'Earth' 48 65 6C 6C 6F 20 45 61 72 74 68 21\n"
|
||||
" " PROGRAM " hello.txt 6 file:hi.bin\n"
|
||||
);
|
||||
}
|
||||
|
||||
char char2hex(char value){
|
||||
if( value<'0' || value>'f' || value<'A' && value>'9' || value<'a' && value>'F' )
|
||||
printf("\nInvalid character %c\n", value),
|
||||
exit(-1);
|
||||
return value>'9' ? 9+(value&7) : value-'0';
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]){
|
||||
unsigned char *mem= (unsigned char *) malloc (BUFFER_LENGTH);
|
||||
FILE *fi, *fi2;
|
||||
char *bytes;
|
||||
long start, size, rep, length, i, j, k;
|
||||
if( argc==1 )
|
||||
show_help(),
|
||||
exit(0);
|
||||
if( argc&1 )
|
||||
printf("\nInvalid number of parameters\n"),
|
||||
exit(-1);
|
||||
fi= fopen(argv[1], "rb+");
|
||||
if( !fi )
|
||||
printf("\nInput file not found: %s\n", argv[1]),
|
||||
exit(-1);
|
||||
fseek(fi, 0, SEEK_END);
|
||||
size= ftell(fi);
|
||||
while ( argc > 2 ){
|
||||
start= strtol(argv++[2], NULL, 16);
|
||||
if( start<0 )
|
||||
start+= size;
|
||||
if( bytes= strchr(argv[2], ':') )
|
||||
rep= -1,
|
||||
argv++;
|
||||
else if( strchr(argv[2], 'x') || strchr(argv[2], 'X') )
|
||||
rep= strtol(strtok(argv++[2], "xX"), NULL, 16),
|
||||
bytes= strtok(NULL, "xX");
|
||||
else
|
||||
rep= 1,
|
||||
bytes= argv++[2];
|
||||
if( bytes[0]=='g' || bytes[0]=='l' || bytes[0]=='\'' )
|
||||
bytes++;
|
||||
if( bytes[-1]=='\'' )
|
||||
bytes= strtok(bytes, "'"),
|
||||
length= strlen(bytes);
|
||||
else if( rep==-1 ){
|
||||
fi2= fopen(++bytes, "rb+");
|
||||
if( !fi2 )
|
||||
printf("\nInput file not found: %s\n", bytes),
|
||||
exit(-1);
|
||||
fseek(fi2, 0, SEEK_END);
|
||||
length= ftell(fi2);
|
||||
fseek(fi2, 0, SEEK_SET);
|
||||
}
|
||||
else{
|
||||
length= strlen(bytes);
|
||||
if( length&1 )
|
||||
printf("\nIncorrect length %X (%s), must be even, in address %X\n", length, bytes, start),
|
||||
exit(-1);
|
||||
length>>= 1;
|
||||
}
|
||||
if( length*rep+start > size )
|
||||
printf("\nOut of file\n"),
|
||||
exit(-1);
|
||||
if( length>BUFFER_LENGTH )
|
||||
printf("\nOut of buffer\n"),
|
||||
exit(-1);
|
||||
if( rep==-1 )
|
||||
printf("hola %d %d %d\n", argc, length, fread(mem, 1, length, fi2)),
|
||||
fclose(fi2);
|
||||
else if( bytes[-1]=='g' )
|
||||
for ( i= 0; i < length; i++ )
|
||||
mem[i]= char2hex(bytes[i<<1|1]) | char2hex(bytes[i<<1]) << 4;
|
||||
else if( bytes[-1]=='\'' )
|
||||
for ( i= 0; i < length; i++ )
|
||||
mem[i]= bytes[i];
|
||||
else
|
||||
for ( i= 0; i < length; i++ )
|
||||
mem[length-i-1]= char2hex(bytes[i<<1|1]) | char2hex(bytes[i<<1]) << 4;
|
||||
for ( i= 1; i < rep; i++ )
|
||||
if( i*length > BUFFER_LENGTH )
|
||||
break;
|
||||
if( --i > 1 )
|
||||
for ( j= 1; j < i; j++ )
|
||||
for ( k= 0; k < length; k++ )
|
||||
mem[k+j*length]= mem[k];
|
||||
fseek(fi, start, SEEK_SET);
|
||||
if( i ){
|
||||
j= rep/i;
|
||||
for ( k= 0; k < j; k++ )
|
||||
fwrite(mem, 1, length*i, fi);
|
||||
if( rep%i )
|
||||
fwrite(mem, 1, length*(rep%i), fi);
|
||||
}
|
||||
else
|
||||
fwrite(mem, 1, length, fi);
|
||||
argc-= 2;
|
||||
}
|
||||
printf("\nFile correctly modified\n");
|
||||
fclose(fi);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 20219 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
https://sourceforge.net/p/emuscriptoria/code/HEAD/tree/desprot/
|
||||
https://github.com/antoniovillena/EmuScriptoria/tree/master/desprot
|
||||
|
|
@ -1,2 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
zx7b
|
||||
zx7b.exe
|
||||
|
|
|
|||
|
|
@ -5,27 +5,28 @@
|
|||
# Supported environments:
|
||||
# * GNU on Linux, FreeBSD etc.
|
||||
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
|
||||
#
|
||||
# Build:
|
||||
# make [BUILD=<BUILD>] [<TARGET>]
|
||||
# Clean:
|
||||
# make [BUILD=<BUILD>] clean
|
||||
#
|
||||
# where:
|
||||
# <BUILD> is one of: mingw32, mingw64.
|
||||
# <TARGET> is one of values of TOOLS variable (see below).
|
||||
#
|
||||
# Notes:
|
||||
# BUILD variable may be set in user's environment.
|
||||
|
||||
include ../../common.mk
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ZX7B := zx7b.exe
|
||||
else
|
||||
ZX7B := zx7b
|
||||
endif
|
||||
ZX7B := zx7b$(EXECEXT)
|
||||
|
||||
ifneq ($(OS),Windows_NT)
|
||||
$(ZX7B): zx7b.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
zx7b.c:
|
||||
wget -c https://github.com/antoniovillena/zx7b/raw/master/zx7b.c
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
ifeq ($(OS),Windows_NT)
|
||||
clean:;
|
||||
else
|
||||
clean:
|
||||
rm -f $(ZX7B)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
/*
|
||||
* ZX7b (c) Copyright 2013 by Antonio Villena. All rights reserved.
|
||||
* zx7b - backwards compressor.
|
||||
*
|
||||
* Copyright (c) 2013, 2021 Antonio Villena. All rights reserved.
|
||||
*
|
||||
* Based on ZX7 <http://www.worldofspectrum.org/infoseekid.cgi?id=0027996>
|
||||
* (c) Copyright 2012 by Einar Saukas. All rights reserved.
|
||||
* ZX7 is Copyright (c) 2012 Einar Saukas. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
|
@ -25,20 +27,30 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-FileCopyrightText: ZX7b (c) Copyright 2013 by Antonio Villena. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2013, 2021 Antonio Villena. All rights reserved.
|
||||
*
|
||||
* SPDX-FileNotice: Based on ZX7 <http://www.worldofspectrum.org/infoseekid.cgi?id=0027996>
|
||||
* SPDX-FileNotice: (c) Copyright 2012 by Einar Saukas. All rights reserved.
|
||||
* SPDX-FileNotice: ZX7 is Copyright (c) 2012 Einar Saukas. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* SPDX-LicenseComments: License's text is equals to one from https://directory.fsf.org/wiki/License:BSD-3-Clause
|
||||
* SPDX-LicenseComments: License's text equals to one from https://directory.fsf.org/wiki/License:BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PROGRAM "zx7b"
|
||||
#define DESCRIPTION "backwards compressor."
|
||||
#define VERSION "1.01 (28 Dec 2013)"
|
||||
#define COPYRIGHT "Copyright (c) 2013, 2021 Antonio Villena. All rights reserved.\n" \
|
||||
"Based on ZX7 <http://www.worldofspectrum.org/infoseekid.cgi?id=0027996>\n" \
|
||||
"ZX7 is Copyright (c) 2012 Einar Saukas. All rights reserved."
|
||||
#define LICENSE \
|
||||
"Distributed under BSD 3-clause license."
|
||||
#define HOMEPAGE "https://github.com/antoniovillena/zx7b/"
|
||||
|
||||
#define MAX_OFFSET 2176 /* range 1..2176 */
|
||||
#define MAX_LEN 65536 /* range 2..65536 */
|
||||
|
||||
|
|
@ -53,6 +65,23 @@ typedef struct optimal_t {
|
|||
int len;
|
||||
} Optimal;
|
||||
|
||||
void show_help() {
|
||||
printf(
|
||||
PROGRAM " version " VERSION " - " DESCRIPTION "\n"
|
||||
COPYRIGHT "\n"
|
||||
LICENSE "\n"
|
||||
"Home page: " HOMEPAGE "\n"
|
||||
"\n"
|
||||
"Usage:\n"
|
||||
" " PROGRAM " <input_file> <output_file>\n"
|
||||
"\n"
|
||||
" <input_file> Raw input file\n"
|
||||
" <output_file> Compressed output file\n"
|
||||
"\n"
|
||||
"Example: " PROGRAM " Cobra.scr Cobra.zx7b\n"
|
||||
);
|
||||
}
|
||||
|
||||
Optimal *optimize(unsigned char *input_data, size_t input_size);
|
||||
|
||||
unsigned char *compress(Optimal *optimal, unsigned char *input_data, size_t input_size, size_t *output_size);
|
||||
|
|
@ -70,11 +99,7 @@ int main(int argc, char *argv[]) {
|
|||
int i, j;
|
||||
|
||||
if( argc==1 )
|
||||
printf("\nZX7 Backwards compressor v1.01 by Einar Saukas/AntonioVillena, 28 Dec 2013\n\n"
|
||||
" zx7b <input_file> <output_file>\n\n"
|
||||
" <input_file> Raw input file\n"
|
||||
" <output_file> Compressed output file\n\n"
|
||||
"Example: zx7b Cobra.scr Cobra.zx7b\n"),
|
||||
show_help(),
|
||||
exit(0);
|
||||
if( argc!=3 )
|
||||
printf("\nInvalid number of parameters\n"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue