Discussion:
[Simh] transferring files to and from v6 unix running in pdp11 emulator
Will Senn
2015-11-20 16:35:06 UTC
Permalink
Hi,

I have searched and searched and have not found a satisfactory answer to
this question:

How can I efficiently copy files from my host system to unix version 6
running in the pdp11 emulator and from unix 6 to my host system?

Most answers are shallow (copy/paste in terminal), or oriented toward
RTS or another environment than unix. So, I thought I would articulate
some of the ideas that I have tried and then ask some relevant questions
in the hopes that the someone will shed some light on the problem, if
not provide the answers.

My system is one of:
Debian 8 running on Intel Core 2 Quad Processor
FreeBSD 10.2 running on same
Macbook Pro running on Intel i7
Various Linuxes running in Virtualbox 5.x

Here are the methods I have found that work, sort of...

Unix on PDP11 SimH to Host:
1. cat file and copy and paste from terminal
This only works for pure text files and is not ideal

2. setup lpt in simh attached to printer.txt and cat file > /dev/lp0
This only works for textual output, but includes form feed characters
and has formatting applied on its way to printer.txt

3. attach a blank tape tm0 to simh and dd if=myfile of=/dev/rmt0, then
on the host deblock the tape and dd if=tapefile of=myfile
This seems to work, but I'm not sure it's ok to do this. It doesn't
appear to work as well in the other direction.

Host to Unix v6 on PDP11 SimH:
1. copy a file into the copy buffer on the host and in the unix terminal
window, paste the text.
Wow, this is tricky. It seems like you can only paste a few lines at a
time. It does strange things if your text contains special characters
like #, @, (, and so forth, which makes it pretty annoying as
practically every file of interest is c source or something. However,
with patience this does sort of work, but it's just for text files.

2. use Wolfgang's enblock - enblock < myfile > myfile.enb and then
attach to tm0 in simh and dd if=/dev/rmt0 of=myfile
This is problematic, resulting in read errors and when diff'ed against
files on the simh unix instance, produces errors about incomplete
lines. I am fairly sure that there is a good reason why it sort of
works, but not fully. i.e. The resulting file is 99% ok.

Ideally, I would be able to tar up some files and convert the tar to a
storage format that unix v6 could then access and untar. One problem is
that v6 doesn't have tar. So, maybe ar could be used, or tp, or whatever
other command is available on v6. Regardless, the underlying issue is
that a file needs to be converted to a storage format that unix v6 can
handle. This leads to the questions.

* I don't have a deep knowledge of storage formats, so it may be that
what I'm asking isn't feasible, if someone could share the why along
with the how or how not, that would be great.

1. Is there a simple, known, way to convert a single file, or multiple
files at once, on a *nix host to a tape image that can be read by simh
and unix v6? Perhaps something along the lines of - on the host,
convert_util myfile tape.simh; in simh, attach tm0 tape.simh; on unix,
dd if=/dev/mt0 of=myfile

2. Is it appropriate to read directly from a simulated tape device using
dd, or is dd going to read the tape marks (whatever those are) as part
of the file data?

3. Is the tape device the best to use for something like this, or would
another device be more straightforward?

Grateful for any assistance,

Will
Anders Magnusson
2015-11-20 16:51:35 UTC
Permalink
Post by Will Senn
Hi,
I have searched and searched and have not found a satisfactory answer
How can I efficiently copy files from my host system to unix version 6
running in the pdp11 emulator and from unix 6 to my host system?
I usually do this by just tar'ing to/from a disk file, something like:

on pdp11: tar cf /dev/rxp0c myfiles
on host: tar xf simh-disk-file

Works both ways :-)

