aboutsummaryrefslogtreecommitdiff
path: root/unix/gdev/iism75
diff options
context:
space:
mode:
Diffstat (limited to 'unix/gdev/iism75')
-rw-r--r--unix/gdev/iism75/README24
-rw-r--r--unix/gdev/iism75/iis.h106
-rw-r--r--unix/gdev/iism75/m75.h28
-rw-r--r--unix/gdev/iism75/m75put.x160
-rw-r--r--unix/gdev/iism75/mkpkg18
-rw-r--r--unix/gdev/iism75/zclm75.x19
-rw-r--r--unix/gdev/iism75/zopm75.x32
-rw-r--r--unix/gdev/iism75/zrdm75.x163
-rw-r--r--unix/gdev/iism75/zstm75.x28
-rw-r--r--unix/gdev/iism75/zwrm75.x76
-rw-r--r--unix/gdev/iism75/zwtm75.x29
-rw-r--r--unix/gdev/iism75/zzrdii.x17
-rw-r--r--unix/gdev/iism75/zzwrii.x17
13 files changed, 717 insertions, 0 deletions
diff --git a/unix/gdev/iism75/README b/unix/gdev/iism75/README
new file mode 100644
index 00000000..60433d4d
--- /dev/null
+++ b/unix/gdev/iism75/README
@@ -0,0 +1,24 @@
+UNIX IRAF/FIO device driver for the IIS Model 75
+2 Feb 1896 Dct.; ported to UNIX from VMS 10 Mar 1987 SRo.
+----------------------------------------------------------------------
+
+This directory contains the IRAF/FIO driver subroutines for the IIS Model 75
+image display. This directory is self contained.
+
+The model 75 interface is implemented as a transformation on the data stream
+for the model 70. The high level code thinks that it is talking to a model
+70; we translate the headers as necessary for the model 75 before passing
+them on to the device. This approach does not provide full access to the
+capabilities of the model 75, however the existing high level code is all
+written for the model 70 and we are not at present interested in the advanced
+features of either display.
+
+
+Driver Procedures:
+
+ zopm75 -- open + allocate
+ zclm75 -- close + deallocate
+ zrdm75 -- asynchronous binary read
+ zwrm75 -- asynchronous binary write
+ zwtm75 -- wait for i/o completion, return status
+ zstm75 -- get device status
diff --git a/unix/gdev/iism75/iis.h b/unix/gdev/iism75/iis.h
new file mode 100644
index 00000000..515c0def
--- /dev/null
+++ b/unix/gdev/iism75/iis.h
@@ -0,0 +1,106 @@
+# IIS.H -- Hardware definitions for the IIS models 70 and 75.
+
+# Define header
+define LEN_IISHDR 8 # Length of IIS header
+
+define XFERID $1[1] # transfer id
+define THINGCT $1[2] # thing count
+define SUBUNIT $1[3] # subuint select
+define CHECKSUM $1[4] # check sum
+define XREG $1[5] # x register
+define YREG $1[6] # y register
+define ZREG $1[7] # z register
+define TREG $1[8] # t register
+
+# Transfer ID definitions
+define BYTEORDER 20B
+define PMA 40B
+define ACCELERATE 100B
+define REPEAT 200B
+define IREAD 100000B
+define IWRITE 000000B
+define PACKED 40000B
+define BYPASSIFM 20000B
+define PAGEMODE 10000B
+define ADDWRITE 4000B
+define ACCUM 2000B
+define BLOCKXFER 1000B
+define VRETRACE 400B
+
+define M70_BYTE 10000B
+define M70_MUX32 200B
+
+# Subunits
+define REFRESH 1
+define LUT 2
+define OFM 3
+define IFM 4
+define FEEDBACK 5
+define SCROLLZOOM 6
+define VIDEOM 7
+define SUMPROC 8
+define GRAPHICS 9
+define CURSOR 10
+define ALU 11
+
+define M70_SCROLL 6
+define M70_ZOOM 12
+
+# Command definitions
+define COMMAND 100000B
+define ERASE 100000B # Erase
+
+define SCROLL 1B
+define ZOOM 10000B
+define WRAP 1000B
+
+define M70_ADVXONTC 100000B # Advance x on thing count
+define M70_ADVXONYOV 40000B # Advance x on y overflow
+define M70_ADVYONXOV 100000B # Advance y on x overflow
+define M70_ADVYONTC 40000B # Advance y on thing count
+
+define M75_ADVXONTC 400B # Advance x on thing count
+define M75_ADVXONYOV 200B # Advance x on y overflow
+define M75_ADVYONXOV 2000B # Advance y on x overflow
+define M75_ADVYONTC 4000B # Advance y on thing count
+
+# 4 - Button Trackball
+define PUSH 40000B
+define BUTTONA 400B
+define BUTTONB 1000B
+define BUTTONC 2000B
+define BUTTOND 4000B
+
+# Display channels
+define CHAN1 1B
+define CHAN2 2B
+define CHAN3 4B
+define CHAN4 10B
+define GRCHAN 100000B
+
+define LEN_IISFRAMES 4
+define IISFRAMES CHAN1, CHAN2, CHAN3, CHAN4
+
+# Colors
+define BLUE 1B
+define GREEN 2B
+define RED 4B
+define MONO 7B
+
+# Bit plane selections
+define BITPL0 1B
+define BITPL1 2B
+define BITPL2 4B
+define BITPL3 10B
+define BITPL4 20B
+define BITPL5 40B
+define BITPL6 100B
+define BITPL7 200B
+define ALLBITPL 377B
+
+# IIS Sizes
+define MCXSCALE 64 # Metacode x scale
+define MCYSCALE 64 # Metacode y scale
+define IIS_XDIM 512
+define IIS_YDIM 512
+define SZB_IISHDR 16 # Size of IIS header in bytes
diff --git a/unix/gdev/iism75/m75.h b/unix/gdev/iism75/m75.h
new file mode 100644
index 00000000..832aa423
--- /dev/null
+++ b/unix/gdev/iism75/m75.h
@@ -0,0 +1,28 @@
+# Definitions for the Model 75 UNIX/IIS device driver.
+
+define IIS_READ 1 # read function code
+define IIS_WRITE 0 # write function code
+define IIS_INACTIVE 2 # no i/o in progress
+
+# Function control block structure containing only our own internal variables.
+
+define LEN_FCB 20
+define FCB_CHAN Memi[($1)] # os channel
+define FCB_STATUS Mems[P2S(($1)+1)] # channel status (r, w, err)
+define FCB_NBYTES Mems[P2S(($1)+2)] # nbytes last transfer
+define FCB_STATE Mems[P2S(($1)+3)] # instruction processing state
+define FCB_IISHDR Mems[P2S(($1)+4)] # m70 header of current instr.
+ # (extra space)
+
+# Instruction processing states
+
+define READY 0 # ready for new instruction
+define DATA_READ 1 # read data to complete instruction
+define DATA_WRITE 2 # write data to complete instruction
+
+# IIS device status words.
+
+define IIS_FILSIZE (512 * 512 * SZB_CHAR)
+define IIS_BLKSIZE 1024
+define IIS_OPTBUFSIZE (512 * SZB_CHAR)
+define IIS_MAXBUFSIZE 16384
diff --git a/unix/gdev/iism75/m75put.x b/unix/gdev/iism75/m75put.x
new file mode 100644
index 00000000..01ca6511
--- /dev/null
+++ b/unix/gdev/iism75/m75put.x
@@ -0,0 +1,160 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+include "iis.h"
+
+# M75PUT -- Translate an M70 instruction+data into an M75 instruction+data and
+# output it to the display device. We are called after both the instruction
+# header and the data (if any) have been received. The M70 header has been
+# saved in the the channel descriptor and the data, if any, is in BUF.
+
+procedure m75put (fcb, buf, nbytes_buf, offset)
+
+pointer fcb # pointer to channel descriptor
+short buf[ARB] # data array
+int nbytes_buf # nbytes of data in buffer
+long offset # not used
+
+int ifcb
+bool use_altbuf
+short altbuf[128]
+short m70[LEN_IISHDR]
+short m75[LEN_IISHDR]
+int nbytes, status, sum, i
+int xferid, subunit, xreg, yreg
+int and(), or(), not()
+
+begin
+ ifcb = fcb
+ use_altbuf = false
+
+ # Retrieve the M70 header from the channel descriptor.
+ call amovs (FCB_IISHDR(fcb), m70, LEN_IISHDR)
+
+ xferid = XFERID(m70)
+ subunit = SUBUNIT(m70)
+ xreg = XREG(m70)
+ yreg = YREG(m70)
+
+ if (THINGCT(m70) == 0)
+ nbytes = 0
+ else
+ nbytes = nbytes_buf
+
+ # Start with a copy of the header for the M75, but turn off those bits
+ # in the transfer id which the M70 knows nothing about and hence could
+ # not have set.
+
+ call amovs (m70, m75, LEN_IISHDR)
+ XFERID(m75) = and (xferid,
+ not (BYTEORDER+PMA+ACCELERATE+REPEAT+PAGEMODE))
+
+ # Translate the remaining fields of the header as necessary for each
+ # subunit.
+
+ switch (and (subunit, 77B)) {
+ case REFRESH:
+ if (and (xreg, M70_ADVXONTC) != 0)
+ subunit = or (subunit, M75_ADVXONTC)
+ if (and (xreg, M70_ADVXONYOV) != 0)
+ subunit = or (subunit, M75_ADVXONYOV)
+ if (and (yreg, M70_ADVYONTC) != 0)
+ subunit = or (subunit, M75_ADVYONTC)
+ if (and (yreg, M70_ADVYONXOV) != 0)
+ subunit = or (subunit, M75_ADVYONXOV)
+
+ SUBUNIT(m75) = subunit
+ XREG(m75) = and (xreg, IIS_XDIM-1)
+ YREG(m75) = and (yreg, IIS_YDIM-1)
+
+ case LUT:
+ XREG(m75) = and (xreg, 1777B)
+ YREG(m75) = 0
+
+ case OFM:
+ XREG(m75) = and (xreg, 1777B)
+ YREG(m75) = 0
+
+ # The M70 feeds a 10 bit output DAC while the M75 DAC is 8 bits.
+ do i = 1, nbytes_buf / (SZB_CHAR * SZ_SHORT)
+ buf[i] = buf[i] / 4
+
+ case FEEDBACK:
+ subunit = COMMAND + FEEDBACK
+ SUBUNIT(m75) = subunit
+ XREG(m75) = 0
+ YREG(m75) = 0
+
+ case GRAPHICS:
+ XREG(m75) = and (xreg, 777B)
+
+ # In a command mode transfer, the status register value is passed
+ # as data for the M70, but in the T register for the M75.
+
+ if (and (subunit, COMMAND) != 0) {
+ TREG(m75) = buf[1]
+ THINGCT(m75) = 0
+ nbytes = 0
+ }
+
+ case CURSOR:
+ XREG(m75) = and (xreg, 7777B)
+ YREG(m75) = 0
+
+ case M70_SCROLL:
+ SUBUNIT(m75) = SCROLLZOOM
+ XREG(m75) = and (xreg, 3B)
+ YREG(m75) = 0
+ ZREG(m75) = ALLBITPL
+ TREG(m75) = SCROLL + WRAP
+
+ case M70_ZOOM:
+ SUBUNIT(m75) = SCROLLZOOM
+ THINGCT(m75) = 2
+ XREG(m75) = and (xreg, 3B)
+ YREG(m75) = 0
+ ZREG(m75) = ALLBITPL
+ TREG(m75) = ZOOM + SCROLL + WRAP
+
+ # There are up to 3 words of data for the M70: zoom factor,
+ # x center, y center. For the M75 the zoom is specified
+ # separately for each axis in the high bits of the word which
+ # contains the axis center. For simplicity we require that
+ # all 3 words always be given.
+
+ altbuf[1] = buf[1] * 10000B + buf[2]
+ altbuf[2] = buf[1] * 10000B + buf[3]
+ use_altbuf = true
+ nbytes = 2 * (SZ_SHORT * SZB_CHAR)
+ }
+
+ # Compute the checksum for the new header.
+
+ CHECKSUM(m75) = 1
+ if (THINGCT(m75) > 0)
+ THINGCT(m75) = -THINGCT(m75)
+
+ sum = 0
+ do i = 1, LEN_IISHDR
+ sum = sum + m75[i]
+
+ CHECKSUM(m75) = -sum
+
+ # Output the header.
+
+ call zzwrii (fcb, m75, SZB_IISHDR, offset)
+ call zwtm75 (ifcb, status)
+ if (status == ERR) {
+ FCB_STATUS(fcb) = ERR
+ return
+ }
+
+ # Output the data block, if any.
+
+ if (nbytes > 0)
+ if (use_altbuf)
+ call zzwrii (fcb, altbuf, nbytes, offset)
+ else
+ call zzwrii (fcb, buf, nbytes, offset)
+end
diff --git a/unix/gdev/iism75/mkpkg b/unix/gdev/iism75/mkpkg
new file mode 100644
index 00000000..97387aec
--- /dev/null
+++ b/unix/gdev/iism75/mkpkg
@@ -0,0 +1,18 @@
+# Mkpkg for the UNIX version of the IIS driver.
+
+$checkout libsys.a lib$
+$update libsys.a
+$checkin libsys.a lib$
+$exit
+
+libsys.a:
+ m75put.x iis.h m75.h <mach.h>
+ zclm75.x m75.h <mach.h>
+ zopm75.x m75.h <mach.h>
+ zrdm75.x iis.h m75.h <mach.h>
+ zstm75.x m75.h <fio.h> <mach.h>
+ zwrm75.x iis.h m75.h <mach.h>
+ zwtm75.x m75.h <mach.h>
+ zzrdii.x m75.h <mach.h>
+ zzwrii.x m75.h <mach.h>
+ ;
diff --git a/unix/gdev/iism75/zclm75.x b/unix/gdev/iism75/zclm75.x
new file mode 100644
index 00000000..989358d9
--- /dev/null
+++ b/unix/gdev/iism75/zclm75.x
@@ -0,0 +1,19 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+
+# ZCLM75 -- Close and deallocate the IIS.
+
+procedure zclm75 (ifcb, status)
+
+int ifcb # pointer to channel descriptor passed as int
+int status
+pointer fcb
+
+begin
+ fcb = ifcb
+ call zclsbf (FCB_CHAN(fcb), status)
+
+ call mfree (fcb, TY_STRUCT)
+end
diff --git a/unix/gdev/iism75/zopm75.x b/unix/gdev/iism75/zopm75.x
new file mode 100644
index 00000000..33a9acf8
--- /dev/null
+++ b/unix/gdev/iism75/zopm75.x
@@ -0,0 +1,32 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+
+# ZOPM75 -- Open the IIS for binary file i/o.
+
+procedure zopm75 (device, mode, ifcb)
+
+char device[ARB] # packed UNIX device name
+int mode # access mode
+int ifcb # pointer to channel descriptor passed as int
+
+pointer fcb
+int chan
+
+begin
+ call calloc (fcb, LEN_FCB, TY_STRUCT)
+ ifcb = fcb
+
+ FCB_STATUS(fcb) = IIS_INACTIVE
+ FCB_NBYTES(fcb) = 0
+ FCB_STATE(fcb) = READY
+
+ call zopnbf (device, mode, chan)
+
+ if (chan < 0) {
+ call mfree (fcb, TY_STRUCT)
+ ifcb = ERR
+ } else
+ FCB_CHAN(fcb) = chan
+end
diff --git a/unix/gdev/iism75/zrdm75.x b/unix/gdev/iism75/zrdm75.x
new file mode 100644
index 00000000..9cc2498d
--- /dev/null
+++ b/unix/gdev/iism75/zrdm75.x
@@ -0,0 +1,163 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+include "iis.h"
+
+# ZRDM75 -- Initiate an asynchronous read of data from the IIS. Note that
+# the zwrm75 procedure is called to write the header for data reads, as well
+# as writes. Hence we should be called only after the header has been saved
+# in the channel descriptor by ZWRM75, leaving the channel in state DATA_READ.
+# Our task is to translate and output the header, read the M75 data block, and
+# return the data block to the user after performing any transformations
+# necessary to make it look like M70fdata.
+
+procedure zrdm75 (ifcb, buf, nbytes_buf, offset)
+
+int ifcb # pointer to channel descriptor passed as int
+short buf[ARB] # data array
+int nbytes_buf # nbytes of data in buffer
+long offset # not used
+
+pointer fcb
+short m70[LEN_IISHDR]
+short m75[LEN_IISHDR]
+int nbytes, status, sum, i
+int xferid, subunit, xreg, yreg
+int and(), or(), not()
+
+begin
+ fcb = ifcb
+ nbytes = nbytes_buf
+
+ if (FCB_STATE(fcb) != DATA_READ) {
+ FCB_STATUS(fcb) = ERR
+ return
+ }
+
+ # Retrieve the M70 header from the channel descriptor.
+ call amovs (FCB_IISHDR(fcb), m70, LEN_IISHDR)
+
+ xferid = XFERID(m70)
+ subunit = SUBUNIT(m70)
+ xreg = XREG(m70)
+ yreg = YREG(m70)
+
+ # Start with a copy of the header for the M75, but turn off those bits
+ # in the transfer id which the M70 knows nothing about and hence could
+ # not have set.
+
+ call amovs (m70, m75, LEN_IISHDR)
+ XFERID(m75) = and (xferid,
+ not (BYTEORDER+PMA+ACCELERATE+REPEAT+PAGEMODE))
+
+ # Translate the remaining fields of the header as necessary for each
+ # subunit.
+
+ switch (and (subunit, 77B)) {
+ case REFRESH:
+ if (and (xreg, M70_ADVXONTC) != 0)
+ subunit = or (subunit, M75_ADVXONTC)
+ if (and (xreg, M70_ADVXONYOV) != 0)
+ subunit = or (subunit, M75_ADVXONYOV)
+ if (and (yreg, M70_ADVYONTC) != 0)
+ subunit = or (subunit, M75_ADVYONTC)
+ if (and (yreg, M70_ADVYONXOV) != 0)
+ subunit = or (subunit, M75_ADVYONXOV)
+
+ SUBUNIT(m75) = subunit
+ XREG(m75) = and (xreg, IIS_XDIM-1)
+ YREG(m75) = and (yreg, IIS_YDIM-1)
+
+ case LUT:
+ XREG(m75) = and (xreg, 1777B)
+ YREG(m75) = 0
+
+ case OFM:
+ XREG(m75) = and (xreg, 1777B)
+ YREG(m75) = 0
+
+ # The M70 OFM lookup table is 10 bits deep, whereas the M75 table
+ # is only 8 bits deep, so scale the 8 bit M75 values up to 10 bits.
+
+ do i = 1, nbytes_buf / (SZB_CHAR * SZ_SHORT)
+ buf[i] = buf[i] * 4
+
+ case FEEDBACK:
+ subunit = COMMAND + FEEDBACK
+ SUBUNIT(m75) = subunit
+ XREG(m75) = 0
+ YREG(m75) = 0
+
+ case GRAPHICS:
+ XREG(m75) = and (xreg, 777B)
+ TREG(m75) = 0 # ??
+
+ case CURSOR:
+ XREG(m75) = and (xreg, 7777B)
+ YREG(m75) = 0
+
+ case M70_SCROLL:
+ SUBUNIT(m75) = SCROLLZOOM
+ XREG(m75) = and (xreg, 3B)
+ YREG(m75) = 0
+ ZREG(m75) = ALLBITPL
+ TREG(m75) = SCROLL + WRAP
+
+ case M70_ZOOM:
+ SUBUNIT(m75) = SCROLLZOOM
+ THINGCT(m75) = 2
+ nbytes = 2 * (SZ_SHORT * SZB_CHAR)
+ XREG(m75) = and (xreg, 3B)
+ YREG(m75) = 0
+ ZREG(m75) = ALLBITPL
+ TREG(m75) = ZOOM
+ }
+
+ # Compute the checksum for the new header.
+
+ CHECKSUM(m75) = 1
+ if (THINGCT(m75) > 0)
+ THINGCT(m75) = -THINGCT(m75)
+
+ sum = 0
+ do i = 1, LEN_IISHDR
+ sum = sum + m75[i]
+
+ CHECKSUM(m75) = -sum
+
+ # Output the header.
+
+ call zzwrii (fcb, m75, SZB_IISHDR, offset)
+ call zwtm75 (ifcb, status)
+ if (status == ERR) {
+ FCB_STATUS(fcb) = ERR
+ return
+ }
+
+ # Read the data block.
+
+ if (nbytes > 0) {
+ call zzrdii (fcb, buf, nbytes, offset)
+ call zwtm75 (ifcb, status)
+ if (status <= 0) {
+ FCB_STATUS(fcb) = ERR
+ return
+ }
+ }
+
+ # Perform any transformations on the data just read necessary to
+ # convert it into M70 format. If the number of bytes read is
+ # different than that expected by the M70, be sure to set the
+ # expected count in the channel descriptor for the next ZWTM75.
+
+ if (and (subunit, 77B) == ZOOM) {
+ FCB_NBYTES(fcb) = 3 * (SZ_SHORT * SZB_CHAR)
+ FCB_STATUS(fcb) = IIS_INACTIVE
+ buf[3] = mod (int(buf[2]), 10000B)
+ buf[2] = mod (int(buf[1]), 10000B)
+ buf[1] = buf[1] / 10000B
+ }
+
+ FCB_STATE(fcb) = READY
+end
diff --git a/unix/gdev/iism75/zstm75.x b/unix/gdev/iism75/zstm75.x
new file mode 100644
index 00000000..b1e9923c
--- /dev/null
+++ b/unix/gdev/iism75/zstm75.x
@@ -0,0 +1,28 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include <fio.h>
+include "m75.h"
+
+# ZSTM75 -- Return device status for the IIS.
+
+procedure zstm75 (ifcb, what, lvalue)
+
+int ifcb # pointer to channel descriptor passed as int
+int what # status parameter
+long lvalue
+
+begin
+ switch (what) {
+ case FSTT_FILSIZE:
+ lvalue = IIS_FILSIZE
+ case FSTT_BLKSIZE:
+ lvalue = IIS_BLKSIZE
+ case FSTT_OPTBUFSIZE:
+ lvalue = IIS_OPTBUFSIZE
+ case FSTT_MAXBUFSIZE:
+ lvalue = IIS_MAXBUFSIZE
+ default:
+ lvalue = ERR
+ }
+end
diff --git a/unix/gdev/iism75/zwrm75.x b/unix/gdev/iism75/zwrm75.x
new file mode 100644
index 00000000..38bb0f3c
--- /dev/null
+++ b/unix/gdev/iism75/zwrm75.x
@@ -0,0 +1,76 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+include "iis.h"
+
+# ZWRM75 -- Initiate an asynchronous write to the IIS. We are called to
+# output the header of all instructions sent to the IIS. There are 3 types
+# of instructions; those which consist only of a header write, those which
+# consist of a header write followed by a data write, and those which
+# consist of a header write followed by a data read. Translation of an M70
+# instruction into an M75 instruction may involve moving information between
+# the header and data block, hence we must save the headers of the read and
+# write instructions until the data has been read or written. The STATE
+# variable in the channel descriptor is used to keep track of the instruction
+# processing state.
+
+procedure zwrm75 (ifcb, buf, nbytes, offset)
+
+int ifcb # pointer to channel descriptor passed as int
+char buf[ARB] # input buffer
+int nbytes # number of bytes to write
+long offset # not used for this device
+
+pointer fcb
+int xferid, and()
+
+begin
+ fcb = ifcb
+
+ if (FCB_STATE(fcb) == READY) {
+ # Start a new instruction.
+
+ if (nbytes != SZB_IISHDR) {
+ FCB_STATUS(fcb) = ERR
+ return
+ }
+
+ # Save the M70 header in the descriptor.
+ call amovs (buf, FCB_IISHDR(fcb), LEN_IISHDR)
+ xferid = XFERID(buf)
+
+ # Determine the state for the new instruction.
+
+ if (THINGCT(buf) == 0)
+ FCB_STATE(fcb) = READY
+ else if (and (xferid, IREAD) != 0)
+ FCB_STATE(fcb) = DATA_READ
+ else
+ FCB_STATE(fcb) = DATA_WRITE
+
+ # If the new state is READY, no data read or write is needed,
+ # so just translate and output the header.
+
+ if (FCB_STATE(fcb) == READY)
+ call m75put (fcb, buf, nbytes, offset)
+ else {
+ # Set up a channel status as if we had just written the new
+ # header, so that the next ZWTM75 will not return an error.
+
+ FCB_STATUS(fcb) = IIS_INACTIVE
+ FCB_NBYTES(fcb) = SZB_IISHDR
+ }
+
+ } else if (FCB_STATE(fcb) == DATA_WRITE) {
+ # This is the second zwrm75 call for a hdr+data output
+ # instruction.
+
+ call m75put (fcb, buf, nbytes, offset)
+ FCB_STATE(fcb) = READY
+
+ } else {
+ # ZRDM75 should have been called, set error on the channel.
+ FCB_STATUS(fcb) = ERR
+ }
+end
diff --git a/unix/gdev/iism75/zwtm75.x b/unix/gdev/iism75/zwtm75.x
new file mode 100644
index 00000000..491b0f50
--- /dev/null
+++ b/unix/gdev/iism75/zwtm75.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+
+# ZWTM75 -- Wait for i/o completion and return the number of bytes read or
+# written or ERR. Repetitive calls return the same value.
+
+procedure zwtm75 (ifcb, status)
+
+int ifcb # pointer to channel descriptor passed as int
+int status # nbytes transferred or ERR
+
+pointer fcb
+
+begin
+ fcb = ifcb
+
+ switch (FCB_STATUS(fcb)) {
+ case ERR:
+ status = ERR
+ case IIS_INACTIVE:
+ status = FCB_NBYTES(fcb)
+
+ default:
+ call zawtbf (FCB_CHAN(fcb), status)
+ FCB_STATUS(fcb) = IIS_INACTIVE
+ }
+end
diff --git a/unix/gdev/iism75/zzrdii.x b/unix/gdev/iism75/zzrdii.x
new file mode 100644
index 00000000..f72058c3
--- /dev/null
+++ b/unix/gdev/iism75/zzrdii.x
@@ -0,0 +1,17 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+
+# ZZRDII -- Initiate an asynchronous read from the IIS.
+
+procedure zzrdii (fcb, buf, nbytes, offset)
+
+pointer fcb # pointer to channel descriptor
+char buf[ARB] # output buffer
+int nbytes # number of bytes to read
+long offset # not used for this device
+
+begin
+ call zardbf (FCB_CHAN(fcb), buf, nbytes, offset)
+end
diff --git a/unix/gdev/iism75/zzwrii.x b/unix/gdev/iism75/zzwrii.x
new file mode 100644
index 00000000..8515cc64
--- /dev/null
+++ b/unix/gdev/iism75/zzwrii.x
@@ -0,0 +1,17 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "m75.h"
+
+# ZZWRII -- Initiate an asynchronous write to the IIS.
+
+procedure zzwrii (fcb, buf, nbytes, offset)
+
+pointer fcb # pointer to channel descriptor
+char buf[ARB] # input buffer
+int nbytes # number of bytes to write
+long offset # not used for this device
+
+begin
+ call zawrbf (FCB_CHAN(fcb), buf, nbytes, offset)
+end