mirror of
https://github.com/livingcomputermuseum/cpus-pdp8.git
synced 2026-01-13 15:37:04 +00:00
added ushow for sim output
This commit is contained in:
parent
e5953e3cb9
commit
9d89453b0f
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
SUBDIRS = macro showbin maker skipz
|
SUBDIRS = macro showbin maker skipz ushow
|
||||||
|
|
||||||
all clean:
|
all clean:
|
||||||
for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
|
for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
|
||||||
|
|||||||
9
utils/skipz/Makefile
Normal file
9
utils/skipz/Makefile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
all: skipz
|
||||||
|
|
||||||
|
skipz: skipz.c
|
||||||
|
cc -o skipz skipz.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f skipz
|
||||||
|
|
||||||
48
utils/skipz/skipz.c
Normal file
48
utils/skipz/skipz.c
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* brad@heeltoe.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
size_t binfile_size;
|
||||||
|
|
||||||
|
unsigned char binfile[64*1024];
|
||||||
|
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc > 1) {
|
||||||
|
int f, ret;
|
||||||
|
char ch;
|
||||||
|
|
||||||
|
f = open(argv[1], O_RDONLY);
|
||||||
|
if (f < 0) {
|
||||||
|
perror(argv[1]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
ret = read(f, &ch, 1);
|
||||||
|
if (ret != 1)
|
||||||
|
return -1;
|
||||||
|
if (ch == 'Z'-'@')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
binfile_size = read(f, binfile, sizeof(binfile));
|
||||||
|
ret = write(1, binfile, binfile_size);
|
||||||
|
close(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode:nil
|
||||||
|
* c-basic-offset:4
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
6
utils/ushow/Makefile
Normal file
6
utils/ushow/Makefile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
ushow: ushow.c
|
||||||
|
cc -o ushow ushow.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f ushow
|
||||||
26
utils/ushow/ushow.c
Normal file
26
utils/ushow/ushow.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int c;
|
||||||
|
char b[1024];
|
||||||
|
|
||||||
|
void add(int v)
|
||||||
|
{
|
||||||
|
b[c++] = v & 0x7f;
|
||||||
|
b[c] = 0;
|
||||||
|
printf("output: %s\n", b);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
char line[1024];
|
||||||
|
|
||||||
|
while (fgets(line, sizeof(line), stdin)) {
|
||||||
|
if (memcmp(&line[4], "tx_data ", 8) == 0) {
|
||||||
|
char s1[256], s2[256];
|
||||||
|
int v;
|
||||||
|
sscanf(line, "%s %s %o", s1, s2, &v);
|
||||||
|
add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user