mirror of https://github.com/zxdos/zxuno.git
sdk: added `bin2hex` tool
This commit is contained in:
parent
cb0a8cc8e0
commit
63446da962
|
@ -1,33 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
unsigned char *scr;
|
|
||||||
char nombre[256];
|
|
||||||
int i,leido;
|
|
||||||
|
|
||||||
if (argc<2)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
scr = malloc(65536);
|
|
||||||
f = fopen (argv[1],"rb");
|
|
||||||
if (!f)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
leido = fread (scr, 1, 65536, f);
|
|
||||||
fclose (f);
|
|
||||||
|
|
||||||
strcpy (nombre, argv[1]);
|
|
||||||
nombre[strlen(nombre)-3]=0;
|
|
||||||
strcat (nombre, "hex");
|
|
||||||
|
|
||||||
f = fopen (nombre, "wt");
|
|
||||||
for (i=0;i<leido;i++)
|
|
||||||
fprintf (f, "%.2X\n", scr[i]);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
|
@ -1,33 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
unsigned char *scr;
|
|
||||||
char nombre[256];
|
|
||||||
int i,leido;
|
|
||||||
|
|
||||||
if (argc<2)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
scr = malloc(65536);
|
|
||||||
f = fopen (argv[1],"rb");
|
|
||||||
if (!f)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
leido = fread (scr, 1, 65536, f);
|
|
||||||
fclose (f);
|
|
||||||
|
|
||||||
strcpy (nombre, argv[1]);
|
|
||||||
nombre[strlen(nombre)-3]=0;
|
|
||||||
strcat (nombre, "hex");
|
|
||||||
|
|
||||||
f = fopen (nombre, "wt");
|
|
||||||
for (i=0;i<leido;i++)
|
|
||||||
fprintf (f, "%.2X\n", scr[i]);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
|
@ -1,31 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main (int argc, char *argv[]){
|
|
||||||
FILE *f;
|
|
||||||
unsigned char *scr;
|
|
||||||
char nombre[256];
|
|
||||||
int i,leido;
|
|
||||||
|
|
||||||
if (argc<2)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
scr = (unsigned char *) malloc(65536);
|
|
||||||
f = fopen (argv[1],"rb");
|
|
||||||
if (!f)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
leido = fread (scr, 1, 65536, f);
|
|
||||||
fclose (f);
|
|
||||||
|
|
||||||
strcpy (nombre, argv[1]);
|
|
||||||
nombre[strlen(nombre)-3]=0;
|
|
||||||
strcat (nombre, "hex");
|
|
||||||
|
|
||||||
f = fopen (nombre, "wt");
|
|
||||||
for (i=0;i<leido;i++)
|
|
||||||
fprintf (f, "%.2X\n", scr[i]);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -45,6 +45,7 @@ export FORCECLEAN
|
||||||
|
|
||||||
SJASMPLUS := sjasmplus$(EXECEXT)
|
SJASMPLUS := sjasmplus$(EXECEXT)
|
||||||
ZX7B := zx7b$(EXECEXT)
|
ZX7B := zx7b$(EXECEXT)
|
||||||
|
BIN2HEX := bin2hex$(EXECEXT)
|
||||||
FCUT := fcut$(EXECEXT)
|
FCUT := fcut$(EXECEXT)
|
||||||
FPAD := fpad$(EXECEXT)
|
FPAD := fpad$(EXECEXT)
|
||||||
FPOKE := fpoke$(EXECEXT)
|
FPOKE := fpoke$(EXECEXT)
|
||||||
|
@ -54,6 +55,7 @@ ADDITEM := AddItem$(EXECEXT)
|
||||||
TOOLS:=\
|
TOOLS:=\
|
||||||
bin/$(SJASMPLUS) \
|
bin/$(SJASMPLUS) \
|
||||||
bin/$(ZX7B) \
|
bin/$(ZX7B) \
|
||||||
|
bin/$(BIN2HEX) \
|
||||||
bin/$(FCUT) \
|
bin/$(FCUT) \
|
||||||
bin/$(FPAD) \
|
bin/$(FPAD) \
|
||||||
bin/$(FPOKE) \
|
bin/$(FPOKE) \
|
||||||
|
|
|
@ -29,6 +29,7 @@ Command | Target
|
||||||
`make` | all tools
|
`make` | all tools
|
||||||
`make bin/sjasmplus` | **sjasmplus**
|
`make bin/sjasmplus` | **sjasmplus**
|
||||||
`make bin/zx7b` | **zx7b**
|
`make bin/zx7b` | **zx7b**
|
||||||
|
`make bin/bin2hex` | **bin2hex**
|
||||||
`make bin/fcut` | **fcut**
|
`make bin/fcut` | **fcut**
|
||||||
`make bin/fpad` | **fpad**
|
`make bin/fpad` | **fpad**
|
||||||
`make bin/fpoke` | **fpoke**
|
`make bin/fpoke` | **fpoke**
|
||||||
|
@ -111,6 +112,7 @@ This has the same behavior as the inclusion of `common.mk` file in a Makefile.
|
||||||
|
|
||||||
* sjasmplus
|
* sjasmplus
|
||||||
* zx7b
|
* zx7b
|
||||||
|
* bin2hex
|
||||||
* fcut
|
* fcut
|
||||||
* fpad
|
* fpad
|
||||||
* fpoke
|
* fpoke
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
sjasmplus
|
sjasmplus
|
||||||
zx7b
|
zx7b
|
||||||
|
bin2hex
|
||||||
fcut
|
fcut
|
||||||
fpad
|
fpad
|
||||||
fpoke
|
fpoke
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,9 @@
|
||||||
|
SPDX-FileName: bin2hex.exe
|
||||||
|
|
||||||
|
SPDX-FileType: BINARY
|
||||||
|
|
||||||
|
SPDX-FileChecksum: SHA1: acc480181c0cdc8d5bfce1c633c8eefd8165908c
|
||||||
|
|
||||||
|
SPDX-FileCopyrightText: Copyright (C) 2016, 2021 Antonio Villena
|
||||||
|
|
||||||
|
SPDX-License-Identifier: GPL-3.0-only
|
|
@ -24,6 +24,7 @@ include ../common.mk
|
||||||
|
|
||||||
SJASMPLUS := sjasmplus$(EXECEXT)
|
SJASMPLUS := sjasmplus$(EXECEXT)
|
||||||
ZX7B := zx7b$(EXECEXT)
|
ZX7B := zx7b$(EXECEXT)
|
||||||
|
BIN2HEX := bin2hex$(EXECEXT)
|
||||||
FCUT := fcut$(EXECEXT)
|
FCUT := fcut$(EXECEXT)
|
||||||
FPAD := fpad$(EXECEXT)
|
FPAD := fpad$(EXECEXT)
|
||||||
FPOKE := fpoke$(EXECEXT)
|
FPOKE := fpoke$(EXECEXT)
|
||||||
|
@ -33,6 +34,7 @@ ADDITEM := AddItem$(EXECEXT)
|
||||||
TOOLS:= \
|
TOOLS:= \
|
||||||
../bin/$(SJASMPLUS) \
|
../bin/$(SJASMPLUS) \
|
||||||
../bin/$(ZX7B) \
|
../bin/$(ZX7B) \
|
||||||
|
../bin/$(BIN2HEX) \
|
||||||
../bin/$(FCUT) \
|
../bin/$(FCUT) \
|
||||||
../bin/$(FPAD) \
|
../bin/$(FPAD) \
|
||||||
../bin/$(FPOKE) \
|
../bin/$(FPOKE) \
|
||||||
|
@ -84,6 +86,9 @@ sjasmplus:
|
||||||
zx7b/$(ZX7B): | zx7b
|
zx7b/$(ZX7B): | zx7b
|
||||||
$(MAKE) -w -C $|
|
$(MAKE) -w -C $|
|
||||||
|
|
||||||
|
../bin/$(BIN2HEX): tools/$(BIN2HEX)
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
../bin/$(FCUT): tools/$(FCUT)
|
../bin/$(FCUT): tools/$(FCUT)
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
|
@ -99,6 +104,7 @@ zx7b/$(ZX7B): | zx7b
|
||||||
../bin/$(ADDITEM): tools/$(ADDITEM)
|
../bin/$(ADDITEM): tools/$(ADDITEM)
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
|
tools/$(BIN2HEX) \
|
||||||
tools/$(FCUT) \
|
tools/$(FCUT) \
|
||||||
tools/$(FPAD) \
|
tools/$(FPAD) \
|
||||||
tools/$(FPOKE) \
|
tools/$(FPOKE) \
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
bin2hex
|
||||||
|
bin2hex.exe
|
||||||
fcut
|
fcut
|
||||||
fcut.exe
|
fcut.exe
|
||||||
fpad
|
fpad
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
include ../../common.mk
|
include ../../common.mk
|
||||||
|
|
||||||
|
BIN2HEX := bin2hex$(EXECEXT)
|
||||||
FCUT := fcut$(EXECEXT)
|
FCUT := fcut$(EXECEXT)
|
||||||
FPAD := fpad$(EXECEXT)
|
FPAD := fpad$(EXECEXT)
|
||||||
FPOKE := fpoke$(EXECEXT)
|
FPOKE := fpoke$(EXECEXT)
|
||||||
|
@ -27,6 +28,7 @@ GENROM := GenRom$(EXECEXT)
|
||||||
ADDITEM := AddItem$(EXECEXT)
|
ADDITEM := AddItem$(EXECEXT)
|
||||||
|
|
||||||
TOOLS:=\
|
TOOLS:=\
|
||||||
|
$(BIN2HEX) \
|
||||||
$(FCUT) \
|
$(FCUT) \
|
||||||
$(FPAD) \
|
$(FPAD) \
|
||||||
$(FPOKE) \
|
$(FPOKE) \
|
||||||
|
@ -36,6 +38,9 @@ TOOLS:=\
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TOOLS)
|
all: $(TOOLS)
|
||||||
|
|
||||||
|
$(BIN2HEX): bin2hex.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
$(FCUT): fcut.c
|
$(FCUT): fcut.c
|
||||||
$(CC) $(CFLAGS) -o $@ $<
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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>
|
||||||
|
|
||||||
|
int main (int argc, char *argv[]){
|
||||||
|
FILE *f;
|
||||||
|
unsigned char *scr;
|
||||||
|
char nombre[256];
|
||||||
|
int i,leido;
|
||||||
|
|
||||||
|
if (argc<2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
scr = (unsigned char *) malloc(65536);
|
||||||
|
f = fopen (argv[1],"rb");
|
||||||
|
if (!f)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
leido = fread (scr, 1, 65536, f);
|
||||||
|
fclose (f);
|
||||||
|
|
||||||
|
strcpy (nombre, argv[1]);
|
||||||
|
nombre[strlen(nombre)-3]=0;
|
||||||
|
strcat (nombre, "hex");
|
||||||
|
|
||||||
|
f = fopen (nombre, "wt");
|
||||||
|
for (i=0;i<leido;i++)
|
||||||
|
fprintf (f, "%.2X\n", scr[i]);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue