diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2019-04-09 02:40:05 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2019-04-09 02:40:05 +0100 |
commit | b72dc79eec3d369a38202522165f5ef4cfa5b98b (patch) | |
tree | 82e9754139370a77b76549aa32a40855bce987cb /doc | |
parent | 9ae59a93a74424e26045b749141cb238ec049a96 (diff) | |
download | mdk-b72dc79eec3d369a38202522165f5ef4cfa5b98b.tar.gz mdk-b72dc79eec3d369a38202522165f5ef4cfa5b98b.tar.bz2 |
Support IOC commands for disk/drum devices
Thanks to Kevin Brunelle
There is a minor fix included with regards to tape devices. The test
was failing if M == 0, when it should fail when M != 0.
NOTICE: This patch changes the behavior of the VM and changes the
function parameters for the ioc_ function. Documentation changes are
included.
Permits the following:
LDX BLKNUM
IOC 0(8)
OUT ADDR(8) Write block from ADDR into disk[BLKNUM]
IOC 0(8)
IN ADDR(8) Read block from disk[BLKNUM] into ADDR
...
BLKNUM CON 45000 Example possible block on disk
I was having an issue writing a block to a drive and then reading back
the same block. Because it is impossible to move the SEEK_CUR pointer
backwards on a disk device, there was no way for a program to read
back a block that it wrote to a disk without restarting or fiddling
with ~/.mdk/disk?.dev files and symbolic links.
I have added a function parameter to the ioc_ function and used it to
pass the value of rX to ioc_. This permits us to use IOC commands to
move the read/write head on a disk/drum device. I believe that this
conforms to the potential meaning of Knuth's description of IOC for
disk/drum devices.
I have put in tests to verify that rX is positive and M = 0.
I have updated the documentation to reflect this new behavior.
This makes disks much more usable.
Note: I won't be offended if this patch is rejected because it changed
the behavior of the VM. I think it fits the spirit and enhances the
functionality in a way that some might find useful. I wanted it for
something I was working on, and I felt others might want the same. The
thing with the paper-tape should be fixed, though.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/mdk_tut.texi | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/doc/mdk_tut.texi b/doc/mdk_tut.texi index e2d3a15..9ff6f86 100644 --- a/doc/mdk_tut.texi +++ b/doc/mdk_tut.texi @@ -684,14 +684,17 @@ OPCODE = 34, MOD = I/O unit. @noindent In all the above instructions, the @samp{MOD} subfile must be in the range 0-20, since it denotes the operation's target device. The -@samp{IOC} instruction only makes sense for tape devices (@samp{MOD} = -0-7 or 20): it shifts the read/write pointer by the number of words -given by @samp{M} (if it equals zero, the tape is rewound)@footnote{In -Knuth's original definition, there are other control operations -available, but they do not make sense when implementing the block -devices as disk files (as we do in @sc{mdk} simulator). For the same -reason, @sc{mdk} devices are always ready, since all input-output -operations are performed using synchronous system calls.}. +@samp{IOC} instruction makes sense for magnetic tape devices (@samp{MOD} = +0-7): it shifts the read/write pointer by the number of blocks +given by @samp{M} (if it equals zero, the tape is rewound), paper tape +devices (@samp{MOD} = 20): @samp{M} should be 0, the tape is rewound, +and disk/drum devices (@samp{MOD} = 8-15): it moves the read/write +pointer to the block specified in rX and @samp{M} should be 0@footnote{In +Knuth's original definition, there are other control operations available, +but they do not make sense when implementing the devices as disk files (as +we do in @sc{mdk} simulator). For the same reason, @sc{mdk} devices are +always ready, since all input-output operations are performed using +synchronous system calls.}. @node Conversion operators, Shift operators, Input-output operators, MIX instruction set |