-- Ragge
Post by Will Senn
Most answers are shallow (copy/paste in terminal), or oriented toward
RTS or another environment than unix. So, I thought I would articulate
some of the ideas that I have tried and then ask some relevant
questions in the hopes that the someone will shed some light on the
problem, if not provide the answers.
Debian 8 running on Intel Core 2 Quad Processor
FreeBSD 10.2 running on same
Macbook Pro running on Intel i7
Various Linuxes running in Virtualbox 5.x
Here are the methods I have found that work, sort of...
1. cat file and copy and paste from terminal
This only works for pure text files and is not ideal
2. setup lpt in simh attached to printer.txt and cat file > /dev/lp0
This only works for textual output, but includes form feed characters
and has formatting applied on its way to printer.txt
3. attach a blank tape tm0 to simh and dd if=myfile of=/dev/rmt0, then
on the host deblock the tape and dd if=tapefile of=myfile
This seems to work, but I'm not sure it's ok to do this. It doesn't
appear to work as well in the other direction.
1. copy a file into the copy buffer on the host and in the unix
terminal window, paste the text.
Wow, this is tricky. It seems like you can only paste a few lines at a
time. It does strange things if your text contains special characters
practically every file of interest is c source or something. However,
with patience this does sort of work, but it's just for text files.
2. use Wolfgang's enblock - enblock < myfile > myfile.enb and then
attach to tm0 in simh and dd if=/dev/rmt0 of=myfile
This is problematic, resulting in read errors and when diff'ed against
files on the simh unix instance, produces errors about incomplete
lines. I am fairly sure that there is a good reason why it sort of
works, but not fully. i.e. The resulting file is 99% ok.
Ideally, I would be able to tar up some files and convert the tar to a
storage format that unix v6 could then access and untar. One problem
is that v6 doesn't have tar. So, maybe ar could be used, or tp, or
whatever other command is available on v6. Regardless, the underlying
issue is that a file needs to be converted to a storage format that
unix v6 can handle. This leads to the questions.
* I don't have a deep knowledge of storage formats, so it may be that
what I'm asking isn't feasible, if someone could share the why along
with the how or how not, that would be great.
1. Is there a simple, known, way to convert a single file, or multiple
files at once, on a *nix host to a tape image that can be read by simh
and unix v6? Perhaps something along the lines of - on the host,
convert_util myfile tape.simh; in simh, attach tm0 tape.simh; on unix,
dd if=/dev/mt0 of=myfile
2. Is it appropriate to read directly from a simulated tape device
using dd, or is dd going to read the tape marks (whatever those are)
as part of the file data?
3. Is the tape device the best to use for something like this, or
would another device be more straightforward?
Grateful for any assistance,
Will
_______________________________________________
Simh mailing list
http://mailman.trailing-edge.com/mailman/listinfo/simh
Will Senn
2015-11-20 19:12:42 UTC
Permalink
Post by Anders Magnusson
Post by Will Senn
Hi,
I have searched and searched and have not found a satisfactory answer
How can I efficiently copy files from my host system to unix version
6 running in the pdp11 emulator and from unix 6 to my host system?
on pdp11: tar cf /dev/rxp0c myfiles
on host: tar xf simh-disk-file
Works both ways :-)
-- Ragge
Hi,

This sounded promising, but as it turns out there appear to be 2
problems... 1. v6 doesn't have tar, and 2. it looks like v6 doesn't have
rx device support (floppies). Are you using v6 with tweaks, or v7, or
some other variant of unix?

Thanks,

Will
Anders Magnusson
2015-11-20 19:22:01 UTC
Permalink
Post by Will Senn
Post by Anders Magnusson
Post by Will Senn
Hi,
I have searched and searched and have not found a satisfactory
How can I efficiently copy files from my host system to unix version
6 running in the pdp11 emulator and from unix 6 to my host system?
on pdp11: tar cf /dev/rxp0c myfiles
on host: tar xf simh-disk-file
Works both ways :-)
-- Ragge
Hi,
This sounded promising, but as it turns out there appear to be 2
problems... 1. v6 doesn't have tar, and 2. it looks like v6 doesn't
have rx device support (floppies). Are you using v6 with tweaks, or
v7, or some other variant of unix?
Hm, it was some time ago, but I think it was tar. Otherwise try cpio?
You do not have to use floppies. rxp is the raw device for rp disks
(avoids caching). Just work against that file.

-- Ragge
Will Senn
2015-11-20 22:52:42 UTC
Permalink
Post by Anders Magnusson
Post by Will Senn
Post by Anders Magnusson
Post by Will Senn
Hi,
I have searched and searched and have not found a satisfactory
How can I efficiently copy files from my host system to unix
version 6 running in the pdp11 emulator and from unix 6 to my host
system?
on pdp11: tar cf /dev/rxp0c myfiles
on host: tar xf simh-disk-file
Works both ways :-)
-- Ragge
Hi,
This sounded promising, but as it turns out there appear to be 2
problems... 1. v6 doesn't have tar, and 2. it looks like v6 doesn't
have rx device support (floppies). Are you using v6 with tweaks, or
v7, or some other variant of unix?
Hm, it was some time ago, but I think it was tar. Otherwise try cpio?
You do not have to use floppies. rxp is the raw device for rp disks
(avoids caching). Just work against that file.
-- Ragge
Thanks. I combined a number or responses and came up with the following...

