Add Makefiles, fix some compile errors

There are more compile errors, especially in the cross-assemblers.
But I'm leaving those for someone else.
This commit is contained in:
Timothe Litt
2015-05-26 17:42:36 -04:00
parent a18b1f8d62
commit 2d7f74e9ff
38 changed files with 831 additions and 26 deletions

41
extracters/Makefile Normal file
View File

@@ -0,0 +1,41 @@
# all of these can be over-ridden on the "make" command line if they don't suit your environment.
CFLAGS=-O2 -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
BIN=/usr/local/bin
INSTALL=install
CC=gcc
.PHONY: all clean install uninstall
# Omitted: backup, ods2: need more complicated Makefiles.
all:
cd ckabstape && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)"
cd mmdir && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)"
cd mtdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)"
cd rawcopy && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)"
cd sdsdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)"
cd tpdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)"
clean:
cd ckabstape && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" clean
cd mmdir && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" clean
cd mtdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" clean
cd rawcopy && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" clean
cd sdsdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" clean
cd tpdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" clean
install:
cd ckabstape && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" install
cd mmdir && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" install
cd mtdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" install
cd rawcopy && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" install
cd sdsdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" install
cd tpdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" install
uninstall:
cd ckabstape && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" uninstall
cd mmdir && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" uninstall
cd mtdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" uninstall
cd rawcopy && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" uninstall
cd sdsdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" uninstall
cd tpdump && $(MAKE) CFLAGS="$(CFLAGS)" BIN="$(BIN)" INSTALL="$(INSTALL)" CC="$(CC)" uninstall

View File

@@ -0,0 +1,20 @@
# all of these can be over-ridden on the "make" command line if they don't suit your environment.
TOOL=ckabstape
CFLAGS=-O2 -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
BIN=/usr/local/bin
INSTALL=install
CC=gcc
$(TOOL): $(TOOL).c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(TOOL) $(TOOL).c $(LDLIBS)
.PHONY: clean install uninstall
clean:
rm -f $(TOOL)
install: $(TOOL)
$(INSTALL) -p -m u=rx,g=rx,o=rx $(TOOL) $(BIN)
uninstall:
rm -f $(BIN)/$(TOOL)

View File

@@ -1,4 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
static unsigned char sixlut[64] = {
'@','A','B','C','D','E','F','G',
@@ -41,8 +42,8 @@ unsigned int readframe()
do{
c = getchar();
if(feof(stdin))
exit();
if((c & 0x80) == 0) printf("{nul}\n",c);
exit(0);
if((c & 0x80) == 0) printf("{nul}\n");
} while((c & 0x80) == 0);
i = ((c & 0xc0)>>6)<<27;
@@ -50,8 +51,8 @@ unsigned int readframe()
do{
c = getchar();
if(feof(stdin))
exit();
if((c & 0x80) == 0) printf("{nul}\n",c);
exit(0);
if((c & 0x80) == 0) printf("{nul}\n");
} while((c & 0x80) == 0);
i = i |((c & 0xc0)>>6)<<24;
@@ -60,8 +61,8 @@ unsigned int readframe()
do{
c = getchar();
if(feof(stdin))
exit();
if((c & 0x80) == 0) printf("{nul}\n",c);
exit(0);
if((c & 0x80) == 0) printf("{nul}\n");
} while((c & 0x80) == 0);
i = i |((c & 0xc0)>>6)<<21;
@@ -69,7 +70,7 @@ unsigned int readframe()
return i;
}
disasm(unsigned int instr)
void disasm(unsigned int instr)
{
char *idx;
if(instr & 0010000) idx = ",X"; else idx = " ";
@@ -248,7 +249,7 @@ disasm(unsigned int instr)
case(0740000):
printf("NOP ");
break;
case(0740001): // CMA compliment AC
case(0740001): /* CMA compliment AC */
printf("CMA ");
break;
case(0740002):
@@ -335,19 +336,20 @@ disasm(unsigned int instr)
}
}
main()
int main(int argc, char **argv)
{
int totalblks = 0;
int badblks = 0;
unsigned int fullwd = 0;
unsigned int currentwd = 0;
int wds = 0;
int bytecnt = 0;
int col = 0;
int framecount;
unsigned int cksum;
unsigned int adr;
unsigned char c;
(void) argc;
(void) argv;
/*
* read 3 chars and pack them in a word
*/
@@ -373,22 +375,22 @@ main()
* (check is in readframe..)
*/
adr = readframe() & 0777777; // staring adr
adr = readframe() & 0777777; /*staring adr */
cksum = adr;
printf("ADR: %010o\n", adr);
framecount = readframe() & 0777777; // word count
framecount = readframe() & 0777777; /* word count */
cksum += framecount;
framecount = -(0xfffe0000 | framecount); // sign extend
framecount = -(0xfffe0000 | framecount); /* sign extend */
printf("CNT: %010o (%d)\n", framecount, framecount);
if((adr & 0700000) != 0){
printf("FRAMECOUNT == 0 START ADR == %06o\n", adr);
printf("TOTAL BLKS %d TOTAL ERRS %d\n", totalblks, badblks);
exit();
exit(0);
}
currentwd = readframe() & 0777777; // checksum
currentwd = readframe() & 0777777; /* checksum */
cksum += currentwd;
printf("CKS: %06o\n", currentwd);
/*
@@ -419,5 +421,7 @@ main()
if(bytecnt > 0){
printf("%d chrs left\n", bytecnt);
}
exit(0);
}

20
extracters/mmdir/Makefile Normal file
View File

@@ -0,0 +1,20 @@
# all of these can be over-ridden on the "make" command line if they don't suit your environment.
TOOL=mmdir
CFLAGS=-O2 -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
BIN=/usr/local/bin
INSTALL=install
CC=gcc
$(TOOL): $(TOOL).c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(TOOL) $(TOOL).c $(LDLIBS)
.PHONY: clean install uninstall
clean:
rm -f $(TOOL)
install: $(TOOL)
$(INSTALL) -p -m u=rx,g=rx,o=rx $(TOOL) $(BIN)
uninstall:
rm -f $(BIN)/$(TOOL)

View File

@@ -0,0 +1,20 @@
# all of these can be over-ridden on the "make" command line if they don't suit your environment.
TOOL=mtdump
CFLAGS=-O2 -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
BIN=/usr/local/bin
INSTALL=install
CC=gcc
$(TOOL): $(TOOL).c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(TOOL) $(TOOL).c $(LDLIBS)
.PHONY: clean install uninstall
clean:
rm -f $(TOOL)
install: $(TOOL)
$(INSTALL) -p -m u=rx,g=rx,o=rx $(TOOL) $(BIN)
uninstall:
rm -f $(BIN)/$(TOOL)

View File

@@ -42,9 +42,10 @@
int main (int argc, char *argv[])
{
int obj, i, k, fc, rc, tpos;
unsigned int bc, fmt, rlntsiz;
unsigned char *s, bca[4];
int preveof, gapcount, gpos, gincr;
unsigned int bc = 0, fmt, rlntsiz;
unsigned char *s;
unsigned char bca[4] = { 0,0,0,0 };
int preveof, gapcount, gpos = 0, gincr;
FILE *ifile;
#define MAXRLNT 65536
@@ -62,7 +63,7 @@ if ((s != NULL) && (*s++ == '-')) {
fmt = F_E11; rlntsiz = 4; break;
case 'C': case 'c':
fmt = F_TPC; rlntsiz = 2; break;
/* case 'F': case 'f':
/* case 'F': case 'f': */
/* fmt = F_TPF; break; */
default:
fprintf (stderr, "Bad option %c\n", *s);

View File

@@ -0,0 +1,20 @@
# all of these can be over-ridden on the "make" command line if they don't suit your environment.
TOOL=RawCopy
CFLAGS=-O2 -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
BIN=/usr/local/bin
INSTALL=install
CC=gcc
$(TOOL): $(TOOL).c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(TOOL) $(TOOL).c $(LDLIBS)
.PHONY: clean install uninstall
clean:
rm -f $(TOOL)
install: $(TOOL)
$(INSTALL) -p -m u=rx,g=rx,o=rx $(TOOL) $(BIN)
uninstall:
rm -f $(BIN)/$(TOOL)

View File

@@ -34,7 +34,7 @@ while (0 != (bytesread = fread(buf, 1, readsize, fin)))
{
if (bytesread != fwrite(buf, 1, bytesread, fout))
{
fprintf(stderr, "Error Writing '%s': %s\n", strerror(errno));
fprintf(stderr, "Error Writing '%s': %s\n", argv[2], strerror(errno));
break;
}
else
@@ -46,4 +46,5 @@ fprintf(stderr, "\n");
fprintf(stderr, "Total Data: %6.2f MBytes (%d bytes)\n", totalbytes/(1024.0*1024.0), totalbytes);
fclose(fin);
fclose(fout);
exit(0);
}

View File

@@ -0,0 +1,20 @@
# all of these can be over-ridden on the "make" command line if they don't suit your environment.
TOOL=sdsdump
CFLAGS=-O2 -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
BIN=/usr/local/bin
INSTALL=install
CC=gcc
$(TOOL): $(TOOL).c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(TOOL) $(TOOL).c $(LDLIBS)
.PHONY: clean install uninstall
clean:
rm -f $(TOOL)
install: $(TOOL)
$(INSTALL) -p -m u=rx,g=rx,o=rx $(TOOL) $(BIN)
uninstall:
rm -f $(BIN)/$(TOOL)

View File

@@ -0,0 +1,20 @@
# all of these can be over-ridden on the "make" command line if they don't suit your environment.
TOOL=tpdump
CFLAGS=-O2 -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
BIN=/usr/local/bin
INSTALL=install
CC=gcc
$(TOOL): $(TOOL).c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(TOOL) $(TOOL).c $(LDLIBS)
.PHONY: clean install uninstall
clean:
rm -f $(TOOL)
install: $(TOOL)
$(INSTALL) -p -m u=rx,g=rx,o=rx $(TOOL) $(BIN)
uninstall:
rm -f $(BIN)/$(TOOL)

View File

@@ -49,7 +49,6 @@ size_t read_len ( FILE* fi )
/* Read a little-endian four-byte number */
{ unsigned char c; /* A Character from the file */
size_t i;
size_t lc; /* The character, as a long int */
size_t n; /* the number */
if ( fread ( &c, 1, 1, fi ) == 0 )
return (0);
@@ -80,7 +79,7 @@ void usage ( char* argv[] )
printf ( " -o Use the 'old simh' print arrangement\n");
}
main ( int argc, char* argv[] )
int main ( int argc, char* argv[] )
{ FILE* fi;
int all; /* "print all of a record, even blank lines" */
char* bcd_to_ascii; /* Translation table, ..._a or ..._h */
@@ -136,7 +135,7 @@ main ( int argc, char* argv[] )
for ( nb=1, i=np; i>0; i/=10, nb++ ) pr[np-nb] = '0' + ( i%10 );
printf ( " %s\n", pr );
nr = 0;
while ( recsiz = read_len ( fi ) )
while ( (recsiz = read_len ( fi )) )
{ nb = 1;
nr++;
i = recsiz;
@@ -148,7 +147,7 @@ main ( int argc, char* argv[] )
return(3);
}
i--;
pr[np] = bcd_to_ascii[pr[np]];
pr[np] = bcd_to_ascii[(unsigned int)pr[np]];
if ( dowm )
if ( pr[np] == bcd_to_ascii[BCD_WM] ) wm[np--] = '1';
}
@@ -181,4 +180,5 @@ main ( int argc, char* argv[] )
}
if ( nf > 0 ) printf ( "File %d\n", ++nft );
}
return(0);
}