Skip to content

Commit

Permalink
ZSM v3.4 from my RetroProjects repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelVis committed Mar 7, 2020
0 parents commit b21dda1
Show file tree
Hide file tree
Showing 52 changed files with 13,105 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# ---------------------------
# MESCC & TOOL CHAIN BINARIES
# ---------------------------
cpm.exe
cpm2.exe
cpm_player.exe
cc.com
cc.COM
CC.COM
ccopt.com
ccopt.COM
CCOPT.COM
#zsm.com
#ZSM.COM
#hextocom.com
#hextocom.COM
#HEXTOCOM.COM
#link.com
#LINK.COM
#prntosym.com
#prntosym.COM
#PRNTOSYM.COM
#zmac.exe

# ---------------
# MESCC LIBRARIES
# ---------------
alloc.h
atexit.h
bsearch.h
clock.h
conio.h
cpm.h
ctype.h
fileio.h
fprintf.h
mem.h
mescc.h
printf.h
qsort.h
rand.h
redir.h
setjmp.h
sprintf.h
stdbool.h
string.h
xprintf.h
z80.h

# ------------------
# INTERMEDIATE FILES
# ------------------
*.HEX
*.ZSM
*.PRN

# -----------------------
# PROJECT FILES & FOLDERS
# -----------------------
backup/
Binary file added BINTOASM.COM
Binary file not shown.
Binary file added DUMP.COM
Binary file not shown.
Binary file added HEXTOCOM.COM
Binary file not shown.
Binary file added PRL.COM
Binary file not shown.
Binary file added PRNTOSYM.COM
Binary file not shown.
Binary file added RSX.COM
Binary file not shown.
Binary file added ZSM.COM
Binary file not shown.
Binary file added ZSMPP.COM
Binary file not shown.
103 changes: 103 additions & 0 deletions bintoasm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* BinToAsm.c
Converts a binary file into an assembler file for Z80.
Copyright (C) 2004-2015 Miguel I. Garcia Lopez, FloppySoftware
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; either version 2, or (at your option) any
later version.
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, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
To compile with MESCC:
cc bintoasm
ccopt bintoasm.zsm
zsm bintoasm
hextocom bintoasm
Revisions:
22 Feb 2004 : v1.00
03 Apr 2007 : v1.01 / Minor changes.
10 Apr 2007 : Output 8 bytes in a line instead of 16.
15 May 2007 : v1.02 / Added title & usage help.
04 Sep 2015 : v1.03 / Amended some messages and comments.
*/

#include <mescc.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include <fileio.h>
#include <printf.h>
#include <fprintf.h>

#define VERSION "1.03 / 04 Sep 2015\n\n(c) 2004-2015 FloppySoftware"

FILE *fpi, *fpo;

int data, chpos;
unsigned counter;

main(argc, argv)
int argc, argv[];
{
printf("BinToAsm v%s\n\n", VERSION);

if(argc!=3)
{
printf("Usage: bintoasm binfile asmfile\n");
exit(1);
}

if((fpi=fopen(argv[1],"rb"))==NULL)
error("Opening input file");

if((fpo=fopen(argv[2],"w"))==NULL)
error("Opening output file");

counter=chpos=0;

while((data=fgetc(fpi))!=EOF)
{
if(!chpos)
fprintf(fpo, " DEFB");

fprintf(fpo, " %03d", data);

if(++chpos!=8)
fprintf(fpo, ",");
else
{
fprintf(fpo, "\n");
chpos=0;
}

++counter;
}

printf("%d bytes\n", counter);

if(fclose(fpi))
error("Closing input file");

if(fclose(fpo))
error("Closing output file");
}

error(txt)
char *txt;
{
printf("ERROR: %s\n", txt);
exit(1);
}
157 changes: 157 additions & 0 deletions dump.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/* dump.c
Print contents of a file in byte and ascii format.
(c) 2000-2015 Miguel I. Garcia Lopez, FloppySoftware.
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; either version 2 of the License, or (at your
option) any later version.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Usage:
dump filename
To compile with MESCC:
cc dump
ccopt dump.zsm
zsm dump
hextocom dump
Revisions:
?? ?? 2000 : v1.00
10 Nov 2013 : v1.20
04 Sep 2015 : v1.21 : Amended some messages and comments.
*/

/* LIBRARIES
*/

#define CC_FREAD

#include <mescc.h>
#include <conio.h>
#include <fileio.h>

/* DEFs
*/

#define VERSION "Dump v1.21 / 04 Sep 2015\n\n(c) 2000-2015 FloppySoftware"

/* PROGRAM
*/

main(argc,argv)
int argc;
int argv[];
{
int i, /* Counter */
offset; /* Offset in file */

FILE *fp; /* Channel for file */

char buffer[16]; /* Buffer for input file */

/* Check right number of parameters */

if(argc != 2)
{
puts(VERSION);
puts("\nUsage: dump fname");
return 1;
}

/* Open file in binary mode */

if((fp = fopen((argv[1]),"rb")) == NULL)
error("Can't open file");

/* Initialize variables */

offset=0;

/* Start */

while(fread(buffer, 16, 1, fp) == 1)
{
/* Print offset */

puthex4(offset); putchar(' '); putchar(':'); putchar(' ');

/* Print data in hexadecimal format */

for(i = 0; i < 16; ++i)
{
puthex2(buffer[i]); putchar(' ');
}

/* Separator */

putchar(':'); putchar(' ');

/* Print data in ascii format */

for(i = 0; i < 16; ++i)
{
if(buffer[i] > 31 && buffer[i] < 128)
putchar(buffer[i]);
else
putchar('.');
}

/* End of line */

putchar('\n');

/* Update offset */

offset += 16;
}

fclose(fp);

return 0;
}

error(txt)
char *txt;
{
puts(txt);

exit(1);
}

puthex4(word)
int word;
{
puthex2(word >> 8);
puthex2(word);
}

puthex2(byte)
char byte;
{
puthex1(byte >> 4);
puthex1(byte);
}

puthex1(nibble)
char nibble;
{
nibble &= 0x0F;

putchar(nibble < 10 ? '0' + nibble : 'A' + nibble - 10);
}

Loading

0 comments on commit b21dda1

Please sign in to comment.