--------
--From Unix v6 on PDP 11/40 SimH to Host:
--------
create and attach an additional rk device:
simh> attach rk3 rk3
co

get a file of interest and note it's size in bytes:
# ls -l /etc/rc
-rw-rw-r-- 1 bin 90 Oct 10 12:32 /etc/rc

look at the od dump of the file for comparison later:
# od -c /etc/rc
0000000 r m - f / e t c / m t a b \n
0000020 / e t c / u p d a t e \n / e t c
0000040 / m o u n t / d e v / r k 1
0000060 / u s r / s o u r c e \n / e t c
0000100 / m o u n t / d e v / r k 2
0000120 / u s r / d o c \n \n
0000132

write the file to the rk device (the sync may not be needed, but the
result looks cleaner, also it doesn't apper that you can specify bs=1,
device errors out):
# dd if=/etc/rc of=/dev/rrk03 conv=sync
0+1 records in
1+0 records out

exit the sim and then on the host, read from the rk image using bs=1 and
count from the ls output:
$ dd if=rk3 of=rc bs=1 count=90
90+0 records in
90+0 records out

$ od -c rc
0000000 r m - f / e t c / m t a b \n
0000020 / e t c / u p d a t e \n / e t c
0000040 / m o u n t / d e v / r k 1
0000060 / u s r / s o u r c e \n / e t c
0000100 / m o u n t / d e v / r k 2
0000120 / u s r / d o c \n \n
0000132

This looks perfect, but I'm skeptical.

--------
-- From Host to Unix v6 on PDP 11/40 SimH Host:
--------
make a minor edit to the rc file (change m to n in the word mtab) and
note it's size in bytes:
$ ls -l rc
-rw-r--r-- 1 wsenn staff 90 Nov 20 16:15 rc

it better be 90, unless I did something other than changing a letter

$ dd if=rc of=rk3 conv=sync
0+1 records in
1+0 records out
512 bytes transferred in 0.000037 secs (13854733 bytes/sec)
note the count of blocks

with the number of blocks on hand, fire up the simulation
# dd if=/dev/rrk3 of=rc.dd count=1

because of the fact that I can't specify bs=1, the result is padded:
od -c rc.dd
0000000 r m - f / e t c / n t a b \n
0000020 / e t c / u p d a t e \n / e t c
0000040 / m o u n t / d e v / r k 1
0000060 / u s r / s o u r c e \n / e t c
0000100 / m o u n t / d e v / r k 2
0000120 / u s r / d o c \n \n \0 \0 \0 \0 \0 \0
0001000

so, I read from the dd file with the number of bytes still in hand:
dd if=rc.dd of=rc bs=1 count=90
90+0 records in
90+0 records out

then diff the file against the original:
diff rc /etc/rc
1c1
* rm -f /etc/ntab
---
. rm -f /etc/mtab

Woohoo and whew! A lot of work, but file transfer in both directions.
Does this approach seem sound to you or do you see some refinements that
are possible/necessary?

Thanks,

Will
Will Senn
2015-12-10 03:40:09 UTC
Permalink
Post by Anders Magnusson
Post by Will Senn
Post by Anders Magnusson
Post by Will Senn
Hi,
I have searched and searched and have not found a satisfactory
How can I efficiently copy files from my host system to unix
version 6 running in the pdp11 emulator and from unix 6 to my host
system?
on pdp11: tar cf /dev/rxp0c myfiles
on host: tar xf simh-disk-file
Works both ways :-)
-- Ragge
Hi,
This sounded promising, but as it turns out there appear to be 2
problems... 1. v6 doesn't have tar, and 2. it looks like v6 doesn't
have rx device support (floppies). Are you using v6 with tweaks, or
v7, or some other variant of unix?
Hm, it was some time ago, but I think it was tar. Otherwise try cpio?
You do not have to use floppies. rxp is the raw device for rp disks
(avoids caching). Just work against that file.
To close the loop on this, I have been able to follow the closing advice
in "Setting up Unix - Seventh Edition" and use its v6tar on v6. It
appears to require split I+D, so I had to "upgrade" from the 11/40 to an
11/45 or 11/70 (both work). It requires the the kernel be recompiled
with separate I+D support with m45.s and such, but pretty
straightforward. I haven't done a lot of copying yet, but at least I am
able to share between v6 and v7. I have also worked out a couple of
different ways to move files to and from the host that involve the disk
or tape. I wrote a perl script to read a SimH tape into its constituent
files that works ok as a way to transfer files as well (clunkier than
tar and such, but it was a good learning exercise).

Thanks,

Will
Clem cole
2015-12-10 04:01:49 UTC
Permalink
It should not be a 411 code. It should be a standard 407. 11/34 and 11/60s are so called 40 class systems. I used v6tar with them just fine.

Sent from my iPhone
use its v6tar on v6. It appears to require split I+D,
Will Senn
2015-12-10 06:10:59 UTC
Permalink
Post by Clem cole
It should not be a 411 code. It should be a standard 407. 11/34 and 11/60s are so called 40 class systems. I used v6tar with them just fine.
Sent from my iPhone
use its v6tar on v6. It appears to require split I+D,
Clem,

Thanks for persisting. I figured it out - on Keith Bostic's v7, using
the default makefile for v6tar:
make v6tar
cc -O -c tar.c
cc -c -O /usr/src/libc/v6/access.c
cc -c -O /usr/src/libc/v6/chown.c
cc -c -O /usr/src/libc/v6/execl.c
cc -c -O /usr/src/libc/v6/ftime.c
cc -c -O /usr/src/libc/v6/gtty.c
cc -c -O /usr/src/libc/v6/lseek.c
cc -c -O /usr/src/libc/v6/stat.c
cc -c -O /usr/src/libc/v6/syscall.s
cc -c -O /usr/src/libc/v6/time.s
cc -i -s -O *.o -o v6tar
# dd if=v6tar bs=128 count=1|od
0000000 000411 037100 004224 027466 000000 000000 000000 000001
...
man cc says -i and -s are passed through to linker, so man ld says -i
creates separate I+D and -s strips symbol table. I compiled the binary
without these (I thought I would keep the symbol table as an excercise)
using:
cc -O *.o -o v6tar

The resulting binary is 407, yay!:
dd if=v6tar bs=128 count=1|od
0000000 000407 037040 004224 027466 020744 000000 000000 000001
...

I copied it over to v6, lo and behold, it works on a PDP11/40 without
separate I+D!

Thanks,

Will
Clem cole
2015-12-10 12:12:41 UTC
Permalink
Ah yes. -i That's the ticket. Refresh the brain cache.

Glad you figured it out. As I said if you run a cmp between that binary and one of the ones available in the wild I think you will find them to be the same.

Clem

Sent from my iPhone
Post by Will Senn
Post by Clem cole
It should not be a 411 code. It should be a standard 407. 11/34 and 11/60s are so called 40 class systems. I used v6tar with them just fine.
Sent from my iPhone
use its v6tar on v6. It appears to require split I+D,
Clem,
make v6tar
cc -O -c tar.c
cc -c -O /usr/src/libc/v6/access.c
cc -c -O /usr/src/libc/v6/chown.c
cc -c -O /usr/src/libc/v6/execl.c
cc -c -O /usr/src/libc/v6/ftime.c
cc -c -O /usr/src/libc/v6/gtty.c
cc -c -O /usr/src/libc/v6/lseek.c
cc -c -O /usr/src/libc/v6/stat.c
cc -c -O /usr/src/libc/v6/syscall.s
cc -c -O /usr/src/libc/v6/time.s
cc -i -s -O *.o -o v6tar
# dd if=v6tar bs=128 count=1|od
0000000 000411 037100 004224 027466 000000 000000 000000 000001
...
cc -O *.o -o v6tar
dd if=v6tar bs=128 count=1|od
0000000 000407 037040 004224 027466 020744 000000 000000 000001
...
I copied it over to v6, lo and behold, it works on a PDP11/40 without separate I+D!
Thanks,
Will
Mark Pizzolato
2015-11-20 19:22:33 UTC
Permalink
Post by Will Senn
Post by Anders Magnusson
Post by Will Senn
I have searched and searched and have not found a satisfactory answer
How can I efficiently copy files from my host system to unix version
6 running in the pdp11 emulator and from unix 6 to my host system?
on pdp11: tar cf /dev/rxp0c myfiles
on host: tar xf simh-disk-file
Works both ways :-)
-- Ragge
This sounded promising, but as it turns out there appear to be 2
problems... 1. v6 doesn't have tar, and 2. it looks like v6 doesn't have
rx device support (floppies). Are you using v6 with tweaks, or v7, or
some other variant of unix?
Well, the tar approach is certainly the most elegant and if tar was available, converting a raw tar file to a simh tape image back and forth is quite trivial if you've got a tape device...

So you may be reduced to cutting from the terminal session you are running the simulator in to get data from the simulator to the host (or the lpt approach you mentioned).

If you try the latest code at github.com/simh/simh, pasting into the console terminal or any other supported terminal will now work and you won't be limited to just a couple of lines pasting at any one time. This is new as of yesterday.

- Mark
Will Senn
2015-11-20 20:06:35 UTC
Permalink
Post by Mark Pizzolato
Post by Will Senn
Post by Anders Magnusson
Post by Will Senn
I have searched and searched and have not found a satisfactory answer
How can I efficiently copy files from my host system to unix version
6 running in the pdp11 emulator and from unix 6 to my host system?
on pdp11: tar cf /dev/rxp0c myfiles
on host: tar xf simh-disk-file
Works both ways :-)
-- Ragge
This sounded promising, but as it turns out there appear to be 2
problems... 1. v6 doesn't have tar, and 2. it looks like v6 doesn't have
rx device support (floppies). Are you using v6 with tweaks, or v7, or
some other variant of unix?
Well, the tar approach is certainly the most elegant and if tar was available, converting a raw tar file to a simh tape image back and forth is quite trivial if you've got a tape device...
So you may be reduced to cutting from the terminal session you are running the simulator in to get data from the simulator to the host (or the lpt approach you mentioned).
If you try the latest code at github.com/simh/simh, pasting into the console terminal or any other supported terminal will now work and you won't be limited to just a couple of lines pasting at any one time. This is new as of yesterday.
- Mark
Thanks for the pointer about the updated code. My reaction? Well, I'll
be... wow! I've been an off and on user over the last several years and
yesterday, this vexing problem is fixed? - surreal. This is a huge
improvement and will make it easier to copy and paste. However, at least
on my macbook, when I cat a file with tabs in it and copy and paste that
file, terminal converts the tabs to spaces. I confirmed this using:

cat /usr/source/s1/exit.c | od -c and observing the presence of \t in
the output. If I then cat the file to stdout and copy that into the
copy/paste buffer and do cat > myexit.c pasting it back in and cat that
to od -c, the \t is now a space.

Any ideas on how to preserve the tabs?

Thanks,

Will
Clem Cole
2015-11-20 20:50:30 UTC
Permalink
Post by Will Senn
Any ideas on how to preserve the tabs?
​uuencode the file first, then cat the result. cat/paste the encoded file
and uudecode it on the other end.

This is always the safest way to preserve 8 bit binaries through different
systems, terminal handlers, ascii to ebcdic etc...

Clem
Will Senn
2015-11-21 00:38:57 UTC
Permalink
Date: Fri, 20 Nov 2015 10:35:06 -0600
How can I efficiently copy files from my host system to unix version 6
running in the pdp11 emulator and from unix 6 to my host system?
You have gotten a number of answers, but none of them strikes me as the
best method for what you want to do.
There is a raw 8-bit device (well, pair of devices) on the PDP-11 which
will do the trick: The paper tape reader/punch. Simply cat the file onto
a paper tape image, or cat it from a paper tape image into a file. Won't
care whether it's text or binary. Won't revise the content to match a
display (\t will stay \t).
I've used this in the past. It works.
Rich
_______________________________________________
Rich,

This looks like the easiest method for text so far. However, I am
getting interesting results that I hope ring a bell for you or someone
else listening in...

I edit a text file on the host
vi ptr.txt
Hello World

fire up the simulator and:
simh> attach ptr ptr.txt
simh> attach ptp ptp.txt
co

# cat > hello < /dev/ppt
# cat hello
Hello World

Yee ha, I can read from paper tape.

cat hello > /dev/ppt

Bummer, nothing is written to ptp.txt. Well, as it turns out, the data
is sent to the tape, but it doesn't appear in the file until I suspend
the simulation with CTRL-E.

I tried sync's and waiting and no go. CTRL-E, immediately writes the
file. Does this sound like expected behavior or perhaps a bug?

It still works, mind you. I don't really mind suspending the instance
after a sync or two, but it isn't ideal.

Thanks,

Will
Loading...